4 Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module.
10 Fax: +49(0)7223/9493-92
11 http://www.addi-data.com
14 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
16 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 You should also find the complete GPL in the COPYING file accompanying this source code.
26 +-----------------------------------------------------------------------+
27 | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier |
28 +-----------------------------------------------------------------------+
29 | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com |
30 | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com |
31 +-----------------------------------------------------------------------+
32 | Project : API APCI1710 | Compiler : gcc |
33 | Module name : TOR.C | Version : 2.96 |
34 +-------------------------------+---------------------------------------+
35 | Project manager: Eric Stolz | Date : 02/12/2002 |
36 +-----------------------------------------------------------------------+
37 | Description : APCI-1710 tor counter module |
40 +-----------------------------------------------------------------------+
42 +-----------------------------------------------------------------------+
43 | Date | Author | Description of updates |
44 +----------+-----------+------------------------------------------------+
45 | 27/01/99 | S. Weber | 40 MHz implementation |
46 +-----------------------------------------------------------------------+
47 | 28/04/00 | S. Weber | Simple,double and quadruple mode implementation|
48 | | | Extern clock implementation |
49 +-----------------------------------------------------------------------+
50 | 08/05/00 | Guinot C | - 0400/0228 All Function in RING 0 |
52 +-----------------------------------------------------------------------+
55 #define APCI1710_30MHZ 30
56 #define APCI1710_33MHZ 33
57 #define APCI1710_40MHZ 40
59 #define APCI1710_GATE_INPUT 10
61 #define APCI1710_TOR_SIMPLE_MODE 2
62 #define APCI1710_TOR_DOUBLE_MODE 3
63 #define APCI1710_TOR_QUADRUPLE_MODE 4
65 #define APCI1710_SINGLE 0
66 #define APCI1710_CONTINUOUS 1
68 #define APCI1710_TOR_GETPROGRESSSTATUS 0
69 #define APCI1710_TOR_GETCOUNTERVALUE 1
70 #define APCI1710_TOR_READINTERRUPT 2
73 +----------------------------------------------------------------------------+
74 | Function Name : _INT_ i_APCI1710_InitTorCounter |
75 | (unsigned char_ b_BoardHandle, |
76 | unsigned char_ b_ModulNbr, |
77 | unsigned char_ b_TorCounter, |
78 | unsigned char_ b_PCIInputClock, |
79 | unsigned char_ b_TimingUnit, |
80 | ULONG_ ul_TimingInterval, |
81 | PULONG_ pul_RealTimingInterval) |
82 +----------------------------------------------------------------------------+
83 | Task : Configure the selected tor counter (b_TorCounter) |
84 | from selected module (b_ModulNbr). |
85 | The ul_TimingInterval and ul_TimingUnit determine the |
86 | timing base for the measurement. |
87 | The pul_RealTimingInterval return the real timing |
88 | value. You must calling this function be for you call |
89 | any other function witch access of the tor counter. |
91 +----------------------------------------------------------------------------+
92 | Input Parameters : |
94 CR_AREF unsigned char_ b_ModulNbr : Module number to configure |
96 | data[0] unsigned char_ b_TorCounter : Tor counter selection |
98 | data[1] unsigned char_ b_PCIInputClock : Selection from PCI bus clock|
99 | - APCI1710_30MHZ : |
100 | The PC have a PCI bus |
101 | clock from 30 MHz |
102 | - APCI1710_33MHZ : |
103 | The PC have a PCI bus |
104 | clock from 33 MHz |
106 | The APCI-1710 have a |
109 | - APCI1710_GATE_INPUT |
110 | Used the gate input for |
111 | the base clock. If you |
112 | have selected this option,|
113 | than it is not possibl to |
114 | used the gate input for |
115 | enabled the acquisition |
116 | data[2] unsigned char_ b_TimingUnit : Base timing unit (0 to 4) |
122 | data[3] ULONG_ ul_TimingInterval : Base timing value. |
123 +----------------------------------------------------------------------------+
124 | Output Parameters : PULONG_ pul_RealTimingInterval : Real base timing |
126 +----------------------------------------------------------------------------+
127 | Return Value : 0: No error |
128 | -1: The handle parameter of the board is wrong |
129 | -2: Module selection wrong |
130 | -3: The module is not a tor counter module |
131 | -4: Tor counter selection is wrong |
132 | -5: The selected PCI input clock is wrong |
133 | -6: Timing unit selection is wrong |
134 | -7: Base timing selection is wrong |
135 | -8: You can not used the 40MHz clock selection wich |
137 | -9: You can not used the 40MHz clock selection wich |
139 +----------------------------------------------------------------------------+
142 static int i_APCI1710_InsnConfigInitTorCounter(struct comedi_device *dev,
143 struct comedi_subdevice *s,
144 struct comedi_insn *insn,
147 struct addi_private *devpriv = dev->private;
148 int i_ReturnValue = 0;
149 unsigned int ul_TimerValue = 0;
150 unsigned int dw_Command;
151 double d_RealTimingInterval = 0;
152 unsigned char b_ModulNbr;
153 unsigned char b_TorCounter;
154 unsigned char b_PCIInputClock;
155 unsigned char b_TimingUnit;
156 unsigned int ul_TimingInterval;
157 unsigned int ul_RealTimingInterval = 0;
159 i_ReturnValue = insn->n;
160 b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
162 b_TorCounter = (unsigned char) data[0];
163 b_PCIInputClock = (unsigned char) data[1];
164 b_TimingUnit = (unsigned char) data[2];
165 ul_TimingInterval = (unsigned int) data[3];
166 printk("INPUT clock %d\n", b_PCIInputClock);
168 /**************************/
169 /* Test the module number */
170 /**************************/
172 if (b_ModulNbr < 4) {
173 /***********************/
174 /* Test if tor counter */
175 /***********************/
177 if ((devpriv->s_BoardInfos.
178 dw_MolduleConfiguration[b_ModulNbr] &
179 0xFFFF0000UL) == APCI1710_TOR_COUNTER) {
180 /**********************************/
181 /* Test the tor counter selection */
182 /**********************************/
184 if (b_TorCounter <= 1) {
185 /**************************/
186 /* Test the PCI bus clock */
187 /**************************/
189 if ((b_PCIInputClock == APCI1710_30MHZ) ||
190 (b_PCIInputClock == APCI1710_33MHZ) ||
191 (b_PCIInputClock == APCI1710_40MHZ) ||
193 APCI1710_GATE_INPUT)) {
194 /************************/
195 /* Test the timing unit */
196 /************************/
198 if ((b_TimingUnit <= 4)
199 || (b_PCIInputClock ==
200 APCI1710_GATE_INPUT)) {
201 /**********************************/
202 /* Test the base timing selection */
203 /**********************************/
205 if (((b_PCIInputClock == APCI1710_30MHZ) && (b_TimingUnit == 0) && (ul_TimingInterval >= 133) && (ul_TimingInterval <= 0xFFFFFFFFUL)) || ((b_PCIInputClock == APCI1710_30MHZ) && (b_TimingUnit == 1) && (ul_TimingInterval >= 1) && (ul_TimingInterval <= 571230650UL)) || ((b_PCIInputClock == APCI1710_30MHZ) && (b_TimingUnit == 2) && (ul_TimingInterval >= 1) && (ul_TimingInterval <= 571230UL)) || ((b_PCIInputClock == APCI1710_30MHZ) && (b_TimingUnit == 3) && (ul_TimingInterval >= 1) && (ul_TimingInterval <= 571UL)) || ((b_PCIInputClock == APCI1710_30MHZ) && (b_TimingUnit == 4) && (ul_TimingInterval >= 1) && (ul_TimingInterval <= 9UL)) || ((b_PCIInputClock == APCI1710_33MHZ) && (b_TimingUnit == 0) && (ul_TimingInterval >= 121) && (ul_TimingInterval <= 0xFFFFFFFFUL)) || ((b_PCIInputClock == APCI1710_33MHZ) && (b_TimingUnit == 1) && (ul_TimingInterval >= 1) && (ul_TimingInterval <= 519691043UL)) || ((b_PCIInputClock == APCI1710_33MHZ) && (b_TimingUnit == 2) && (ul_TimingInterval >= 1) && (ul_TimingInterval <= 519691UL)) || ((b_PCIInputClock == APCI1710_33MHZ) && (b_TimingUnit == 3) && (ul_TimingInterval >= 1) && (ul_TimingInterval <= 520UL)) || ((b_PCIInputClock == APCI1710_33MHZ) && (b_TimingUnit == 4) && (ul_TimingInterval >= 1) && (ul_TimingInterval <= 8UL)) || ((b_PCIInputClock == APCI1710_40MHZ) && (b_TimingUnit == 0) && (ul_TimingInterval >= 100) && (ul_TimingInterval <= 0xFFFFFFFFUL)) || ((b_PCIInputClock == APCI1710_40MHZ) && (b_TimingUnit == 1) && (ul_TimingInterval >= 1) && (ul_TimingInterval <= 429496729UL)) || ((b_PCIInputClock == APCI1710_40MHZ) && (b_TimingUnit == 2) && (ul_TimingInterval >= 1) && (ul_TimingInterval <= 429496UL)) || ((b_PCIInputClock == APCI1710_40MHZ) && (b_TimingUnit == 3) && (ul_TimingInterval >= 1) && (ul_TimingInterval <= 429UL)) || ((b_PCIInputClock == APCI1710_40MHZ) && (b_TimingUnit == 4) && (ul_TimingInterval >= 1) && (ul_TimingInterval <= 7UL)) || ((b_PCIInputClock == APCI1710_GATE_INPUT) && (ul_TimingInterval >= 2))) {
206 /**************************/
207 /* Test the board version */
208 /**************************/
210 if (((b_PCIInputClock == APCI1710_40MHZ) && (devpriv->s_BoardInfos.b_BoardVersion > 0)) || (b_PCIInputClock != APCI1710_40MHZ)) {
211 /************************/
212 /* Test the TOR version */
213 /************************/
215 if (((b_PCIInputClock == APCI1710_40MHZ) && ((devpriv->s_BoardInfos.dw_MolduleConfiguration[b_ModulNbr] & 0xFFFF) >= 0x3131)) || ((b_PCIInputClock == APCI1710_GATE_INPUT) && ((devpriv->s_BoardInfos.dw_MolduleConfiguration[b_ModulNbr] & 0xFFFF) >= 0x3132)) || (b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) {
216 /*********************************/
217 /* Test if not extern clock used */
218 /*********************************/
220 if (b_PCIInputClock != APCI1710_GATE_INPUT) {
223 /****************************************/
224 /* Calculate the timer 0 division fator */
225 /****************************************/
227 switch (b_TimingUnit) {
243 (0.00025 * b_PCIInputClock));
245 /*******************/
246 /* Round the value */
247 /*******************/
249 if ((double)((double)ul_TimingInterval * (0.00025 * (double)b_PCIInputClock)) >= ((double)((double)ul_TimerValue + 0.5))) {
257 /*****************************/
258 /* Calculate the real timing */
259 /*****************************/
261 ul_RealTimingInterval
266 (0.00025 * (double)b_PCIInputClock));
277 if ((double)((double)ul_TimerValue / (0.00025 * (double)b_PCIInputClock)) >= (double)((double)ul_RealTimingInterval + 0.5)) {
278 ul_RealTimingInterval
280 ul_RealTimingInterval
296 if (b_PCIInputClock != APCI1710_40MHZ) {
324 (0.25 * b_PCIInputClock));
326 /*******************/
327 /* Round the value */
328 /*******************/
330 if ((double)((double)ul_TimingInterval * (0.25 * (double)b_PCIInputClock)) >= ((double)((double)ul_TimerValue + 0.5))) {
338 /*****************************/
339 /* Calculate the real timing */
340 /*****************************/
342 ul_RealTimingInterval
347 (0.25 * (double)b_PCIInputClock));
360 if ((double)((double)ul_TimerValue / (0.25 * (double)b_PCIInputClock)) >= (double)((double)ul_RealTimingInterval + 0.5)) {
361 ul_RealTimingInterval
363 ul_RealTimingInterval
379 if (b_PCIInputClock != APCI1710_40MHZ) {
410 /*******************/
411 /* Round the value */
412 /*******************/
414 if ((double)((double)ul_TimingInterval * (250.0 * (double)b_PCIInputClock)) >= ((double)((double)ul_TimerValue + 0.5))) {
422 /*****************************/
423 /* Calculate the real timing */
424 /*****************************/
426 ul_RealTimingInterval
431 (250.0 * (double)b_PCIInputClock));
442 if ((double)((double)ul_TimerValue / (250.0 * (double)b_PCIInputClock)) >= (double)((double)ul_RealTimingInterval + 0.5)) {
443 ul_RealTimingInterval
445 ul_RealTimingInterval
461 if (b_PCIInputClock != APCI1710_40MHZ) {
493 /*******************/
494 /* Round the value */
495 /*******************/
497 if ((double)((double)ul_TimingInterval * (250000.0 * (double)b_PCIInputClock)) >= ((double)((double)ul_TimerValue + 0.5))) {
505 /*****************************/
506 /* Calculate the real timing */
507 /*****************************/
509 ul_RealTimingInterval
528 if ((double)((double)ul_TimerValue / (250000.0 * (double)b_PCIInputClock)) >= (double)((double)ul_RealTimingInterval + 0.5)) {
529 ul_RealTimingInterval
531 ul_RealTimingInterval
547 if (b_PCIInputClock != APCI1710_40MHZ) {
582 /*******************/
583 /* Round the value */
584 /*******************/
586 if ((double)((double)(ul_TimingInterval * 60.0) * (250000.0 * (double)b_PCIInputClock)) >= ((double)((double)ul_TimerValue + 0.5))) {
594 /*****************************/
595 /* Calculate the real timing */
596 /*****************************/
598 ul_RealTimingInterval
622 if ((double)(((double)ul_TimerValue / (250000.0 * (double)b_PCIInputClock)) / 60.0) >= (double)((double)ul_RealTimingInterval + 0.5)) {
623 ul_RealTimingInterval
625 ul_RealTimingInterval
641 if (b_PCIInputClock != APCI1710_40MHZ) {
656 } /* if (b_PCIInputClock != APCI1710_GATE_INPUT) */
658 /*************************************************************/
659 /* 2 Clock used for the overflow and the reload from counter */
660 /*************************************************************/
667 } /* if (b_PCIInputClock != APCI1710_GATE_INPUT) */
669 /****************************/
670 /* Save the PCI input clock */
671 /****************************/
675 s_TorCounterModuleInfo.
680 /************************/
681 /* Save the timing unit */
682 /************************/
687 s_TorCounterModuleInfo.
694 /************************/
695 /* Save the base timing */
696 /************************/
700 s_TorCounterModuleInfo.
705 d_RealTimingInterval;
710 s_TorCounterModuleInfo.
713 ul_RealTimingInterval
715 ul_RealTimingInterval;
717 /*******************/
718 /* Get the command */
719 /*******************/
730 (16 * b_TorCounter) + (64 * b_ModulNbr));
744 if (b_PCIInputClock == APCI1710_40MHZ) {
745 /****************************/
746 /* Set the 40 MHz selection */
747 /****************************/
756 /*****************************/
757 /* Test if extern clock used */
758 /*****************************/
760 if (b_PCIInputClock == APCI1710_GATE_INPUT) {
761 /****************************/
762 /* Set the 40 MHz selection */
763 /****************************/
772 /*************************/
773 /* Write the new command */
774 /*************************/
776 outl(dw_Command, devpriv->s_BoardInfos.ui_Address + 4 + (16 * b_TorCounter) + (64 * b_ModulNbr));
778 /*******************/
779 /* Disable the tor */
780 /*******************/
782 outl(0, devpriv->s_BoardInfos.ui_Address + 8 + (16 * b_TorCounter) + (64 * b_ModulNbr));
783 /*************************/
784 /* Set the timer 1 value */
785 /*************************/
787 outl(ul_TimerValue, devpriv->s_BoardInfos.ui_Address + 0 + (16 * b_TorCounter) + (64 * b_ModulNbr));
789 /*********************/
790 /* Tor counter init. */
791 /*********************/
796 s_TorCounterModuleInfo.
803 /***********************************************/
804 /* TOR version error for 40MHz clock selection */
805 /***********************************************/
807 DPRINTK("TOR version error for 40MHz clock selection\n");
813 /**************************************************************/
814 /* You can not used the 40MHz clock selection wich this board */
815 /**************************************************************/
817 DPRINTK("You can not used the 40MHz clock selection wich this board\n");
822 /**********************************/
823 /* Base timing selection is wrong */
824 /**********************************/
826 DPRINTK("Base timing selection is wrong\n");
829 } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */
831 /**********************************/
832 /* Timing unit selection is wrong */
833 /**********************************/
835 DPRINTK("Timing unit selection is wrong\n");
837 } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */
838 } /* if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) */
840 /*****************************************/
841 /* The selected PCI input clock is wrong */
842 /*****************************************/
844 DPRINTK("The selected PCI input clock is wrong\n");
846 } /* if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) */
847 } /* if (b_TorCounterMode >= 0 && b_TorCounterMode <= 7) */
849 /**********************************/
850 /* Tor Counter selection is wrong */
851 /**********************************/
853 DPRINTK("Tor Counter selection is wrong\n");
855 } /* if (b_TorCounterMode >= 0 && b_TorCounterMode <= 7) */
857 /******************************************/
858 /* The module is not a tor counter module */
859 /******************************************/
861 DPRINTK("The module is not a tor counter module\n");
865 /***********************/
866 /* Module number error */
867 /***********************/
869 DPRINTK("Module number error\n");
872 data[0] = (unsigned int) ul_RealTimingInterval;
873 return i_ReturnValue;
877 +----------------------------------------------------------------------------+
878 | Function Name : _INT_ i_APCI1710_EnableTorCounter |
879 | (unsigned char_ b_BoardHandle, |
880 | unsigned char_ b_ModulNbr, |
881 | unsigned char_ b_TorCounter, |
882 | unsigned char_ b_InputMode, |
883 | unsigned char_ b_ExternGate, |
884 | unsigned char_ b_CycleMode, |
885 | unsigned char_ b_InterruptEnable) |
886 +----------------------------------------------------------------------------+
887 | Task : Enable the tor counter (b_TorCounter) from selected |
888 | module (b_ModulNbr). You must calling the |
889 | "i_APCI1710_InitTorCounter" function be for you call |
891 | If you enable the tor counter interrupt, the |
892 | tor counter generate a interrupt after the timing cycle|
893 | See function "i_APCI1710_SetBoardIntRoutineX" and the |
894 | Interrupt mask description chapter from this manual. |
895 | The b_CycleMode parameter determine if you will |
896 | measured a single or more cycle. |
897 +----------------------------------------------------------------------------+
898 | Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 |
899 | unsigned char_ b_ModulNbr : Selected module number (0 to 3) |
900 | unsigned char_ b_TorCounter : Tor counter selection (0 or 1). |
901 | unsigned char_ b_InputMode : Input signal level selection |
902 | 0 : Tor count each low level |
903 | 1 : Tor count each high level|
904 | unsigned char_ b_ExternGate : Extern gate action selection |
905 | 0 : Extern gate signal not |
907 | 1 : Extern gate signal used. |
908 | If you selected the |
909 | single mode, each high |
910 | level signal start the |
912 | If you selected the |
913 | continuous mode, the |
914 | first high level signal |
915 | start the tor counter |
917 | APCI1710_TOR_QUADRUPLE _MODE : |
918 | In the quadruple mode, the edge|
919 | analysis circuit generates a |
920 | counting pulse from each edge |
921 | of 2 signals which are phase |
922 | shifted in relation to each |
924 | The gate input is used for the |
927 | APCI1710_TOR_DOUBLE_MODE: |
928 | Functions in the same way as |
929 | the quadruple mode, except that|
930 | only two of the four edges are |
931 | analysed per period. |
932 | The gate input is used for the |
935 | APCI1710_TOR_SIMPLE_MODE: |
936 | Functions in the same way as |
937 | the quadruple mode, except that|
938 | only one of the four edges is |
939 | analysed per period. |
940 | The gate input is used for the |
943 | unsigned char_ b_CycleMode : Selected the tor counter |
945 | unsigned char_ b_InterruptEnable : Enable or disable the |
946 | tor counter interrupt. |
948 | Enable the tor counter |
950 | APCI1710_DISABLE: |
951 | Disable the tor counter |
953 +----------------------------------------------------------------------------+
954 | Output Parameters : - |
955 +----------------------------------------------------------------------------+
956 | Return Value : 0: No error |
957 | -1: The handle parameter of the board is wrong |
958 | -2: Module selection wrong |
959 | -3: The module is not a tor counter module |
960 | -4: Tor counter selection is wrong |
961 | -5: Tor counter not initialised see function |
962 | "i_APCI1710_InitTorCounter" |
963 | -6: Tor input signal selection is wrong |
964 | -7: Extern gate signal mode is wrong |
965 | -8: Tor counter acquisition mode cycle is wrong |
966 | -9: Interrupt parameter is wrong |
967 | -10:Interrupt function not initialised. |
968 | See function "i_APCI1710_SetBoardIntRoutineX" |
969 +----------------------------------------------------------------------------+
972 +----------------------------------------------------------------------------+
973 | Function Name : _INT_ i_APCI1710_DisableTorCounter |
974 | (unsigned char_ b_BoardHandle, |
975 | unsigned char_ b_ModulNbr, |
976 | unsigned char_ b_TorCounter) |
977 +----------------------------------------------------------------------------+
978 | Task : Disable the tor counter (b_TorCounter) from selected |
979 | module (b_ModulNbr). If you disable the tor counter |
980 | after a start cycle occur and you restart the tor |
981 | counter witch the " i_APCI1710_EnableTorCounter" |
982 | function, the status register is cleared |
983 +----------------------------------------------------------------------------+
984 | Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 |
985 | unsigned char_ b_ModulNbr : Selected module number (0 to 3) |
986 | unsigned char_ b_TorCounter : Tor counter selection (0 or 1). |
987 +----------------------------------------------------------------------------+
988 | Output Parameters : - |
989 +----------------------------------------------------------------------------+
990 | Return Value : 0: No error |
991 | -1: The handle parameter of the board is wrong |
992 | -2: Module selection wrong |
993 | -3: The module is not a tor counter module |
994 | -4: Tor counter selection is wrong |
995 | -5: Tor counter not initialised see function |
996 | "i_APCI1710_InitTorCounter" |
997 | -6: Tor counter not enabled see function |
998 | "i_APCI1710_EnableTorCounter" |
999 +----------------------------------------------------------------------------+
1002 static int i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device *dev,
1003 struct comedi_subdevice *s,
1004 struct comedi_insn *insn,
1007 struct addi_private *devpriv = dev->private;
1008 int i_ReturnValue = 0;
1009 unsigned int dw_Status;
1010 unsigned int dw_DummyRead;
1011 unsigned int dw_ConfigReg;
1012 unsigned char b_ModulNbr, b_Action;
1013 unsigned char b_TorCounter;
1014 unsigned char b_InputMode;
1015 unsigned char b_ExternGate;
1016 unsigned char b_CycleMode;
1017 unsigned char b_InterruptEnable;
1019 b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
1020 b_Action = (unsigned char) data[0]; /* enable or disable */
1021 b_TorCounter = (unsigned char) data[1];
1022 b_InputMode = (unsigned char) data[2];
1023 b_ExternGate = (unsigned char) data[3];
1024 b_CycleMode = (unsigned char) data[4];
1025 b_InterruptEnable = (unsigned char) data[5];
1026 i_ReturnValue = insn->n;
1027 devpriv->tsk_Current = current; /* Save the current process task structure */
1028 /**************************/
1029 /* Test the module number */
1030 /**************************/
1032 if (b_ModulNbr < 4) {
1033 /***********************/
1034 /* Test if tor counter */
1035 /***********************/
1037 if ((devpriv->s_BoardInfos.
1038 dw_MolduleConfiguration[b_ModulNbr] &
1039 0xFFFF0000UL) == APCI1710_TOR_COUNTER) {
1040 /**********************************/
1041 /* Test the tor counter selection */
1042 /**********************************/
1044 if (b_TorCounter <= 1) {
1045 switch (b_Action) /* Enable or Disable */
1047 case APCI1710_ENABLE:
1048 /***********************************/
1049 /* Test if tor counter initialised */
1050 /***********************************/
1053 inl(devpriv->s_BoardInfos.
1055 (16 * b_TorCounter) +
1058 if (dw_Status & 0x10) {
1059 /******************************/
1060 /* Test the input signal mode */
1061 /******************************/
1063 if (b_InputMode == 0 ||
1066 APCI1710_TOR_SIMPLE_MODE
1068 APCI1710_TOR_DOUBLE_MODE
1070 APCI1710_TOR_QUADRUPLE_MODE)
1072 /************************************/
1073 /* Test the extern gate signal mode */
1074 /************************************/
1076 if (b_ExternGate == 0
1081 /*********************************/
1082 /* Test the cycle mode parameter */
1083 /*********************************/
1085 if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) {
1086 /***************************/
1087 /* Test the interrupt flag */
1088 /***************************/
1090 if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) {
1092 /***************************/
1093 /* Save the interrupt mode */
1094 /***************************/
1099 s_TorCounterModuleInfo.
1106 /*******************/
1107 /* Get the command */
1108 /*******************/
1119 (16 * b_TorCounter) + (64 * b_ModulNbr));
1129 /********************************/
1130 /* Test if not direct mode used */
1131 /********************************/
1133 if (b_InputMode > 1) {
1134 /*******************************/
1135 /* Extern gate can not be used */
1136 /*******************************/
1142 /*******************************************/
1143 /* Enable the extern gate for the Signal B */
1144 /*******************************************/
1152 /***********************/
1153 /* Test if simple mode */
1154 /***********************/
1156 if (b_InputMode == APCI1710_TOR_SIMPLE_MODE) {
1157 /**************************/
1158 /* Enable the sinple mode */
1159 /**************************/
1167 } /* if (b_InputMode == APCI1710_TOR_SIMPLE_MODE) */
1169 /***********************/
1170 /* Test if double mode */
1171 /***********************/
1173 if (b_InputMode == APCI1710_TOR_DOUBLE_MODE) {
1174 /**************************/
1175 /* Enable the double mode */
1176 /**************************/
1184 } /* if (b_InputMode == APCI1710_TOR_DOUBLE_MODE) */
1189 } /* if (b_InputMode > 1) */
1191 /*******************/
1192 /* Set the command */
1193 /*******************/
1213 /*****************************/
1214 /* Clear the status register */
1215 /*****************************/
1226 (16 * b_TorCounter) + (64 * b_ModulNbr));
1228 /***************************************/
1229 /* Clear the interrupt status register */
1230 /***************************************/
1241 (16 * b_TorCounter) + (64 * b_ModulNbr));
1243 /********************/
1244 /* Set the commando */
1245 /********************/
1247 outl(dw_ConfigReg, devpriv->s_BoardInfos.ui_Address + 4 + (16 * b_TorCounter) + (64 * b_ModulNbr));
1253 outl(1, devpriv->s_BoardInfos.ui_Address + 8 + (16 * b_TorCounter) + (64 * b_ModulNbr));
1255 } /* if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) */
1257 /********************************/
1258 /* Interrupt parameter is wrong */
1259 /********************************/
1261 DPRINTK("Interrupt parameter is wrong\n");
1265 } /* if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) */
1266 } /* if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) */
1268 /***********************************************/
1269 /* Tor counter acquisition mode cycle is wrong */
1270 /***********************************************/
1272 DPRINTK("Tor counter acquisition mode cycle is wrong\n");
1276 } /* if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) */
1277 } /* if (b_ExternGate >= 0 && b_ExternGate <= 1) */
1279 /***********************************/
1280 /* Extern gate input mode is wrong */
1281 /***********************************/
1283 DPRINTK("Extern gate input mode is wrong\n");
1286 } /* if (b_ExternGate >= 0 && b_ExternGate <= 1) */
1287 } /* if (b_InputMode >= 0 && b_InputMode <= 1) */
1289 /***************************************/
1290 /* Tor input signal selection is wrong */
1291 /***************************************/
1293 DPRINTK("Tor input signal selection is wrong\n");
1297 /*******************************/
1298 /* Tor counter not initialised */
1299 /*******************************/
1301 DPRINTK("Tor counter not initialised\n");
1306 case APCI1710_DISABLE:
1307 /***********************************/
1308 /* Test if tor counter initialised */
1309 /***********************************/
1311 dw_Status = inl(devpriv->s_BoardInfos.
1313 (16 * b_TorCounter) +
1316 /*******************************/
1317 /* Test if counter initialised */
1318 /*******************************/
1320 if (dw_Status & 0x10) {
1321 /***************************/
1322 /* Test if counter enabled */
1323 /***************************/
1325 if (dw_Status & 0x1) {
1326 /****************************/
1327 /* Clear the interrupt mode */
1328 /****************************/
1332 s_TorCounterModuleInfo.
1339 /******************/
1340 /* Clear the gate */
1341 /******************/
1346 (16 * b_TorCounter) + (64 * b_ModulNbr));
1347 } /* if (dw_Status & 0x1) */
1349 /***************************/
1350 /* Tor counter not enabled */
1351 /***************************/
1353 DPRINTK("Tor counter not enabled \n");
1355 } /* if (dw_Status & 0x1) */
1356 } /* if (dw_Status & 0x10) */
1358 /*******************************/
1359 /* Tor counter not initialised */
1360 /*******************************/
1362 DPRINTK("Tor counter not initialised\n");
1364 } /* // if (dw_Status & 0x10) */
1367 } /* if (b_TorCounter <= 1) */
1369 /**********************************/
1370 /* Tor counter selection is wrong */
1371 /**********************************/
1373 DPRINTK("Tor counter selection is wrong\n");
1375 } /* if (b_TorCounter <= 1) */
1377 /******************************************/
1378 /* The module is not a tor counter module */
1379 /******************************************/
1381 DPRINTK("The module is not a tor counter module \n");
1385 /***********************/
1386 /* Module number error */
1387 /***********************/
1389 DPRINTK("Module number error \n");
1393 return i_ReturnValue;
1397 +----------------------------------------------------------------------------+
1398 | Function Name : _INT_ i_APCI1710_GetTorCounterInitialisation |
1399 | (unsigned char_ b_BoardHandle, |
1400 | unsigned char_ b_ModulNbr, |
1401 | unsigned char_ b_TorCounter, |
1402 | unsigned char *_ pb_TimingUnit, |
1403 | PULONG_ pul_TimingInterval, |
1404 | unsigned char *_ pb_InputMode, |
1405 | unsigned char *_ pb_ExternGate, |
1406 | unsigned char *_ pb_CycleMode, |
1407 | unsigned char *_ pb_Enable, |
1408 | unsigned char *_ pb_InterruptEnable)|
1409 +----------------------------------------------------------------------------+
1410 | Task : Enable the tor counter (b_TorCounter) from selected |
1411 | module (b_ModulNbr). You must calling the |
1412 | "i_APCI1710_InitTorCounter" function be for you call |
1414 | If you enable the tor counter interrupt, the |
1415 | tor counter generate a interrupt after the timing cycle|
1416 | See function "i_APCI1710_SetBoardIntRoutineX" and the |
1417 | Interrupt mask description chapter from this manual. |
1418 | The b_CycleMode parameter determine if you will |
1419 | measured a single or more cycle. |
1420 +----------------------------------------------------------------------------+
1421 | Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 |
1422 | unsigned char_ b_ModulNbr : Selected module number (0 to 3) |
1423 | unsigned char_ b_TorCounter : Tor counter selection (0 or 1)
1425 b_ModulNbr = CR_AREF(insn->chanspec);
1426 b_TorCounter = CR_CHAN(insn->chanspec);
1428 +----------------------------------------------------------------------------+
1429 | Output Parameters : unsigned char *_ pb_TimingUnit : Base timing unit (0 to 4) |
1435 | PULONG_ pul_TimingInterval : Base timing value. |
1436 | unsigned char *_ pb_InputMode : Input signal level |
1438 | 0 : Tor count each low level |
1439 | 1 : Tor count each high level|
1440 | unsigned char *_ pb_ExternGate : Extern gate action |
1442 | 0 : Extern gate signal not |
1444 | 1 : Extern gate signal used|
1445 | unsigned char *_ pb_CycleMode : Tor counter acquisition |
1447 | unsigned char *_ pb_Enable : Indicate if the tor counter|
1448 | is enabled or no |
1449 | 0 : Tor counter disabled |
1450 | 1 : Tor counter enabled |
1451 | unsigned char *_ pb_InterruptEnable : Enable or disable the |
1452 | tor counter interrupt. |
1453 | APCI1710_ENABLE: |
1454 | Enable the tor counter |
1456 | APCI1710_DISABLE: |
1457 | Disable the tor counter |
1459 pb_TimingUnit = (unsigned char *) &data[0];
1460 pul_TimingInterval = (unsigned int *) &data[1];
1461 pb_InputMode = (unsigned char *) &data[2];
1462 pb_ExternGate = (unsigned char *) &data[3];
1463 pb_CycleMode = (unsigned char *) &data[4];
1464 pb_Enable = (unsigned char *) &data[5];
1465 pb_InterruptEnable = (unsigned char *) &data[6];
1467 +----------------------------------------------------------------------------+
1468 | Return Value : 0: No error |
1469 | -1: The handle parameter of the board is wrong |
1470 | -2: Module selection wrong |
1471 | -3: The module is not a tor counter module |
1472 | -4: Tor counter selection is wrong |
1473 | -5: Tor counter not initialised see function |
1474 | "i_APCI1710_InitTorCounter" |
1475 +----------------------------------------------------------------------------+
1478 static int i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device *dev,
1479 struct comedi_subdevice *s,
1480 struct comedi_insn *insn,
1483 struct addi_private *devpriv = dev->private;
1484 int i_ReturnValue = 0;
1485 unsigned int dw_Status;
1486 unsigned char b_ModulNbr;
1487 unsigned char b_TorCounter;
1488 unsigned char *pb_TimingUnit;
1489 unsigned int *pul_TimingInterval;
1490 unsigned char *pb_InputMode;
1491 unsigned char *pb_ExternGate;
1492 unsigned char *pb_CycleMode;
1493 unsigned char *pb_Enable;
1494 unsigned char *pb_InterruptEnable;
1496 i_ReturnValue = insn->n;
1497 b_ModulNbr = CR_AREF(insn->chanspec);
1498 b_TorCounter = CR_CHAN(insn->chanspec);
1500 pb_TimingUnit = (unsigned char *) &data[0];
1501 pul_TimingInterval = (unsigned int *) &data[1];
1502 pb_InputMode = (unsigned char *) &data[2];
1503 pb_ExternGate = (unsigned char *) &data[3];
1504 pb_CycleMode = (unsigned char *) &data[4];
1505 pb_Enable = (unsigned char *) &data[5];
1506 pb_InterruptEnable = (unsigned char *) &data[6];
1508 /**************************/
1509 /* Test the module number */
1510 /**************************/
1512 if (b_ModulNbr < 4) {
1513 /***********************/
1514 /* Test if tor counter */
1515 /***********************/
1517 if ((devpriv->s_BoardInfos.
1518 dw_MolduleConfiguration[b_ModulNbr] &
1519 0xFFFF0000UL) == APCI1710_TOR_COUNTER) {
1520 /**********************************/
1521 /* Test the tor counter selection */
1522 /**********************************/
1524 if (b_TorCounter <= 1) {
1526 /***********************************/
1527 /* Test if tor counter initialised */
1528 /***********************************/
1530 dw_Status = inl(devpriv->s_BoardInfos.
1531 ui_Address + 8 + (16 * b_TorCounter) +
1534 if (dw_Status & 0x10) {
1535 *pb_Enable = dw_Status & 1;
1537 /********************/
1538 /* Get the commando */
1539 /********************/
1541 dw_Status = inl(devpriv->s_BoardInfos.
1543 (16 * b_TorCounter) +
1547 (unsigned char) ((dw_Status >> 4) & 1);
1548 *pb_InterruptEnable =
1549 (unsigned char) ((dw_Status >> 5) & 1);
1551 /******************************************************/
1552 /* Test if extern gate used for clock or for signal B */
1553 /******************************************************/
1555 if (dw_Status & 0x600) {
1556 /*****************************************/
1557 /* Test if extern gate used for signal B */
1558 /*****************************************/
1560 if (dw_Status & 0x400) {
1561 /***********************/
1562 /* Test if simple mode */
1563 /***********************/
1565 if ((dw_Status & 0x7800)
1568 APCI1710_TOR_SIMPLE_MODE;
1571 /***********************/
1572 /* Test if double mode */
1573 /***********************/
1575 if ((dw_Status & 0x7800)
1578 APCI1710_TOR_DOUBLE_MODE;
1581 /**************************/
1582 /* Test if quadruple mode */
1583 /**************************/
1585 if ((dw_Status & 0x7800)
1588 APCI1710_TOR_QUADRUPLE_MODE;
1590 } /* if (dw_Status & 0x400) */
1593 } /* // if (dw_Status & 0x400) */
1595 /************************/
1596 /* Extern gate not used */
1597 /************************/
1600 } /* if (dw_Status & 0x600) */
1603 (unsigned char) ((dw_Status >> 6)
1606 (unsigned char) ((dw_Status >> 7)
1608 } /* if (dw_Status & 0x600) */
1612 s_ModuleInfo[b_ModulNbr].
1613 s_TorCounterModuleInfo.
1614 s_TorCounterInfo[b_TorCounter].
1617 *pul_TimingInterval =
1619 s_ModuleInfo[b_ModulNbr].
1620 s_TorCounterModuleInfo.
1621 s_TorCounterInfo[b_TorCounter].
1622 ul_RealTimingInterval;
1624 /*******************************/
1625 /* Tor counter not initialised */
1626 /*******************************/
1628 DPRINTK("Tor counter not initialised\n");
1632 } /* if (b_TorCounter <= 1) */
1634 /**********************************/
1635 /* Tor counter selection is wrong */
1636 /**********************************/
1638 DPRINTK("Tor counter selection is wrong \n");
1640 } /* if (b_TorCounter <= 1) */
1642 /******************************************/
1643 /* The module is not a tor counter module */
1644 /******************************************/
1646 DPRINTK("The module is not a tor counter module\n");
1650 /***********************/
1651 /* Module number error */
1652 /***********************/
1654 DPRINTK("Module number error\n");
1658 return i_ReturnValue;
1662 +----------------------------------------------------------------------------+
1663 | Function Name : _INT_ i_APCI1710_ReadTorCounterValue |
1664 | (unsigned char_ b_BoardHandle, |
1665 | unsigned char_ b_ModulNbr, |
1666 | unsigned char_ b_TorCounter, |
1667 | unsigned int_ ui_TimeOut, |
1668 | unsigned char *_ pb_TorCounterStatus, |
1669 | PULONG_ pul_TorCounterValue) |
1670 +----------------------------------------------------------------------------+
1671 | Task case APCI1710_TOR_GETPROGRESSSTATUS: Return the tor counter
1672 (b_TorCounter) status (pb_TorCounterStatus) from selected tor counter |
1673 | module (b_ModulNbr).
1675 case APCI1710_TOR_GETCOUNTERVALUE :
1676 Return the tor counter (b_TorCounter) status |
1677 | (pb_TorCounterStatus) and the timing value |
1678 | (pul_TorCounterValue) after a conting cycle stop |
1679 | from selected tor counter module (b_ModulNbr). |
1680 +----------------------------------------------------------------------------+
1681 | Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 |
1682 | unsigned char_ b_ModulNbr : Selected module number (0 to 3) |
1683 | unsigned char_ b_TorCounter : Tor counter selection (0 or 1).
1684 b_ModulNbr = CR_AREF(insn->chanspec);
1685 b_ReadType = (unsigned char) data[0];
1686 b_TorCounter = (unsigned char) data[1];
1687 ui_TimeOut = (unsigned int) data[2]; |
1688 +----------------------------------------------------------------------------+
1689 | Output Parameters : unsigned char *_ pb_TorCounterStatus : Return the tor counter |
1691 | 0 : Conting cycle not started|
1692 | Software gate not set. |
1693 | 1 : Conting cycle started. |
1694 | Software gate set. |
1695 | 2 : Conting cycle stopped. |
1696 | The conting cycle is |
1698 | 3 : A overflow occur. You |
1699 | must change the base |
1700 | timing witch the |
1702 | "i_APCI1710_InitTorCounter"|
1703 | 4 : Timeeout occur |
1704 | unsigned int * pul_TorCounterValue : Tor counter value.
1705 pb_TorCounterStatus=(unsigned char *) &data[0];
1706 pul_TorCounterValue=(unsigned int *) &data[1]; |
1707 +----------------------------------------------------------------------------+
1708 | Return Value : 0: No error |
1709 | -1: The handle parameter of the board is wrong |
1710 | -2: Module selection wrong |
1711 | -3: The module is not a tor counter module |
1712 | -4: Tor counter selection is wrong |
1713 | -5: Tor counter not initialised see function |
1714 | "i_APCI1710_InitTorCounter" |
1715 | -6: Tor counter not enabled see function |
1716 | "i_APCI1710_EnableTorCounter" |
1717 | -7: Timeout parameter is wrong (0 to 65535) |
1718 +----------------------------------------------------------------------------+
1721 static int i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device *dev,
1722 struct comedi_subdevice *s,
1723 struct comedi_insn *insn,
1726 struct addi_private *devpriv = dev->private;
1727 int i_ReturnValue = 0;
1728 unsigned int dw_Status;
1729 unsigned int dw_TimeOut = 0;
1730 unsigned char b_ModulNbr;
1731 unsigned char b_TorCounter;
1732 unsigned char b_ReadType;
1733 unsigned int ui_TimeOut;
1734 unsigned char *pb_TorCounterStatus;
1735 unsigned int *pul_TorCounterValue;
1737 i_ReturnValue = insn->n;
1738 b_ModulNbr = CR_AREF(insn->chanspec);
1739 b_ReadType = (unsigned char) data[0];
1740 b_TorCounter = (unsigned char) data[1];
1741 ui_TimeOut = (unsigned int) data[2];
1742 pb_TorCounterStatus = (unsigned char *) &data[0];
1743 pul_TorCounterValue = (unsigned int *) &data[1];
1745 /**************************/
1746 /* Test the module number */
1747 /**************************/
1749 if (b_ReadType == APCI1710_TOR_READINTERRUPT) {
1751 data[0] = devpriv->s_InterruptParameters.
1752 s_FIFOInterruptParameters[devpriv->
1753 s_InterruptParameters.ui_Read].b_OldModuleMask;
1754 data[1] = devpriv->s_InterruptParameters.
1755 s_FIFOInterruptParameters[devpriv->
1756 s_InterruptParameters.ui_Read].ul_OldInterruptMask;
1757 data[2] = devpriv->s_InterruptParameters.
1758 s_FIFOInterruptParameters[devpriv->
1759 s_InterruptParameters.ui_Read].ul_OldCounterLatchValue;
1761 /**************************/
1762 /* Increment the read FIFO */
1763 /***************************/
1766 s_InterruptParameters.
1767 ui_Read = (devpriv->
1768 s_InterruptParameters.
1769 ui_Read + 1) % APCI1710_SAVE_INTERRUPT;
1774 if (b_ModulNbr < 4) {
1775 /***********************/
1776 /* Test if tor counter */
1777 /***********************/
1779 if ((devpriv->s_BoardInfos.
1780 dw_MolduleConfiguration[b_ModulNbr] &
1781 0xFFFF0000UL) == APCI1710_TOR_COUNTER) {
1782 /**********************************/
1783 /* Test the tor counter selection */
1784 /**********************************/
1786 if (b_TorCounter <= 1) {
1787 /***********************************/
1788 /* Test if tor counter initialised */
1789 /***********************************/
1791 dw_Status = inl(devpriv->s_BoardInfos.
1792 ui_Address + 8 + (16 * b_TorCounter) +
1795 /*******************************/
1796 /* Test if counter initialised */
1797 /*******************************/
1799 if (dw_Status & 0x10) {
1800 /***************************/
1801 /* Test if counter enabled */
1802 /***************************/
1804 if (dw_Status & 0x1) {
1806 switch (b_ReadType) {
1808 case APCI1710_TOR_GETPROGRESSSTATUS:
1809 /*******************/
1810 /* Read the status */
1811 /*******************/
1817 (16 * b_TorCounter) + (64 * b_ModulNbr));
1826 if (dw_Status & 1) {
1829 if (dw_Status & 4) {
1830 /************************/
1831 /* Tor counter overflow */
1832 /************************/
1834 *pb_TorCounterStatus
1838 /***********************/
1839 /* Tor counter started */
1840 /***********************/
1842 *pb_TorCounterStatus
1847 /***********************/
1848 /* Tor counter started */
1849 /***********************/
1851 *pb_TorCounterStatus
1856 /***************************/
1857 /* Tor counter not started */
1858 /***************************/
1860 *pb_TorCounterStatus
1865 case APCI1710_TOR_GETCOUNTERVALUE:
1867 /*****************************/
1868 /* Test the timout parameter */
1869 /*****************************/
1871 if ((ui_TimeOut >= 0)
1877 /*******************/
1878 /* Read the status */
1879 /*******************/
1890 (16 * b_TorCounter) + (64 * b_ModulNbr));
1891 /********************/
1892 /* Test if overflow */
1893 /********************/
1895 if ((dw_Status & 4) == 4) {
1896 /******************/
1897 /* Overflow occur */
1898 /******************/
1900 *pb_TorCounterStatus
1904 /******************/
1905 /* Read the value */
1906 /******************/
1908 *pul_TorCounterValue
1917 (16 * b_TorCounter) + (64 * b_ModulNbr));
1919 } /* if ((dw_Status & 4) == 4) */
1921 /*******************************/
1922 /* Test if measurement stopped */
1923 /*******************************/
1925 if ((dw_Status & 2) == 2) {
1926 /***********************/
1927 /* A stop signal occur */
1928 /***********************/
1930 *pb_TorCounterStatus
1934 /******************/
1935 /* Read the value */
1936 /******************/
1938 *pul_TorCounterValue
1947 (16 * b_TorCounter) + (64 * b_ModulNbr));
1950 } /* if ((dw_Status & 2) == 2) */
1952 /*******************************/
1953 /* Test if measurement started */
1954 /*******************************/
1956 if ((dw_Status & 1) == 1) {
1957 /************************/
1958 /* A start signal occur */
1959 /************************/
1961 *pb_TorCounterStatus
1964 } /* if ((dw_Status & 1) == 1) */
1966 /***************************/
1967 /* Measurement not started */
1968 /***************************/
1970 *pb_TorCounterStatus
1973 } /* if ((dw_Status & 1) == 1) */
1974 } /* if ((dw_Status & 2) == 2) */
1975 } /* if ((dw_Status & 8) == 8) */
1977 if (dw_TimeOut == ui_TimeOut) {
1984 /*************************/
1985 /* Increment the timeout */
1986 /*************************/
1998 /*************************/
1999 /* Test if timeout occur */
2000 /*************************/
2002 if ((*pb_TorCounterStatus != 3) && (dw_TimeOut == ui_TimeOut) && (ui_TimeOut != 0)) {
2007 *pb_TorCounterStatus
2012 /******************************/
2013 /* Timeout parameter is wrong */
2014 /******************************/
2016 DPRINTK("Timeout parameter is wrong\n");
2023 printk("Inputs wrong\n");
2025 } /* if (dw_Status & 0x1) */
2027 /***************************/
2028 /* Tor counter not enabled */
2029 /***************************/
2031 DPRINTK("Tor counter not enabled\n");
2033 } /* if (dw_Status & 0x1) */
2035 /*******************************/
2036 /* Tor counter not initialised */
2037 /*******************************/
2039 DPRINTK("Tor counter not initialised\n");
2042 } /* if (b_TorCounter <= 1) */
2044 /**********************************/
2045 /* Tor counter selection is wrong */
2046 /**********************************/
2048 DPRINTK("Tor counter selection is wrong\n");
2050 } /* if (b_TorCounter <= 1) */
2052 /******************************************/
2053 /* The module is not a tor counter module */
2054 /******************************************/
2056 DPRINTK("The module is not a tor counter module\n");
2060 /***********************/
2061 /* Module number error */
2062 /***********************/
2064 DPRINTK("Module number error\n");
2068 return i_ReturnValue;