48 static unsigned int ui_Temp;
86 devpriv->ui_EocEosConversionTime = data[2];
91 for (i = 0; i < data[3]; i++) {
94 devpriv->s_EeParameters.i_NbrAiChannel) {
95 printk(
"bad channel list\n");
108 devpriv->ui_AiNbrofChannels = data[3];
109 for (i = 0; i <
devpriv->ui_AiNbrofChannels; i++)
110 devpriv->ui_AiChannelList[i] = data[4 + i];
149 unsigned short us_ConvertTiming, us_TmpValue,
i;
153 if (!
devpriv->ui_EocEosConversionTime) {
154 printk(
"No timer0 Value using 10 us\n");
155 us_ConvertTiming = 10;
157 us_ConvertTiming = (
unsigned short) (
devpriv->ui_EocEosConversionTime / 1000);
162 devpriv->b_TimerSelectMode = 0;
163 devpriv->b_ModeSelectRegister = 0;
164 devpriv->us_OutputRegister = 0;
167 if (insn->
unused[0] == 222) {
168 for (i = 0; i < insn->
n; i++)
169 data[i] =
devpriv->ui_AiReadData[i];
181 if ((us_TmpValue & 0x00B0) == 0x00B0
183 us_ConvertTiming = (us_ConvertTiming * 2) - 2;
186 ((us_ConvertTiming * 12926) / 10000) - 1;
189 us_TmpValue = (
unsigned short)
devpriv->b_InterruptMode;
191 switch (us_TmpValue) {
211 b_TimerSelectMode & 0xFC) |
217 devpriv->b_ModeSelectRegister =
224 devpriv->b_ModeSelectRegister =
226 b_ModeSelectRegister &
232 devpriv->b_ModeSelectRegister =
234 b_ModeSelectRegister &
251 b_DigitalOutputRegister) & 0xF0) |
256 outw(us_ConvertTiming,
304 b_TimerSelectMode & 0xFC) |
311 b_DigitalOutputRegister) & 0xF0) |
316 outw(us_ConvertTiming,
320 devpriv->b_ModeSelectRegister =
329 devpriv->b_ModeSelectRegister =
331 b_ModeSelectRegister &
337 devpriv->b_ModeSelectRegister =
339 b_ModeSelectRegister &
368 for (i = 0; i <
devpriv->ui_AiNbrofChannels;
372 data[
i] = (
unsigned int) us_TmpValue;
383 devpriv->ui_EocEosConversionTime = 0;
431 devpriv->us_OutputRegister = 0;
446 devpriv->ui_AiActualScanPosition = 0;
447 s->
async->cur_chan = 0;
450 devpriv->ui_DmaActualBuffer = 0;
497 err |= cfc_check_trigger_is_unique(cmd->
start_src);
499 err |= cfc_check_trigger_is_unique(cmd->
stop_src);
515 devpriv->s_EeParameters.ui_MinDelaytimeNs) {
517 devpriv->s_EeParameters.ui_MinDelaytimeNs;
527 ui_MinAcquisitiontimeNs)) {
529 ui_MinAcquisitiontimeNs;
534 devpriv->s_EeParameters.ui_MinAcquisitiontimeNs
537 ui_MinAcquisitiontimeNs;
627 if ((
devpriv->ui_AiNbrofScans == 0) || (
devpriv->ui_AiNbrofScans == -1))
682 unsigned int ui_Tmp, ui_DelayTiming = 0, ui_TimerValue1 = 0, dmalen0 =
683 0, dmalen1 = 0, ui_TimerValue2 =
684 0, ui_TimerValue0, ui_ConvertTiming;
685 unsigned short us_TmpValue;
708 devpriv->b_TimerSelectMode = 0;
709 devpriv->us_OutputRegister = 0;
710 devpriv->b_ModeSelectRegister = 0;
748 devpriv->ui_AiActualScanPosition = 0;
749 s->
async->cur_chan = 0;
751 devpriv->ui_DmaActualBuffer = 0;
754 ui_TimerValue2 =
devpriv->ui_AiNbrofScans - 2;
755 ui_ConvertTiming =
devpriv->ui_AiTimer0;
758 ui_DelayTiming =
devpriv->ui_AiTimer1;
764 devpriv->pui_AiChannelList, 0))
792 if ((us_TmpValue & 0x00B0) == 0x00B0
794 ui_TimerValue0 = ui_ConvertTiming * 2 - 2000;
795 ui_TimerValue0 = ui_TimerValue0 / 1000;
798 ui_DelayTiming = ui_DelayTiming / 1000;
799 ui_TimerValue1 = ui_DelayTiming * 2 - 200;
800 ui_TimerValue1 = ui_TimerValue1 / 100;
803 ui_ConvertTiming = ui_ConvertTiming / 1000;
804 ui_TimerValue0 = ui_ConvertTiming * 12926 - 10000;
805 ui_TimerValue0 = ui_TimerValue0 / 10000;
808 ui_DelayTiming = ui_DelayTiming / 1000;
809 ui_TimerValue1 = ui_DelayTiming * 12926 - 1;
810 ui_TimerValue1 = ui_TimerValue1 / 1000000;
828 b_DigitalOutputRegister) & 0xF0) |
832 outw(((
unsigned short) ui_TimerValue0),
846 b_DigitalOutputRegister) & 0xF0) |
850 outw(((
unsigned short) ui_TimerValue1),
862 b_DigitalOutputRegister) & 0xF0) |
867 outw(((
unsigned short) ui_TimerValue0),
894 devpriv->b_ModeSelectRegister =
901 if (!
devpriv->b_AiContinuous) {
913 devpriv->b_ModeSelectRegister =
915 b_ModeSelectRegister &
923 b_TimerSelectMode & 0x0F) |
930 b_DigitalOutputRegister) & 0xF0) |
938 b_DigitalOutputRegister) & 0xF0) |
947 devpriv->b_ModeSelectRegister =
949 b_ModeSelectRegister |
953 devpriv->b_ModeSelectRegister =
955 b_ModeSelectRegister |
958 devpriv->b_ModeSelectRegister =
960 b_ModeSelectRegister |
984 dmalen0 =
devpriv->ui_DmaBufferSize[0];
985 dmalen1 =
devpriv->ui_DmaBufferSize[1];
987 if (!
devpriv->b_AiContinuous) {
989 if (dmalen0 > (
devpriv->ui_AiNbrofScans *
devpriv->ui_AiScanLength * 2)) {
993 }
else if (dmalen1 > (
devpriv->ui_AiNbrofScans *
devpriv->ui_AiScanLength * 2 - dmalen0))
996 devpriv->ui_AiScanLength * 2 - dmalen0;
1001 if (dmalen0 > (
devpriv->ui_AiScanLength * 2)) {
1002 dmalen0 =
devpriv->ui_AiScanLength * 2;
1003 if (
devpriv->ui_AiScanLength & 1)
1006 if (dmalen1 > (
devpriv->ui_AiScanLength * 2)) {
1007 dmalen1 =
devpriv->ui_AiScanLength * 2;
1008 if (
devpriv->ui_AiScanLength & 1)
1014 if (dmalen0 > (
devpriv->ui_AiDataLength))
1015 dmalen0 =
devpriv->ui_AiDataLength;
1016 if (dmalen1 > (
devpriv->ui_AiDataLength))
1017 dmalen1 =
devpriv->ui_AiDataLength;
1019 devpriv->ui_DmaBufferUsesize[0] = dmalen0;
1020 devpriv->ui_DmaBufferUsesize[1] = dmalen1;
1156 && !
devpriv->b_AiContinuous) {
1215 unsigned short us_TmpValue;
1220 devpriv->ui_EocEosConversionTime = 0;
1221 devpriv->b_OutputMemoryStatus = 0;
1225 devpriv->b_Timer2Interrupt = 0;
1229 devpriv->b_ModeSelectRegister = 0;
1234 devpriv->us_OutputRegister = 0;
1261 for (i = 0; i < 16; i++) {
1262 us_TmpValue = i << 8;
1297 unsigned short us_TmpValue;
1312 devpriv->us_OutputRegister = ((n_chan - 1) & 0xf) << 8;
1315 for (i = 0; i < n_chan; i++) {
1317 us_TmpValue =
CR_CHAN(chanlist[i]);
1325 us_TmpValue |= ((gain & 0x03) << 4);
1326 us_TmpValue |= i << 8;
1330 (((
unsigned char)
CR_RANGE(chanlist[i]) & 0x03) << 2));
1417 unsigned short int_daq;
1419 unsigned int int_amcc, ui_Check,
i;
1420 unsigned short us_TmpValue;
1421 unsigned char b_DummyRead;
1436 int_daq = (int_daq >> 12) & 0xF;
1452 if (((int_daq & 0x8) == 0)
1464 devpriv->b_ModeSelectRegister =
1482 devpriv->b_ModeSelectRegister =
1484 b_ModeSelectRegister |
1491 for (i = 0; i <
devpriv->ui_AiNbrofChannels;
1495 (
unsigned int) us_TmpValue;
1505 devpriv->b_ModeSelectRegister =
1516 if (int_daq & 0x1) {
1518 switch (
devpriv->b_Timer2Mode) {
1522 devpriv->b_ModeSelectRegister =
1561 devpriv->b_ModeSelectRegister =
1563 b_ModeSelectRegister &
1631 n_chan =
devpriv->ui_AiNbrofChannels;
1633 s->
async->events = 0;
1635 for (i = 0; i <
n_chan; i++)
1671 unsigned int next_dma_buf, samplesinbuf;
1672 unsigned long low_word, high_word, var;
1674 unsigned int ui_Tmp;
1683 if (samplesinbuf & 1) {
1690 samplesinbuf = samplesinbuf >> 1;
1691 if (
devpriv->b_DmaDoubleBuffer) {
1693 next_dma_buf = 1 -
devpriv->ui_DmaActualBuffer;
1705 var =
devpriv->ul_DmaBufferHw[next_dma_buf];
1706 low_word = var & 0xffff;
1707 var =
devpriv->ul_DmaBufferHw[next_dma_buf];
1708 high_word = var / 65536;
1718 var =
devpriv->ui_DmaBufferUsesize[next_dma_buf];
1719 low_word = var & 0xffff;
1720 var =
devpriv->ui_DmaBufferUsesize[next_dma_buf];
1721 high_word = var / 65536;
1746 ui_DmaActualBuffer], samplesinbuf);
1763 if (
devpriv->b_DmaDoubleBuffer) {
1786 var =
devpriv->ul_DmaBufferHw[0];
1787 low_word = var & 0xffff;
1788 var =
devpriv->ul_DmaBufferHw[0];
1789 high_word = var / 65536;
1795 var =
devpriv->ui_DmaBufferUsesize[0];
1796 low_word = var & 0xffff;
1797 var =
devpriv->ui_DmaBufferUsesize[0];
1798 high_word = var / 65536;
1841 (s->
async->cur_chan + num_samples) /
devpriv->ui_AiScanLength;
1842 s->
async->cur_chan += num_samples;
1883 unsigned int ui_Timervalue2;
1884 unsigned short us_TmpValue;
1885 unsigned char b_Tmp;
1890 devpriv->b_Timer2Interrupt = (
unsigned char) data[2];
1892 ui_Timervalue2 = data[1] / 1000;
1901 if ((us_TmpValue & 0x00B0) == 0x00B0
1904 ui_Timervalue2 = ui_Timervalue2 / 50;
1907 ui_Timervalue2 = ui_Timervalue2 / 70;
1916 devpriv->b_ModeSelectRegister =
1921 devpriv->b_ModeSelectRegister =
1950 b_DigitalOutputRegister) & 0xF0) |
1958 b_DigitalOutputRegister) & 0xF0) |
1986 b_DigitalOutputRegister) & 0xF0) |
1994 b_DigitalOutputRegister) & 0xF0) |
2041 unsigned int ui_Timervalue2 = 0;
2042 unsigned short us_TmpValue;
2043 unsigned char b_Tmp;
2054 "write :timer2 not configured in TIMER MODE");
2059 ui_Timervalue2 = data[1];
2073 devpriv->b_ModeSelectRegister =
2074 devpriv->b_ModeSelectRegister & 0x0B;
2077 devpriv->b_ModeSelectRegister =
2079 b_ModeSelectRegister & 0x0B) |
2086 devpriv->b_ModeSelectRegister =
2088 b_ModeSelectRegister |
2094 devpriv->b_ModeSelectRegister =
2096 b_ModeSelectRegister &
2116 devpriv->b_ModeSelectRegister =
2118 b_ModeSelectRegister &
2122 devpriv->b_ModeSelectRegister =
2124 b_ModeSelectRegister &
2128 devpriv->b_ModeSelectRegister =
2153 "write :timer2 not configured in TIMER MODE");
2164 if ((us_TmpValue & 0x00B0) == 0x00B0
2167 ui_Timervalue2 = ui_Timervalue2 / 50;
2170 ui_Timervalue2 = ui_Timervalue2 / 70;
2174 b_DigitalOutputRegister) & 0xF0) |
2183 b_DigitalOutputRegister) & 0xF0) |
2224 unsigned char b_Tmp;
2225 unsigned short us_TmpValue, us_TmpValue_2, us_StatusValue;
2237 b_DigitalOutputRegister) & 0xF0) |
2245 b_DigitalOutputRegister) & 0xF0) |
2252 data[0] = (
unsigned int) ((us_TmpValue) | ((us_TmpValue_2) << 16));
2259 if (us_StatusValue == 1) {
2263 data[0] = us_StatusValue;
2299 unsigned int ui_Chan, ui_TmpValue;
2311 *data = (ui_TmpValue >> (ui_Chan + 8)) & 1;
2343 unsigned int ui_TmpValue;
2350 *data = (ui_TmpValue >> 8) & 0xf;
2383 if ((data[0] != 0) && (data[0] != 1)) {
2385 "Not a valid Data !!! ,Data should be 1 or 0\n");
2393 devpriv->b_DigitalOutputRegister = 0;
2395 if (!
devpriv->b_OutputMemoryStatus)
2429 if ((data[0] >
devpriv->s_EeParameters.i_DoMaxdata) || (data[0] < 0)) {
2437 data[0] = (data[0] << 4) |
devpriv->b_DigitalOutputRegister;
2444 printk(
"\nThe parameter passed is in error \n");
2449 devpriv->b_DigitalOutputRegister = data[0] & 0xF0;
2483 unsigned int ui_Temp1;
2487 if ((data[0] != 0) && (data[0] != 1)) {
2489 "Not a valid Data !!! ,Data should be 1 or 0\n");
2492 if (ui_NoOfChannel >
devpriv->s_EeParameters.i_NbrDoChannel - 1) {
2494 "This board doesn't have specified channel !!! \n");
2500 data[0] = (data[0] << ui_NoOfChannel);
2502 data[0] = (data[0] << 4) |
devpriv->b_DigitalOutputRegister;
2506 data[0] = ~data[0] & 0x1;
2508 ui_Temp1 = ui_Temp1 << ui_NoOfChannel;
2509 ui_Temp1 = ui_Temp1 << 4;
2511 devpriv->b_DigitalOutputRegister =
2512 devpriv->b_DigitalOutputRegister | ui_Temp1;
2514 data[0] = (data[0] << ui_NoOfChannel) ^ 0xf;
2515 data[0] = data[0] << 4;
2517 data[0] = data[0] &
devpriv->b_DigitalOutputRegister;
2520 printk(
"\nThe parameter passed is in error \n");
2526 devpriv->b_DigitalOutputRegister = data[0] & 0xf0;
2561 unsigned int ui_Range, ui_Channel;
2562 unsigned short us_TmpValue;
2572 ((((ui_Channel & 0x03) << 14) & 0xC000) | (1 <<
2573 13) | (data[0] + 8191));
2576 ((((ui_Channel & 0x03) << 14) & 0xC000) | (1 <<
2581 ((((ui_Channel & 0x03) << 14) & 0xC000) | (0 << 13) |
2594 }
while (us_TmpValue != 0x0001);
2596 if (ui_Channel <= 3)
2601 outw((
unsigned short) data[0],
2608 outw((
unsigned short) data[0],