126 unsigned int ui_TimerValue;
127 unsigned char b_ModulNbr, b_SSIProfile, b_PositionTurnLength, b_TurnCptLength,
128 b_PCIInputClock, b_SSICountingMode;
129 unsigned int ul_SSIOutputClock;
132 b_SSIProfile = (
unsigned char) data[0];
133 b_PositionTurnLength = (
unsigned char) data[1];
134 b_TurnCptLength = (
unsigned char) data[2];
135 b_PCIInputClock = (
unsigned char) data[3];
136 ul_SSIOutputClock = (
unsigned int) data[4];
137 b_SSICountingMode = (
unsigned char) data[5];
139 i_ReturnValue = insn->
n;
144 if (b_ModulNbr < 4) {
150 dw_MolduleConfiguration[b_ModulNbr] &
157 if (b_SSIProfile >= 2 && b_SSIProfile < 33) {
162 if (b_PositionTurnLength > 0
163 && b_PositionTurnLength < 32) {
168 if (b_TurnCptLength > 0
169 && b_TurnCptLength < 32) {
174 if ((b_TurnCptLength +
175 b_PositionTurnLength)
181 if (b_PCIInputClock ==
192 if ((b_PCIInputClock ==
APCI1710_30MHZ && (ul_SSIOutputClock > 228 && ul_SSIOutputClock <= 5000000
UL)) || (b_PCIInputClock ==
APCI1710_33MHZ && (ul_SSIOutputClock > 251 && ul_SSIOutputClock <= 5000000
UL))) {
211 b_PositionTurnLength;
227 outl(b_SSIProfile + 1,
devpriv->s_BoardInfos.ui_Address + 4 + (64 * b_ModulNbr));
230 outl(b_SSIProfile,
devpriv->s_BoardInfos.ui_Address + 4 + (64 * b_ModulNbr));
241 ((
unsigned int) (b_PCIInputClock) * 500000
UL) / ul_SSIOutputClock);
247 outl(ui_TimerValue,
devpriv->s_BoardInfos.ui_Address + (64 * b_ModulNbr));
253 outl(7 * b_SSICountingMode,
devpriv->s_BoardInfos.ui_Address + 12 + (64 * b_ModulNbr));
267 DPRINTK(
"The selected SSI counting mode parameter is wrong\n");
277 DPRINTK(
"The selected SSI output clock is wrong\n");
287 DPRINTK(
"The selected PCI input clock is wrong\n");
296 DPRINTK(
"The selected SSI profile length is wrong\n");
304 DPRINTK(
"The selected SSI turn counter data length is wrong\n");
312 DPRINTK(
"The selected SSI position data length is wrong\n");
320 DPRINTK(
"The selected SSI profile length is wrong\n");
328 DPRINTK(
"The module is not a SSI module\n");
336 DPRINTK(
"Module number error\n");
394 unsigned char b_Length;
395 unsigned char b_Schift;
396 unsigned char b_SSICpt;
398 unsigned int dw_And1;
399 unsigned int dw_And2;
401 unsigned int dw_CounterValue;
403 unsigned char b_SelectedSSI;
404 unsigned char b_ReadType;
405 unsigned int *pul_Position;
406 unsigned int *pul_TurnCpt;
407 unsigned int *pul_Position1;
408 unsigned int *pul_TurnCpt1;
410 i_ReturnValue = insn->
n;
411 pul_Position1 = (
unsigned int *) &data[0];
413 pul_TurnCpt1 = (
unsigned int *) &data[1];
415 pul_Position = (
unsigned int *) &data[0];
416 pul_TurnCpt = (
unsigned int *) &data[3];
425 if (b_ModulNbr < 4) {
431 dw_MolduleConfiguration[b_ModulNbr] &
437 if (
devpriv->s_ModuleInfo[b_ModulNbr].
438 s_SSICounterInfo.b_SSIInit == 1) {
440 switch (b_ReadType) {
447 if (b_SelectedSSI < 3) {
466 }
while ((dw_StatusReg & 0x1)
477 (b_SelectedSSI * 4) +
487 if ((b_Length * 2) !=
502 b_PositionTurnLength;
516 b_PositionTurnLength;
550 DPRINTK(
"The selected SSI is wrong\n");
563 b_PositionTurnLength; b_Cpt++) {
564 dw_And1 = dw_And1 * 2;
574 b_TurnCptLength; b_Cpt++) {
575 dw_And2 = dw_And2 * 2;
596 }
while ((dw_StatusReg & 0x1) != 0);
598 for (b_SSICpt = 0; b_SSICpt < 3;
618 if ((b_Length * 2) !=
633 b_PositionTurnLength;
635 pul_Position[b_SSICpt] =
638 pul_Position[b_SSICpt] =
639 pul_Position[b_SSICpt] &
642 pul_TurnCpt[b_SSICpt] =
645 pul_TurnCpt[b_SSICpt] =
646 pul_TurnCpt[b_SSICpt] &
652 printk(
"Read Type Inputs Wrong\n");
661 DPRINTK(
"SSI not initialised\n");
669 DPRINTK(
"The module is not a SSI module\n");
678 DPRINTK(
"Module number error\n");
728 unsigned char b_InputChannel;
729 unsigned char *pb_ChannelStatus;
730 unsigned char *pb_InputStatus;
731 unsigned char b_IOType;
732 i_ReturnValue = insn->
n;
734 b_IOType = (
unsigned char) data[0];
740 if (b_ModulNbr < 4) {
746 dw_MolduleConfiguration[b_ModulNbr] &
773 pb_ChannelStatus = (
unsigned char *) &data[0];
775 if (b_InputChannel <= 2) {
782 ui_Address + (64 * b_ModulNbr));
784 (
unsigned char) (((~dw_StatusReg) >> (4 +
792 DPRINTK(
"Selected digital input error\n");
801 pb_InputStatus = (
unsigned char *) &data[0];
807 (
unsigned char) (((~dw_StatusReg) >> 4) & 7);
811 printk(
"IO type wrong\n");
819 DPRINTK(
"The module is not a SSI module\n");
827 DPRINTK(
"Module number error\n");