105 unsigned char b_ModulNbr, b_ChannelAMode, b_ChannelBMode;
106 unsigned char b_MemoryOnOff, b_ConfigType;
108 unsigned int dw_WriteConfig = 0;
111 b_ConfigType = (
unsigned char) data[0];
112 b_ChannelAMode = (
unsigned char) data[1];
113 b_ChannelBMode = (
unsigned char) data[2];
114 b_MemoryOnOff = (
unsigned char) data[1];
115 i_ReturnValue = insn->
n;
121 if (b_ModulNbr >= 4) {
122 DPRINTK(
"Module Number invalid\n");
126 switch (b_ConfigType) {
136 s_DigitalIOInfo.b_OutputMemoryEnabled = 1;
142 s_DigitalIOInfo.dw_OutputMemory = 0;
150 s_DigitalIOInfo.b_OutputMemoryEnabled = 0;
161 dw_MolduleConfiguration[b_ModulNbr] &
168 if ((b_ChannelAMode == 0) || (b_ChannelAMode == 1)) {
173 if ((b_ChannelBMode == 0)
174 || (b_ChannelBMode == 1)) {
176 s_DigitalIOInfo.b_DigitalInit =
185 b_ChannelAMode = b_ChannelAMode;
193 b_ChannelBMode = b_ChannelBMode;
200 (
unsigned int) (b_ChannelAMode |
201 (b_ChannelBMode * 2));
216 DPRINTK(
"Bi-directional channel B configuration error\n");
224 DPRINTK(
"Bi-directional channel A configuration error\n");
233 DPRINTK(
"The module is not a digital I/O module\n");
237 printk(
"Return Value %d\n", i_ReturnValue);
302 unsigned char *pb_ChannelStatus;
306 pb_ChannelStatus = (
unsigned char *) &data[0];
307 i_ReturnValue = insn->
n;
313 if (b_ModulNbr < 4) {
319 dw_MolduleConfiguration[b_ModulNbr] &
325 if (b_InputChannel <= 6) {
330 if (
devpriv->s_ModuleInfo[b_ModulNbr].
331 s_DigitalIOInfo.b_DigitalInit == 1) {
336 if (b_InputChannel > 4) {
341 if (b_InputChannel == 5) {
385 if (i_ReturnValue >= 0) {
402 (
unsigned char) ((dw_StatusReg ^
411 DPRINTK(
"Digital I/O not initialised\n");
418 DPRINTK(
"Selected digital input error\n");
425 DPRINTK(
"The module is not a digital I/O module\n");
432 DPRINTK(
"Module number error\n");
488 unsigned int dw_WriteValue = 0;
490 i_ReturnValue = insn->
n;
498 if (b_ModulNbr < 4) {
504 dw_MolduleConfiguration[b_ModulNbr] &
510 if (
devpriv->s_ModuleInfo[b_ModulNbr].
511 s_DigitalIOInfo.b_DigitalInit == 1) {
516 switch (b_OutputChannel) {
529 if (
devpriv->s_ModuleInfo[b_ModulNbr].
531 b_ChannelAMode != 1) {
545 if (
devpriv->s_ModuleInfo[b_ModulNbr].
547 b_ChannelBMode != 1) {
569 if (i_ReturnValue >= 0) {
583 b_OutputMemoryEnabled ==
611 b_OutputMemoryEnabled ==
650 ui_Address + (64 * b_ModulNbr));
738 unsigned int dw_WriteValue = 0;
741 unsigned char b_PortOperation, b_PortOnOFF;
743 unsigned char *pb_PortValue;
746 b_PortOperation = (
unsigned char) data[0];
747 b_PortOnOFF = (
unsigned char) data[1];
748 b_PortValue = (
unsigned char) data[2];
749 i_ReturnValue = insn->
n;
750 pb_PortValue = (
unsigned char *) &data[0];
753 switch (b_PortOperation) {
759 if (b_ModulNbr < 4) {
765 dw_MolduleConfiguration[b_ModulNbr] &
771 if (
devpriv->s_ModuleInfo[b_ModulNbr].
772 s_DigitalIOInfo.b_DigitalInit == 1) {
786 ui_Address + (64 * b_ModulNbr));
788 (
unsigned char) (dw_StatusReg ^ 0x1C);
819 if (b_ModulNbr < 4) {
825 dw_MolduleConfiguration[b_ModulNbr] &
831 if (
devpriv->s_ModuleInfo[b_ModulNbr].
832 s_DigitalIOInfo.b_DigitalInit == 1) {
837 if (b_PortValue <= 7) {
846 if ((b_PortValue & 2) == 2) {
866 if ((b_PortValue & 4) == 4) {
886 if (i_ReturnValue >= 0) {
890 switch (b_PortOnOFF) {
905 b_OutputMemoryEnabled
942 b_OutputMemoryEnabled
1022 DPRINTK(
"NO INPUT/OUTPUT specified\n");