130 unsigned int dw_IntRegister;
133 unsigned char b_PulseEncoderNbr;
134 unsigned char b_InputLevelSelection;
135 unsigned char b_TriggerOutputAction;
136 unsigned int ul_StartValue;
139 b_PulseEncoderNbr = (
unsigned char) data[0];
140 b_InputLevelSelection = (
unsigned char) data[1];
141 b_TriggerOutputAction = (
unsigned char) data[2];
142 ul_StartValue = (
unsigned int) data[3];
144 i_ReturnValue = insn->
n;
150 if (b_ModulNbr <= 3) {
156 dw_MolduleConfiguration[b_ModulNbr] &
163 if (b_PulseEncoderNbr <= 3) {
168 if ((b_InputLevelSelection == 0)
169 || (b_InputLevelSelection == 1)) {
174 if ((b_TriggerOutputAction <= 2)
175 || (b_PulseEncoderNbr > 0)) {
176 if (ul_StartValue > 1) {
203 s_PulseEncoderModuleInfo.
208 s_PulseEncoderModuleInfo.
211 (1
UL << (8 + b_PulseEncoderNbr)))) | ((1
UL & (~b_InputLevelSelection)) << (8 + b_PulseEncoderNbr));
217 if ((b_TriggerOutputAction > 0) && (b_PulseEncoderNbr > 1)) {
225 s_PulseEncoderModuleInfo.
231 s_PulseEncoderModuleInfo.
234 << (4 + b_PulseEncoderNbr));
243 s_PulseEncoderModuleInfo.
249 s_PulseEncoderModuleInfo.
254 (1
UL << (12 + b_PulseEncoderNbr)))) | ((1
UL & (b_TriggerOutputAction - 1)) << (12 + b_PulseEncoderNbr));
263 s_PulseEncoderModuleInfo.
269 s_PulseEncoderModuleInfo.
274 (1
UL << (4 + b_PulseEncoderNbr)));
284 s_PulseEncoderModuleInfo.
295 s_PulseEncoderModuleInfo.
305 DPRINTK(
"Pulse encoder start value is wrong\n");
313 DPRINTK(
"Digital TRIGGER output action selection is wrong\n");
321 DPRINTK(
"Input level selection is wrong\n");
329 DPRINTK(
"Pulse encoder selection is wrong\n");
337 DPRINTK(
"The module is not a pulse encoder module\n");
345 DPRINTK(
"The module is not a pulse encoder module\n");
422 unsigned char b_PulseEncoderNbr;
423 unsigned char b_CycleSelection;
424 unsigned char b_InterruptHandling;
425 unsigned char b_Action;
427 i_ReturnValue = insn->
n;
429 b_Action = (
unsigned char) data[0];
430 b_PulseEncoderNbr = (
unsigned char) data[1];
431 b_CycleSelection = (
unsigned char) data[2];
432 b_InterruptHandling = (
unsigned char) data[3];
438 if (b_ModulNbr <= 3) {
443 if (b_PulseEncoderNbr <= 3) {
448 if (
devpriv->s_ModuleInfo[b_ModulNbr].
449 s_PulseEncoderModuleInfo.
450 s_PulseEncoderInfo[b_PulseEncoderNbr].
451 b_PulseEncoderInit == 1) {
459 if (b_CycleSelection ==
461 || b_CycleSelection ==
467 if (b_InterruptHandling ==
469 || b_InterruptHandling
475 if (b_InterruptHandling
486 s_PulseEncoderModuleInfo.
492 s_PulseEncoderModuleInfo.
497 (1
UL << b_PulseEncoderNbr));
507 s_PulseEncoderModuleInfo.
513 s_PulseEncoderModuleInfo.
522 if (i_ReturnValue >= 0) {
530 s_PulseEncoderModuleInfo.
544 s_PulseEncoderModuleInfo.
550 s_PulseEncoderModuleInfo.
563 s_PulseEncoderModuleInfo.
569 s_PulseEncoderModuleInfo.
574 (1 << (b_PulseEncoderNbr + 4)))) | ((b_CycleSelection & 1
UL) << (4 + b_PulseEncoderNbr));
583 s_PulseEncoderModuleInfo.
596 DPRINTK(
"Interrupt handling mode is wrong\n");
604 DPRINTK(
"Cycle selection mode is wrong\n");
611 s_PulseEncoderModuleInfo.
615 s_PulseEncoderModuleInfo.
618 (1
UL << b_PulseEncoderNbr));
625 s_PulseEncoderModuleInfo.
639 DPRINTK(
"Pulse encoder not initialised\n");
647 DPRINTK(
"Pulse encoder selection is wrong\n");
655 DPRINTK(
"Module selection is wrong\n");
715 unsigned int dw_StatusRegister;
717 unsigned char b_PulseEncoderNbr;
718 unsigned char *pb_Status;
719 unsigned char b_Type;
720 unsigned int *pul_ReadValue;
721 unsigned int ul_WriteValue;
723 i_ReturnValue = insn->
n;
725 b_Type = (
unsigned char) data[0];
726 b_PulseEncoderNbr = (
unsigned char) data[1];
727 pb_Status = (
unsigned char *) &data[0];
728 pul_ReadValue = (
unsigned int *) &data[1];
734 if (b_ModulNbr <= 3) {
739 if (b_PulseEncoderNbr <= 3) {
744 if (
devpriv->s_ModuleInfo[b_ModulNbr].
745 s_PulseEncoderModuleInfo.
746 s_PulseEncoderInfo[b_PulseEncoderNbr].
747 b_PulseEncoderInit == 1) {
761 s_PulseEncoderModuleInfo.
764 s_PulseEncoderModuleInfo.
770 s_ModuleInfo[b_ModulNbr].
771 s_PulseEncoderModuleInfo.
772 dw_StatusRegister >> (1 +
773 b_PulseEncoderNbr)) & 1;
776 s_PulseEncoderModuleInfo.
780 s_PulseEncoderModuleInfo.
782 (0xFFFFFFFF
UL - (1 << (1 +
783 b_PulseEncoderNbr)));
792 (4 * b_PulseEncoderNbr) +
797 ul_WriteValue = (
unsigned int) data[2];
805 (4 * b_PulseEncoderNbr) +
814 DPRINTK(
"Pulse encoder not initialised\n");
822 DPRINTK(
"Pulse encoder selection is wrong\n");
830 DPRINTK(
"Module selection is wrong\n");
841 data[0] =
devpriv->s_InterruptParameters.
842 s_FIFOInterruptParameters[
devpriv->
843 s_InterruptParameters.ui_Read].b_OldModuleMask;
844 data[1] =
devpriv->s_InterruptParameters.
845 s_FIFOInterruptParameters[
devpriv->
846 s_InterruptParameters.ui_Read].ul_OldInterruptMask;
847 data[2] =
devpriv->s_InterruptParameters.
848 s_FIFOInterruptParameters[
devpriv->
849 s_InterruptParameters.ui_Read].ul_OldCounterLatchValue;
855 devpriv->s_InterruptParameters.