Commit 0110c443 authored by Bill Pemberton's avatar Bill Pemberton Committed by Greg Kroah-Hartman

Staging: comedi: remove C99 comments in APCI1710_Pwm.c

Signed-off-by: default avatarBill Pemberton <wfp5p@virginia.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c47375f3
...@@ -79,29 +79,29 @@ int i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice ...@@ -79,29 +79,29 @@ int i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice
switch (b_ConfigType) { switch (b_ConfigType) {
case APCI1710_PWM_INIT: case APCI1710_PWM_INIT:
i_ReturnValue = i_APCI1710_InitPWM(dev, (unsigned char) CR_AREF(insn->chanspec), // b_ModulNbr i_ReturnValue = i_APCI1710_InitPWM(dev, (unsigned char) CR_AREF(insn->chanspec), /* b_ModulNbr */
(unsigned char) data[0], //b_PWM (unsigned char) data[0], /* b_PWM */
(unsigned char) data[1], // b_ClockSelection (unsigned char) data[1], /* b_ClockSelection */
(unsigned char) data[2], // b_TimingUnit (unsigned char) data[2], /* b_TimingUnit */
(unsigned int) data[3], //ul_LowTiming (unsigned int) data[3], /* ul_LowTiming */
(unsigned int) data[4], //ul_HighTiming (unsigned int) data[4], /* ul_HighTiming */
(unsigned int *) & data[0], //pul_RealLowTiming (unsigned int *) & data[0], /* pul_RealLowTiming */
(unsigned int *) & data[1] //pul_RealHighTiming (unsigned int *) & data[1] /* pul_RealHighTiming */
); );
break; break;
case APCI1710_PWM_GETINITDATA: case APCI1710_PWM_GETINITDATA:
i_ReturnValue = i_APCI1710_GetPWMInitialisation(dev, (unsigned char) CR_AREF(insn->chanspec), // b_ModulNbr i_ReturnValue = i_APCI1710_GetPWMInitialisation(dev, (unsigned char) CR_AREF(insn->chanspec), /* b_ModulNbr */
(unsigned char) data[0], //b_PWM (unsigned char) data[0], /* b_PWM */
(unsigned char *) & data[0], //pb_TimingUnit (unsigned char *) & data[0], /* pb_TimingUnit */
(unsigned int *) & data[1], //pul_LowTiming (unsigned int *) & data[1], /* pul_LowTiming */
(unsigned int *) & data[2], //pul_HighTiming (unsigned int *) & data[2], /* pul_HighTiming */
(unsigned char *) & data[3], // pb_StartLevel (unsigned char *) & data[3], /* pb_StartLevel */
(unsigned char *) & data[4], // pb_StopMode (unsigned char *) & data[4], /* pb_StopMode */
(unsigned char *) & data[5], // pb_StopLevel (unsigned char *) & data[5], /* pb_StopLevel */
(unsigned char *) & data[6], // pb_ExternGate (unsigned char *) & data[6], /* pb_ExternGate */
(unsigned char *) & data[7], // pb_InterruptEnable (unsigned char *) & data[7], /* pb_InterruptEnable */
(unsigned char *) & data[8] // pb_Enable (unsigned char *) & data[8] /* pb_Enable */
); );
break; break;
...@@ -200,33 +200,33 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -200,33 +200,33 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
/**************************/ /**************************/
if (b_ModulNbr < 4) { if (b_ModulNbr < 4) {
/***************/ /***************/
/* Test if PWM */ /* Test if PWM */
/***************/ /***************/
if ((devpriv->s_BoardInfos. if ((devpriv->s_BoardInfos.
dw_MolduleConfiguration[b_ModulNbr] & dw_MolduleConfiguration[b_ModulNbr] &
0xFFFF0000UL) == APCI1710_PWM) { 0xFFFF0000UL) == APCI1710_PWM) {
/**************************/ /**************************/
/* Test the PWM selection */ /* Test the PWM selection */
/**************************/ /**************************/
if (b_PWM <= 1) { if (b_PWM <= 1) {
/******************/ /******************/
/* Test the clock */ /* Test the clock */
/******************/ /******************/
if ((b_ClockSelection == APCI1710_30MHZ) || if ((b_ClockSelection == APCI1710_30MHZ) ||
(b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_33MHZ) ||
(b_ClockSelection == APCI1710_40MHZ)) { (b_ClockSelection == APCI1710_40MHZ)) {
/************************/ /************************/
/* Test the timing unit */ /* Test the timing unit */
/************************/ /************************/
if (b_TimingUnit <= 4) { if (b_TimingUnit <= 4) {
/*********************************/ /*********************************/
/* Test the low timing selection */ /* Test the low timing selection */
/*********************************/ /*********************************/
if (((b_ClockSelection == if (((b_ClockSelection ==
APCI1710_30MHZ) APCI1710_30MHZ)
...@@ -361,34 +361,34 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -361,34 +361,34 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
&& (ul_LowTiming && (ul_LowTiming
<= <=
7UL))) { 7UL))) {
/**********************************/ /**********************************/
/* Test the High timing selection */ /* Test the High timing selection */
/**********************************/ /**********************************/
if (((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 266) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230650UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 9UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 242) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691043UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 520UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 8UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 200) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496729UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 7UL))) { if (((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 266) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230650UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 9UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 242) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691043UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 520UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 8UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 200) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496729UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 7UL))) {
/**************************/ /**************************/
/* Test the board version */ /* Test the board version */
/**************************/ /**************************/
if (((b_ClockSelection == APCI1710_40MHZ) && (devpriv->s_BoardInfos.b_BoardVersion > 0)) || (b_ClockSelection != APCI1710_40MHZ)) { if (((b_ClockSelection == APCI1710_40MHZ) && (devpriv->s_BoardInfos.b_BoardVersion > 0)) || (b_ClockSelection != APCI1710_40MHZ)) {
/************************************/ /************************************/
/* Calculate the low division fator */ /* Calculate the low division fator */
/************************************/ /************************************/
fpu_begin fpu_begin
(); ();
switch (b_TimingUnit) { switch (b_TimingUnit) {
/******/ /******/
/* ns */ /* ns */
/******/ /******/
case 0: case 0:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_LowTimerValue ul_LowTimerValue
= =
...@@ -397,9 +397,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -397,9 +397,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
* *
(0.00025 * b_ClockSelection)); (0.00025 * b_ClockSelection));
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)ul_LowTiming * (0.00025 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { if ((double)((double)ul_LowTiming * (0.00025 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
ul_LowTimerValue ul_LowTimerValue
...@@ -409,9 +409,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -409,9 +409,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
*pul_RealLowTiming *pul_RealLowTiming
= =
...@@ -461,15 +461,15 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -461,15 +461,15 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
break; break;
/******/ /******/
/* æs */ /* æs */
/******/ /******/
case 1: case 1:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_LowTimerValue ul_LowTimerValue
= =
...@@ -478,9 +478,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -478,9 +478,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
* *
(0.25 * b_ClockSelection)); (0.25 * b_ClockSelection));
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)ul_LowTiming * (0.25 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { if ((double)((double)ul_LowTiming * (0.25 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
ul_LowTimerValue ul_LowTimerValue
...@@ -490,9 +490,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -490,9 +490,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
*pul_RealLowTiming *pul_RealLowTiming
= =
...@@ -544,15 +544,15 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -544,15 +544,15 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
break; break;
/******/ /******/
/* ms */ /* ms */
/******/ /******/
case 2: case 2:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_LowTimerValue ul_LowTimerValue
= =
...@@ -562,9 +562,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -562,9 +562,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
* *
b_ClockSelection); b_ClockSelection);
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)ul_LowTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { if ((double)((double)ul_LowTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
ul_LowTimerValue ul_LowTimerValue
...@@ -574,9 +574,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -574,9 +574,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
*pul_RealLowTiming *pul_RealLowTiming
= =
...@@ -626,14 +626,14 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -626,14 +626,14 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
break; break;
/*****/ /*****/
/* s */ /* s */
/*****/ /*****/
case 3: case 3:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_LowTimerValue ul_LowTimerValue
= =
...@@ -644,9 +644,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -644,9 +644,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
* *
b_ClockSelection)); b_ClockSelection));
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)ul_LowTiming * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { if ((double)((double)ul_LowTiming * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
ul_LowTimerValue ul_LowTimerValue
...@@ -656,9 +656,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -656,9 +656,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
*pul_RealLowTiming *pul_RealLowTiming
= =
...@@ -711,15 +711,15 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -711,15 +711,15 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
break; break;
/******/ /******/
/* mn */ /* mn */
/******/ /******/
case 4: case 4:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_LowTimerValue ul_LowTimerValue
= =
...@@ -733,9 +733,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -733,9 +733,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
* *
b_ClockSelection)); b_ClockSelection));
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)(ul_LowTiming * 60.0) * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { if ((double)((double)(ul_LowTiming * 60.0) * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
ul_LowTimerValue ul_LowTimerValue
...@@ -745,9 +745,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -745,9 +745,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
*pul_RealLowTiming *pul_RealLowTiming
= =
...@@ -806,20 +806,20 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -806,20 +806,20 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
break; break;
} }
/*************************************/ /*************************************/
/* Calculate the high division fator */ /* Calculate the high division fator */
/*************************************/ /*************************************/
switch (b_TimingUnit) { switch (b_TimingUnit) {
/******/ /******/
/* ns */ /* ns */
/******/ /******/
case 0: case 0:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_HighTimerValue ul_HighTimerValue
= =
...@@ -828,9 +828,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -828,9 +828,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
* *
(0.00025 * b_ClockSelection)); (0.00025 * b_ClockSelection));
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)ul_HighTiming * (0.00025 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { if ((double)((double)ul_HighTiming * (0.00025 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
ul_HighTimerValue ul_HighTimerValue
...@@ -840,9 +840,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -840,9 +840,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
*pul_RealHighTiming *pul_RealHighTiming
= =
...@@ -892,15 +892,15 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -892,15 +892,15 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
break; break;
/******/ /******/
/* æs */ /* æs */
/******/ /******/
case 1: case 1:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_HighTimerValue ul_HighTimerValue
= =
...@@ -909,9 +909,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -909,9 +909,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
* *
(0.25 * b_ClockSelection)); (0.25 * b_ClockSelection));
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)ul_HighTiming * (0.25 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { if ((double)((double)ul_HighTiming * (0.25 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
ul_HighTimerValue ul_HighTimerValue
...@@ -921,9 +921,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -921,9 +921,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
*pul_RealHighTiming *pul_RealHighTiming
= =
...@@ -975,15 +975,15 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -975,15 +975,15 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
break; break;
/******/ /******/
/* ms */ /* ms */
/******/ /******/
case 2: case 2:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_HighTimerValue ul_HighTimerValue
= =
...@@ -993,9 +993,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -993,9 +993,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
* *
b_ClockSelection); b_ClockSelection);
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)ul_HighTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { if ((double)((double)ul_HighTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
ul_HighTimerValue ul_HighTimerValue
...@@ -1005,9 +1005,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -1005,9 +1005,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
*pul_RealHighTiming *pul_RealHighTiming
= =
...@@ -1057,15 +1057,15 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -1057,15 +1057,15 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
break; break;
/*****/ /*****/
/* s */ /* s */
/*****/ /*****/
case 3: case 3:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_HighTimerValue ul_HighTimerValue
= =
...@@ -1076,9 +1076,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -1076,9 +1076,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
* *
b_ClockSelection)); b_ClockSelection));
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)ul_HighTiming * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { if ((double)((double)ul_HighTiming * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
ul_HighTimerValue ul_HighTimerValue
...@@ -1088,9 +1088,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -1088,9 +1088,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
*pul_RealHighTiming *pul_RealHighTiming
= =
...@@ -1143,15 +1143,15 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -1143,15 +1143,15 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
break; break;
/******/ /******/
/* mn */ /* mn */
/******/ /******/
case 4: case 4:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_HighTimerValue ul_HighTimerValue
= =
...@@ -1165,9 +1165,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -1165,9 +1165,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
* *
b_ClockSelection)); b_ClockSelection));
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)(ul_HighTiming * 60.0) * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { if ((double)((double)(ul_HighTiming * 60.0) * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
ul_HighTimerValue ul_HighTimerValue
...@@ -1177,9 +1177,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -1177,9 +1177,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
*pul_RealHighTiming *pul_RealHighTiming
= =
...@@ -1239,9 +1239,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -1239,9 +1239,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
} }
fpu_end(); fpu_end();
/****************************/ /****************************/
/* Save the clock selection */ /* Save the clock selection */
/****************************/ /****************************/
devpriv-> devpriv->
s_ModuleInfo s_ModuleInfo
...@@ -1251,9 +1251,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -1251,9 +1251,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
= =
b_ClockSelection; b_ClockSelection;
/************************/ /************************/
/* Save the timing unit */ /* Save the timing unit */
/************************/ /************************/
devpriv-> devpriv->
s_ModuleInfo s_ModuleInfo
...@@ -1265,9 +1265,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -1265,9 +1265,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
= =
b_TimingUnit; b_TimingUnit;
/****************************/ /****************************/
/* Save the low base timing */ /* Save the low base timing */
/****************************/ /****************************/
devpriv-> devpriv->
s_ModuleInfo s_ModuleInfo
...@@ -1289,9 +1289,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -1289,9 +1289,9 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
= =
*pul_RealLowTiming; *pul_RealLowTiming;
/****************************/ /****************************/
/* Save the high base timing */ /* Save the high base timing */
/****************************/ /****************************/
devpriv-> devpriv->
s_ModuleInfo s_ModuleInfo
...@@ -1313,21 +1313,21 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -1313,21 +1313,21 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
= =
*pul_RealHighTiming; *pul_RealHighTiming;
/************************/ /************************/
/* Write the low timing */ /* Write the low timing */
/************************/ /************************/
outl(ul_LowTimerValue, devpriv->s_BoardInfos.ui_Address + 0 + (20 * b_PWM) + (64 * b_ModulNbr)); outl(ul_LowTimerValue, devpriv->s_BoardInfos.ui_Address + 0 + (20 * b_PWM) + (64 * b_ModulNbr));
/*************************/ /*************************/
/* Write the high timing */ /* Write the high timing */
/*************************/ /*************************/
outl(ul_HighTimerValue, devpriv->s_BoardInfos.ui_Address + 4 + (20 * b_PWM) + (64 * b_ModulNbr)); outl(ul_HighTimerValue, devpriv->s_BoardInfos.ui_Address + 4 + (20 * b_PWM) + (64 * b_ModulNbr));
/***************************/ /***************************/
/* Set the clock selection */ /* Set the clock selection */
/***************************/ /***************************/
dw_Command dw_Command
= =
...@@ -1354,15 +1354,15 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -1354,15 +1354,15 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
0x80; 0x80;
} }
/***************************/ /***************************/
/* Set the clock selection */ /* Set the clock selection */
/***************************/ /***************************/
outl(dw_Command, devpriv->s_BoardInfos.ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); outl(dw_Command, devpriv->s_BoardInfos.ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr));
/*************/ /*************/
/* PWM init. */ /* PWM init. */
/*************/ /*************/
devpriv-> devpriv->
s_ModuleInfo s_ModuleInfo
[b_ModulNbr]. [b_ModulNbr].
...@@ -1373,65 +1373,65 @@ int i_APCI1710_InitPWM(struct comedi_device * dev, ...@@ -1373,65 +1373,65 @@ int i_APCI1710_InitPWM(struct comedi_device * dev,
= =
1; 1;
} else { } else {
/***************************************************/ /***************************************************/
/* You can not used the 40MHz clock selection with */ /* You can not used the 40MHz clock selection with */
/* this board */ /* this board */
/***************************************************/ /***************************************************/
DPRINTK("You can not used the 40MHz clock selection with this board\n"); DPRINTK("You can not used the 40MHz clock selection with this board\n");
i_ReturnValue i_ReturnValue
= =
-9; -9;
} }
} else { } else {
/***************************************/ /***************************************/
/* High base timing selection is wrong */ /* High base timing selection is wrong */
/***************************************/ /***************************************/
DPRINTK("High base timing selection is wrong\n"); DPRINTK("High base timing selection is wrong\n");
i_ReturnValue = i_ReturnValue =
-8; -8;
} }
} else { } else {
/**************************************/ /**************************************/
/* Low base timing selection is wrong */ /* Low base timing selection is wrong */
/**************************************/ /**************************************/
DPRINTK("Low base timing selection is wrong\n"); DPRINTK("Low base timing selection is wrong\n");
i_ReturnValue = -7; i_ReturnValue = -7;
} }
} // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */
else { else {
/**********************************/ /**********************************/
/* Timing unit selection is wrong */ /* Timing unit selection is wrong */
/**********************************/ /**********************************/
DPRINTK("Timing unit selection is wrong\n"); DPRINTK("Timing unit selection is wrong\n");
i_ReturnValue = -6; i_ReturnValue = -6;
} // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */
} // if ((b_ClockSelection == APCI1710_30MHZ) || (b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_40MHZ)) } /* if ((b_ClockSelection == APCI1710_30MHZ) || (b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_40MHZ)) */
else { else {
/*******************************/ /*******************************/
/* The selected clock is wrong */ /* The selected clock is wrong */
/*******************************/ /*******************************/
DPRINTK("The selected clock is wrong\n"); DPRINTK("The selected clock is wrong\n");
i_ReturnValue = -5; i_ReturnValue = -5;
} // if ((b_ClockSelection == APCI1710_30MHZ) || (b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_40MHZ)) } /* if ((b_ClockSelection == APCI1710_30MHZ) || (b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_40MHZ)) */
} // if (b_PWM >= 0 && b_PWM <= 1) } /* if (b_PWM >= 0 && b_PWM <= 1) */
else { else {
/******************************/ /******************************/
/* Tor PWM selection is wrong */ /* Tor PWM selection is wrong */
/******************************/ /******************************/
DPRINTK("Tor PWM selection is wrong\n"); DPRINTK("Tor PWM selection is wrong\n");
i_ReturnValue = -4; i_ReturnValue = -4;
} // if (b_PWM >= 0 && b_PWM <= 1) } /* if (b_PWM >= 0 && b_PWM <= 1) */
} else { } else {
/**********************************/ /**********************************/
/* The module is not a PWM module */ /* The module is not a PWM module */
/**********************************/ /**********************************/
DPRINTK("The module is not a PWM module\n"); DPRINTK("The module is not a PWM module\n");
i_ReturnValue = -3; i_ReturnValue = -3;
} }
} else { } else {
/***********************/ /***********************/
/* Module number error */ /* Module number error */
/***********************/ /***********************/
DPRINTK("Module number error\n"); DPRINTK("Module number error\n");
i_ReturnValue = -2; i_ReturnValue = -2;
} }
...@@ -1554,48 +1554,48 @@ int i_APCI1710_GetPWMInitialisation(struct comedi_device * dev, ...@@ -1554,48 +1554,48 @@ int i_APCI1710_GetPWMInitialisation(struct comedi_device * dev,
/**************************/ /**************************/
if (b_ModulNbr < 4) { if (b_ModulNbr < 4) {
/***************/ /***************/
/* Test if PWM */ /* Test if PWM */
/***************/ /***************/
if ((devpriv->s_BoardInfos. if ((devpriv->s_BoardInfos.
dw_MolduleConfiguration[b_ModulNbr] & dw_MolduleConfiguration[b_ModulNbr] &
0xFFFF0000UL) == APCI1710_PWM) { 0xFFFF0000UL) == APCI1710_PWM) {
/**************************/ /**************************/
/* Test the PWM selection */ /* Test the PWM selection */
/**************************/ /**************************/
if (b_PWM <= 1) { if (b_PWM <= 1) {
/***************************/ /***************************/
/* Test if PWM initialised */ /* Test if PWM initialised */
/***************************/ /***************************/
dw_Status = inl(devpriv->s_BoardInfos. dw_Status = inl(devpriv->s_BoardInfos.
ui_Address + 12 + (20 * b_PWM) + ui_Address + 12 + (20 * b_PWM) +
(64 * b_ModulNbr)); (64 * b_ModulNbr));
if (dw_Status & 0x10) { if (dw_Status & 0x10) {
/***********************/ /***********************/
/* Read the low timing */ /* Read the low timing */
/***********************/ /***********************/
*pul_LowTiming = *pul_LowTiming =
inl(devpriv->s_BoardInfos. inl(devpriv->s_BoardInfos.
ui_Address + 0 + (20 * b_PWM) + ui_Address + 0 + (20 * b_PWM) +
(64 * b_ModulNbr)); (64 * b_ModulNbr));
/************************/ /************************/
/* Read the high timing */ /* Read the high timing */
/************************/ /************************/
*pul_HighTiming = *pul_HighTiming =
inl(devpriv->s_BoardInfos. inl(devpriv->s_BoardInfos.
ui_Address + 4 + (20 * b_PWM) + ui_Address + 4 + (20 * b_PWM) +
(64 * b_ModulNbr)); (64 * b_ModulNbr));
/********************/ /********************/
/* Read the command */ /* Read the command */
/********************/ /********************/
dw_Command = inl(devpriv->s_BoardInfos. dw_Command = inl(devpriv->s_BoardInfos.
ui_Address + 8 + (20 * b_PWM) + ui_Address + 8 + (20 * b_PWM) +
...@@ -1619,9 +1619,9 @@ int i_APCI1710_GetPWMInitialisation(struct comedi_device * dev, ...@@ -1619,9 +1619,9 @@ int i_APCI1710_GetPWMInitialisation(struct comedi_device * dev,
2) & 1); 2) & 1);
} }
/********************/ /********************/
/* Read the command */ /* Read the command */
/********************/ /********************/
dw_Command = inl(devpriv->s_BoardInfos. dw_Command = inl(devpriv->s_BoardInfos.
ui_Address + 8 + (20 * b_PWM) + ui_Address + 8 + (20 * b_PWM) +
...@@ -1634,33 +1634,33 @@ int i_APCI1710_GetPWMInitialisation(struct comedi_device * dev, ...@@ -1634,33 +1634,33 @@ int i_APCI1710_GetPWMInitialisation(struct comedi_device * dev,
s_ModuleInfo[b_ModulNbr]. s_ModuleInfo[b_ModulNbr].
s_PWMModuleInfo. s_PWMModuleInfo.
s_PWMInfo[b_PWM].b_TimingUnit; s_PWMInfo[b_PWM].b_TimingUnit;
} // if (dw_Status & 0x10) } /* if (dw_Status & 0x10) */
else { else {
/***********************/ /***********************/
/* PWM not initialised */ /* PWM not initialised */
/***********************/ /***********************/
DPRINTK("PWM not initialised\n"); DPRINTK("PWM not initialised\n");
i_ReturnValue = -5; i_ReturnValue = -5;
} // if (dw_Status & 0x10) } /* if (dw_Status & 0x10) */
} // if (b_PWM >= 0 && b_PWM <= 1) } /* if (b_PWM >= 0 && b_PWM <= 1) */
else { else {
/******************************/ /******************************/
/* Tor PWM selection is wrong */ /* Tor PWM selection is wrong */
/******************************/ /******************************/
DPRINTK("Tor PWM selection is wrong\n"); DPRINTK("Tor PWM selection is wrong\n");
i_ReturnValue = -4; i_ReturnValue = -4;
} // if (b_PWM >= 0 && b_PWM <= 1) } /* if (b_PWM >= 0 && b_PWM <= 1) */
} else { } else {
/**********************************/ /**********************************/
/* The module is not a PWM module */ /* The module is not a PWM module */
/**********************************/ /**********************************/
DPRINTK("The module is not a PWM module\n"); DPRINTK("The module is not a PWM module\n");
i_ReturnValue = -3; i_ReturnValue = -3;
} }
} else { } else {
/***********************/ /***********************/
/* Module number error */ /* Module number error */
/***********************/ /***********************/
DPRINTK("Module number error\n"); DPRINTK("Module number error\n");
i_ReturnValue = -2; i_ReturnValue = -2;
} }
...@@ -1817,66 +1817,66 @@ int i_APCI1710_EnablePWM(struct comedi_device * dev, ...@@ -1817,66 +1817,66 @@ int i_APCI1710_EnablePWM(struct comedi_device * dev,
unsigned int dw_Status; unsigned int dw_Status;
unsigned int dw_Command; unsigned int dw_Command;
devpriv->tsk_Current = current; // Save the current process task structure devpriv->tsk_Current = current; /* Save the current process task structure */
/**************************/ /**************************/
/* Test the module number */ /* Test the module number */
/**************************/ /**************************/
if (b_ModulNbr < 4) { if (b_ModulNbr < 4) {
/***************/ /***************/
/* Test if PWM */ /* Test if PWM */
/***************/ /***************/
if ((devpriv->s_BoardInfos. if ((devpriv->s_BoardInfos.
dw_MolduleConfiguration[b_ModulNbr] & dw_MolduleConfiguration[b_ModulNbr] &
0xFFFF0000UL) == APCI1710_PWM) { 0xFFFF0000UL) == APCI1710_PWM) {
/**************************/ /**************************/
/* Test the PWM selection */ /* Test the PWM selection */
/**************************/ /**************************/
if (b_PWM <= 1) { if (b_PWM <= 1) {
/***************************/ /***************************/
/* Test if PWM initialised */ /* Test if PWM initialised */
/***************************/ /***************************/
dw_Status = inl(devpriv->s_BoardInfos. dw_Status = inl(devpriv->s_BoardInfos.
ui_Address + 12 + (20 * b_PWM) + ui_Address + 12 + (20 * b_PWM) +
(64 * b_ModulNbr)); (64 * b_ModulNbr));
if (dw_Status & 0x10) { if (dw_Status & 0x10) {
/**********************************/ /**********************************/
/* Test the start level selection */ /* Test the start level selection */
/**********************************/ /**********************************/
if (b_StartLevel <= 1) { if (b_StartLevel <= 1) {
/**********************/ /**********************/
/* Test the stop mode */ /* Test the stop mode */
/**********************/ /**********************/
if (b_StopMode <= 1) { if (b_StopMode <= 1) {
/***********************/ /***********************/
/* Test the stop level */ /* Test the stop level */
/***********************/ /***********************/
if (b_StopLevel <= 2) { if (b_StopLevel <= 2) {
/*****************************/ /*****************************/
/* Test the extern gate mode */ /* Test the extern gate mode */
/*****************************/ /*****************************/
if (b_ExternGate if (b_ExternGate
<= 1) { <= 1) {
/*****************************/ /*****************************/
/* Test the interrupt action */ /* Test the interrupt action */
/*****************************/ /*****************************/
if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) { if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) {
/******************************************/ /******************************************/
/* Test if interrupt function initialised */ /* Test if interrupt function initialised */
/******************************************/ /******************************************/
/********************/ /********************/
/* Read the command */ /* Read the command */
/********************/ /********************/
dw_Command dw_Command
= =
...@@ -1895,9 +1895,9 @@ int i_APCI1710_EnablePWM(struct comedi_device * dev, ...@@ -1895,9 +1895,9 @@ int i_APCI1710_EnablePWM(struct comedi_device * dev,
& &
0x80; 0x80;
/********************/ /********************/
/* Make the command */ /* Make the command */
/********************/ /********************/
dw_Command dw_Command
= =
...@@ -1943,88 +1943,88 @@ int i_APCI1710_EnablePWM(struct comedi_device * dev, ...@@ -1943,88 +1943,88 @@ int i_APCI1710_EnablePWM(struct comedi_device * dev,
= =
b_InterruptEnable; b_InterruptEnable;
/*******************/ /*******************/
/* Set the command */ /* Set the command */
/*******************/ /*******************/
outl(dw_Command, devpriv->s_BoardInfos.ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); outl(dw_Command, devpriv->s_BoardInfos.ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr));
/******************/ /******************/
/* Enable the PWM */ /* Enable the PWM */
/******************/ /******************/
outl(1, devpriv->s_BoardInfos.ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); outl(1, devpriv->s_BoardInfos.ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr));
} // if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) } /* if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) */
else { else {
/********************************/ /********************************/
/* Interrupt parameter is wrong */ /* Interrupt parameter is wrong */
/********************************/ /********************************/
DPRINTK("Interrupt parameter is wrong\n"); DPRINTK("Interrupt parameter is wrong\n");
i_ReturnValue i_ReturnValue
= =
-10; -10;
} // if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) } /* if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) */
} // if (b_ExternGate >= 0 && b_ExternGate <= 1) } /* if (b_ExternGate >= 0 && b_ExternGate <= 1) */
else { else {
/*****************************************/ /*****************************************/
/* Extern gate signal selection is wrong */ /* Extern gate signal selection is wrong */
/*****************************************/ /*****************************************/
DPRINTK("Extern gate signal selection is wrong\n"); DPRINTK("Extern gate signal selection is wrong\n");
i_ReturnValue i_ReturnValue
= =
-9; -9;
} // if (b_ExternGate >= 0 && b_ExternGate <= 1) } /* if (b_ExternGate >= 0 && b_ExternGate <= 1) */
} // if (b_StopLevel >= 0 && b_StopLevel <= 2) } /* if (b_StopLevel >= 0 && b_StopLevel <= 2) */
else { else {
/*************************************/ /*************************************/
/* PWM stop level selection is wrong */ /* PWM stop level selection is wrong */
/*************************************/ /*************************************/
DPRINTK("PWM stop level selection is wrong\n"); DPRINTK("PWM stop level selection is wrong\n");
i_ReturnValue = i_ReturnValue =
-8; -8;
} // if (b_StopLevel >= 0 && b_StopLevel <= 2) } /* if (b_StopLevel >= 0 && b_StopLevel <= 2) */
} // if (b_StopMode >= 0 && b_StopMode <= 1) } /* if (b_StopMode >= 0 && b_StopMode <= 1) */
else { else {
/************************************/ /************************************/
/* PWM stop mode selection is wrong */ /* PWM stop mode selection is wrong */
/************************************/ /************************************/
DPRINTK("PWM stop mode selection is wrong\n"); DPRINTK("PWM stop mode selection is wrong\n");
i_ReturnValue = -7; i_ReturnValue = -7;
} // if (b_StopMode >= 0 && b_StopMode <= 1) } /* if (b_StopMode >= 0 && b_StopMode <= 1) */
} // if (b_StartLevel >= 0 && b_StartLevel <= 1) } /* if (b_StartLevel >= 0 && b_StartLevel <= 1) */
else { else {
/**************************************/ /**************************************/
/* PWM start level selection is wrong */ /* PWM start level selection is wrong */
/**************************************/ /**************************************/
DPRINTK("PWM start level selection is wrong\n"); DPRINTK("PWM start level selection is wrong\n");
i_ReturnValue = -6; i_ReturnValue = -6;
} // if (b_StartLevel >= 0 && b_StartLevel <= 1) } /* if (b_StartLevel >= 0 && b_StartLevel <= 1) */
} // if (dw_Status & 0x10) } /* if (dw_Status & 0x10) */
else { else {
/***********************/ /***********************/
/* PWM not initialised */ /* PWM not initialised */
/***********************/ /***********************/
DPRINTK("PWM not initialised\n"); DPRINTK("PWM not initialised\n");
i_ReturnValue = -5; i_ReturnValue = -5;
} // if (dw_Status & 0x10) } /* if (dw_Status & 0x10) */
} // if (b_PWM >= 0 && b_PWM <= 1) } /* if (b_PWM >= 0 && b_PWM <= 1) */
else { else {
/******************************/ /******************************/
/* Tor PWM selection is wrong */ /* Tor PWM selection is wrong */
/******************************/ /******************************/
DPRINTK("Tor PWM selection is wrong\n"); DPRINTK("Tor PWM selection is wrong\n");
i_ReturnValue = -4; i_ReturnValue = -4;
} // if (b_PWM >= 0 && b_PWM <= 1) } /* if (b_PWM >= 0 && b_PWM <= 1) */
} else { } else {
/**********************************/ /**********************************/
/* The module is not a PWM module */ /* The module is not a PWM module */
/**********************************/ /**********************************/
DPRINTK("The module is not a PWM module\n"); DPRINTK("The module is not a PWM module\n");
i_ReturnValue = -3; i_ReturnValue = -3;
} }
} else { } else {
/***********************/ /***********************/
/* Module number error */ /* Module number error */
/***********************/ /***********************/
DPRINTK("Module number error\n"); DPRINTK("Module number error\n");
i_ReturnValue = -2; i_ReturnValue = -2;
} }
...@@ -2072,74 +2072,74 @@ int i_APCI1710_DisablePWM(struct comedi_device * dev, unsigned char b_ModulNbr, ...@@ -2072,74 +2072,74 @@ int i_APCI1710_DisablePWM(struct comedi_device * dev, unsigned char b_ModulNbr,
/**************************/ /**************************/
if (b_ModulNbr < 4) { if (b_ModulNbr < 4) {
/***************/ /***************/
/* Test if PWM */ /* Test if PWM */
/***************/ /***************/
if ((devpriv->s_BoardInfos. if ((devpriv->s_BoardInfos.
dw_MolduleConfiguration[b_ModulNbr] & dw_MolduleConfiguration[b_ModulNbr] &
0xFFFF0000UL) == APCI1710_PWM) { 0xFFFF0000UL) == APCI1710_PWM) {
/**************************/ /**************************/
/* Test the PWM selection */ /* Test the PWM selection */
/**************************/ /**************************/
if (b_PWM <= 1) { if (b_PWM <= 1) {
/***************************/ /***************************/
/* Test if PWM initialised */ /* Test if PWM initialised */
/***************************/ /***************************/
dw_Status = inl(devpriv->s_BoardInfos. dw_Status = inl(devpriv->s_BoardInfos.
ui_Address + 12 + (20 * b_PWM) + ui_Address + 12 + (20 * b_PWM) +
(64 * b_ModulNbr)); (64 * b_ModulNbr));
if (dw_Status & 0x10) { if (dw_Status & 0x10) {
/***********************/ /***********************/
/* Test if PWM enabled */ /* Test if PWM enabled */
/***********************/ /***********************/
if (dw_Status & 0x1) { if (dw_Status & 0x1) {
/*******************/ /*******************/
/* Disable the PWM */ /* Disable the PWM */
/*******************/ /*******************/
outl(0, devpriv->s_BoardInfos. outl(0, devpriv->s_BoardInfos.
ui_Address + 12 + ui_Address + 12 +
(20 * b_PWM) + (20 * b_PWM) +
(64 * b_ModulNbr)); (64 * b_ModulNbr));
} // if (dw_Status & 0x1) } /* if (dw_Status & 0x1) */
else { else {
/*******************/ /*******************/
/* PWM not enabled */ /* PWM not enabled */
/*******************/ /*******************/
DPRINTK("PWM not enabled\n"); DPRINTK("PWM not enabled\n");
i_ReturnValue = -6; i_ReturnValue = -6;
} // if (dw_Status & 0x1) } /* if (dw_Status & 0x1) */
} // if (dw_Status & 0x10) } /* if (dw_Status & 0x10) */
else { else {
/***********************/ /***********************/
/* PWM not initialised */ /* PWM not initialised */
/***********************/ /***********************/
DPRINTK(" PWM not initialised\n"); DPRINTK(" PWM not initialised\n");
i_ReturnValue = -5; i_ReturnValue = -5;
} // if (dw_Status & 0x10) } /* if (dw_Status & 0x10) */
} // if (b_PWM >= 0 && b_PWM <= 1) } /* if (b_PWM >= 0 && b_PWM <= 1) */
else { else {
/******************************/ /******************************/
/* Tor PWM selection is wrong */ /* Tor PWM selection is wrong */
/******************************/ /******************************/
DPRINTK("Tor PWM selection is wrong\n"); DPRINTK("Tor PWM selection is wrong\n");
i_ReturnValue = -4; i_ReturnValue = -4;
} // if (b_PWM >= 0 && b_PWM <= 1) } /* if (b_PWM >= 0 && b_PWM <= 1) */
} else { } else {
/**********************************/ /**********************************/
/* The module is not a PWM module */ /* The module is not a PWM module */
/**********************************/ /**********************************/
DPRINTK("The module is not a PWM module\n"); DPRINTK("The module is not a PWM module\n");
i_ReturnValue = -3; i_ReturnValue = -3;
} }
} else { } else {
/***********************/ /***********************/
/* Module number error */ /* Module number error */
/***********************/ /***********************/
DPRINTK("Module number error\n"); DPRINTK("Module number error\n");
i_ReturnValue = -2; i_ReturnValue = -2;
} }
...@@ -2209,21 +2209,21 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2209,21 +2209,21 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
/**************************/ /**************************/
if (b_ModulNbr < 4) { if (b_ModulNbr < 4) {
/***************/ /***************/
/* Test if PWM */ /* Test if PWM */
/***************/ /***************/
if ((devpriv->s_BoardInfos. if ((devpriv->s_BoardInfos.
dw_MolduleConfiguration[b_ModulNbr] & dw_MolduleConfiguration[b_ModulNbr] &
0xFFFF0000UL) == APCI1710_PWM) { 0xFFFF0000UL) == APCI1710_PWM) {
/**************************/ /**************************/
/* Test the PWM selection */ /* Test the PWM selection */
/**************************/ /**************************/
if (b_PWM <= 1) { if (b_PWM <= 1) {
/***************************/ /***************************/
/* Test if PWM initialised */ /* Test if PWM initialised */
/***************************/ /***************************/
dw_Status = inl(devpriv->s_BoardInfos. dw_Status = inl(devpriv->s_BoardInfos.
ui_Address + 12 + (20 * b_PWM) + ui_Address + 12 + (20 * b_PWM) +
...@@ -2235,14 +2235,14 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2235,14 +2235,14 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
s_PWMModuleInfo. s_PWMModuleInfo.
b_ClockSelection; b_ClockSelection;
/************************/ /************************/
/* Test the timing unit */ /* Test the timing unit */
/************************/ /************************/
if (b_TimingUnit <= 4) { if (b_TimingUnit <= 4) {
/*********************************/ /*********************************/
/* Test the low timing selection */ /* Test the low timing selection */
/*********************************/ /*********************************/
if (((b_ClockSelection == if (((b_ClockSelection ==
APCI1710_30MHZ) APCI1710_30MHZ)
...@@ -2377,26 +2377,26 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2377,26 +2377,26 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
&& (ul_LowTiming && (ul_LowTiming
<= <=
7UL))) { 7UL))) {
/**********************************/ /**********************************/
/* Test the High timing selection */ /* Test the High timing selection */
/**********************************/ /**********************************/
if (((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 266) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230650UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 9UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 242) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691043UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 520UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 8UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 200) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496729UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 7UL))) { if (((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 266) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230650UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 9UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 242) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691043UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 520UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 8UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 200) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496729UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 7UL))) {
/************************************/ /************************************/
/* Calculate the low division fator */ /* Calculate the low division fator */
/************************************/ /************************************/
fpu_begin(); fpu_begin();
switch (b_TimingUnit) { switch (b_TimingUnit) {
/******/ /******/
/* ns */ /* ns */
/******/ /******/
case 0: case 0:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_LowTimerValue ul_LowTimerValue
= =
...@@ -2405,9 +2405,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2405,9 +2405,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
* *
(0.00025 * b_ClockSelection)); (0.00025 * b_ClockSelection));
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)ul_LowTiming * (0.00025 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { if ((double)((double)ul_LowTiming * (0.00025 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
ul_LowTimerValue ul_LowTimerValue
...@@ -2417,9 +2417,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2417,9 +2417,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
ul_RealLowTiming ul_RealLowTiming
= =
...@@ -2469,15 +2469,15 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2469,15 +2469,15 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
break; break;
/******/ /******/
/* æs */ /* æs */
/******/ /******/
case 1: case 1:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_LowTimerValue ul_LowTimerValue
= =
...@@ -2486,9 +2486,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2486,9 +2486,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
* *
(0.25 * b_ClockSelection)); (0.25 * b_ClockSelection));
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)ul_LowTiming * (0.25 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { if ((double)((double)ul_LowTiming * (0.25 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
ul_LowTimerValue ul_LowTimerValue
...@@ -2498,9 +2498,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2498,9 +2498,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
ul_RealLowTiming ul_RealLowTiming
= =
...@@ -2552,15 +2552,15 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2552,15 +2552,15 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
break; break;
/******/ /******/
/* ms */ /* ms */
/******/ /******/
case 2: case 2:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_LowTimerValue ul_LowTimerValue
= =
...@@ -2570,9 +2570,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2570,9 +2570,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
* *
b_ClockSelection); b_ClockSelection);
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)ul_LowTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { if ((double)((double)ul_LowTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
ul_LowTimerValue ul_LowTimerValue
...@@ -2582,9 +2582,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2582,9 +2582,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
ul_RealLowTiming ul_RealLowTiming
= =
...@@ -2634,15 +2634,15 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2634,15 +2634,15 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
break; break;
/*****/ /*****/
/* s */ /* s */
/*****/ /*****/
case 3: case 3:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_LowTimerValue ul_LowTimerValue
= =
...@@ -2653,9 +2653,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2653,9 +2653,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
* *
b_ClockSelection)); b_ClockSelection));
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)ul_LowTiming * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { if ((double)((double)ul_LowTiming * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
ul_LowTimerValue ul_LowTimerValue
...@@ -2665,9 +2665,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2665,9 +2665,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
ul_RealLowTiming ul_RealLowTiming
= =
...@@ -2720,15 +2720,15 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2720,15 +2720,15 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
break; break;
/******/ /******/
/* mn */ /* mn */
/******/ /******/
case 4: case 4:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_LowTimerValue ul_LowTimerValue
= =
...@@ -2742,9 +2742,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2742,9 +2742,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
* *
b_ClockSelection)); b_ClockSelection));
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)(ul_LowTiming * 60.0) * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { if ((double)((double)(ul_LowTiming * 60.0) * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
ul_LowTimerValue ul_LowTimerValue
...@@ -2754,9 +2754,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2754,9 +2754,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
ul_RealLowTiming ul_RealLowTiming
= =
...@@ -2815,20 +2815,20 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2815,20 +2815,20 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
break; break;
} }
/*************************************/ /*************************************/
/* Calculate the high division fator */ /* Calculate the high division fator */
/*************************************/ /*************************************/
switch (b_TimingUnit) { switch (b_TimingUnit) {
/******/ /******/
/* ns */ /* ns */
/******/ /******/
case 0: case 0:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_HighTimerValue ul_HighTimerValue
= =
...@@ -2837,9 +2837,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2837,9 +2837,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
* *
(0.00025 * b_ClockSelection)); (0.00025 * b_ClockSelection));
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)ul_HighTiming * (0.00025 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { if ((double)((double)ul_HighTiming * (0.00025 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
ul_HighTimerValue ul_HighTimerValue
...@@ -2849,9 +2849,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2849,9 +2849,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
ul_RealHighTiming ul_RealHighTiming
= =
...@@ -2901,15 +2901,15 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2901,15 +2901,15 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
break; break;
/******/ /******/
/* æs */ /* æs */
/******/ /******/
case 1: case 1:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_HighTimerValue ul_HighTimerValue
= =
...@@ -2918,9 +2918,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2918,9 +2918,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
* *
(0.25 * b_ClockSelection)); (0.25 * b_ClockSelection));
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)ul_HighTiming * (0.25 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { if ((double)((double)ul_HighTiming * (0.25 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
ul_HighTimerValue ul_HighTimerValue
...@@ -2930,9 +2930,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2930,9 +2930,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
ul_RealHighTiming ul_RealHighTiming
= =
...@@ -2984,15 +2984,15 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -2984,15 +2984,15 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
break; break;
/******/ /******/
/* ms */ /* ms */
/******/ /******/
case 2: case 2:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_HighTimerValue ul_HighTimerValue
= =
...@@ -3002,9 +3002,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -3002,9 +3002,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
* *
b_ClockSelection); b_ClockSelection);
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)ul_HighTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { if ((double)((double)ul_HighTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
ul_HighTimerValue ul_HighTimerValue
...@@ -3014,9 +3014,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -3014,9 +3014,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
ul_RealHighTiming ul_RealHighTiming
= =
...@@ -3066,15 +3066,15 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -3066,15 +3066,15 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
break; break;
/*****/ /*****/
/* s */ /* s */
/*****/ /*****/
case 3: case 3:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_HighTimerValue ul_HighTimerValue
= =
...@@ -3085,9 +3085,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -3085,9 +3085,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
* *
b_ClockSelection)); b_ClockSelection));
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)ul_HighTiming * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { if ((double)((double)ul_HighTiming * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
ul_HighTimerValue ul_HighTimerValue
...@@ -3097,9 +3097,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -3097,9 +3097,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
ul_RealHighTiming ul_RealHighTiming
= =
...@@ -3152,15 +3152,15 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -3152,15 +3152,15 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
break; break;
/******/ /******/
/* mn */ /* mn */
/******/ /******/
case 4: case 4:
/******************/ /******************/
/* Timer 0 factor */ /* Timer 0 factor */
/******************/ /******************/
ul_HighTimerValue ul_HighTimerValue
= =
...@@ -3174,9 +3174,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -3174,9 +3174,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
* *
b_ClockSelection)); b_ClockSelection));
/*******************/ /*******************/
/* Round the value */ /* Round the value */
/*******************/ /*******************/
if ((double)((double)(ul_HighTiming * 60.0) * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { if ((double)((double)(ul_HighTiming * 60.0) * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
ul_HighTimerValue ul_HighTimerValue
...@@ -3186,9 +3186,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -3186,9 +3186,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
1; 1;
} }
/*****************************/ /*****************************/
/* Calculate the real timing */ /* Calculate the real timing */
/*****************************/ /*****************************/
ul_RealHighTiming ul_RealHighTiming
= =
...@@ -3249,9 +3249,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -3249,9 +3249,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
fpu_end(); fpu_end();
/************************/ /************************/
/* Save the timing unit */ /* Save the timing unit */
/************************/ /************************/
devpriv-> devpriv->
s_ModuleInfo s_ModuleInfo
...@@ -3263,9 +3263,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -3263,9 +3263,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
= =
b_TimingUnit; b_TimingUnit;
/****************************/ /****************************/
/* Save the low base timing */ /* Save the low base timing */
/****************************/ /****************************/
devpriv-> devpriv->
s_ModuleInfo s_ModuleInfo
...@@ -3287,9 +3287,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -3287,9 +3287,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
= =
ul_RealLowTiming; ul_RealLowTiming;
/****************************/ /****************************/
/* Save the high base timing */ /* Save the high base timing */
/****************************/ /****************************/
devpriv-> devpriv->
s_ModuleInfo s_ModuleInfo
...@@ -3311,21 +3311,21 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -3311,21 +3311,21 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
= =
ul_RealHighTiming; ul_RealHighTiming;
/************************/ /************************/
/* Write the low timing */ /* Write the low timing */
/************************/ /************************/
outl(ul_LowTimerValue, devpriv->s_BoardInfos.ui_Address + 0 + (20 * b_PWM) + (64 * b_ModulNbr)); outl(ul_LowTimerValue, devpriv->s_BoardInfos.ui_Address + 0 + (20 * b_PWM) + (64 * b_ModulNbr));
/*************************/ /*************************/
/* Write the high timing */ /* Write the high timing */
/*************************/ /*************************/
outl(ul_HighTimerValue, devpriv->s_BoardInfos.ui_Address + 4 + (20 * b_PWM) + (64 * b_ModulNbr)); outl(ul_HighTimerValue, devpriv->s_BoardInfos.ui_Address + 4 + (20 * b_PWM) + (64 * b_ModulNbr));
/***************************/ /***************************/
/* Set the clock selection */ /* Set the clock selection */
/***************************/ /***************************/
dw_Command = dw_Command =
inl inl
...@@ -3347,9 +3347,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -3347,9 +3347,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
0x80; 0x80;
} }
/***************************/ /***************************/
/* Set the clock selection */ /* Set the clock selection */
/***************************/ /***************************/
outl(dw_Command, outl(dw_Command,
devpriv-> devpriv->
...@@ -3358,55 +3358,55 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, ...@@ -3358,55 +3358,55 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
+ 8 + + 8 +
(20 * b_PWM) + (64 * b_ModulNbr)); (20 * b_PWM) + (64 * b_ModulNbr));
} else { } else {
/***************************************/ /***************************************/
/* High base timing selection is wrong */ /* High base timing selection is wrong */
/***************************************/ /***************************************/
DPRINTK("High base timing selection is wrong\n"); DPRINTK("High base timing selection is wrong\n");
i_ReturnValue = i_ReturnValue =
-8; -8;
} }
} else { } else {
/**************************************/ /**************************************/
/* Low base timing selection is wrong */ /* Low base timing selection is wrong */
/**************************************/ /**************************************/
DPRINTK("Low base timing selection is wrong\n"); DPRINTK("Low base timing selection is wrong\n");
i_ReturnValue = -7; i_ReturnValue = -7;
} }
} // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */
else { else {
/**********************************/ /**********************************/
/* Timing unit selection is wrong */ /* Timing unit selection is wrong */
/**********************************/ /**********************************/
DPRINTK("Timing unit selection is wrong\n"); DPRINTK("Timing unit selection is wrong\n");
i_ReturnValue = -6; i_ReturnValue = -6;
} // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */
} // if (dw_Status & 0x10) } /* if (dw_Status & 0x10) */
else { else {
/***********************/ /***********************/
/* PWM not initialised */ /* PWM not initialised */
/***********************/ /***********************/
DPRINTK("PWM not initialised\n"); DPRINTK("PWM not initialised\n");
i_ReturnValue = -5; i_ReturnValue = -5;
} // if (dw_Status & 0x10) } /* if (dw_Status & 0x10) */
} // if (b_PWM >= 0 && b_PWM <= 1) } /* if (b_PWM >= 0 && b_PWM <= 1) */
else { else {
/******************************/ /******************************/
/* Tor PWM selection is wrong */ /* Tor PWM selection is wrong */
/******************************/ /******************************/
DPRINTK("Tor PWM selection is wrong\n"); DPRINTK("Tor PWM selection is wrong\n");
i_ReturnValue = -4; i_ReturnValue = -4;
} // if (b_PWM >= 0 && b_PWM <= 1) } /* if (b_PWM >= 0 && b_PWM <= 1) */
} else { } else {
/**********************************/ /**********************************/
/* The module is not a PWM module */ /* The module is not a PWM module */
/**********************************/ /**********************************/
DPRINTK("The module is not a PWM module\n"); DPRINTK("The module is not a PWM module\n");
i_ReturnValue = -3; i_ReturnValue = -3;
} }
} else { } else {
/***********************/ /***********************/
/* Module number error */ /* Module number error */
/***********************/ /***********************/
DPRINTK("Module number error\n"); DPRINTK("Module number error\n");
i_ReturnValue = -2; i_ReturnValue = -2;
} }
...@@ -3482,30 +3482,30 @@ int i_APCI1710_InsnReadGetPWMStatus(struct comedi_device * dev, struct comedi_su ...@@ -3482,30 +3482,30 @@ int i_APCI1710_InsnReadGetPWMStatus(struct comedi_device * dev, struct comedi_su
/**************************/ /**************************/
if (b_ModulNbr < 4) { if (b_ModulNbr < 4) {
/***************/ /***************/
/* Test if PWM */ /* Test if PWM */
/***************/ /***************/
if ((devpriv->s_BoardInfos. if ((devpriv->s_BoardInfos.
dw_MolduleConfiguration[b_ModulNbr] & dw_MolduleConfiguration[b_ModulNbr] &
0xFFFF0000UL) == APCI1710_PWM) { 0xFFFF0000UL) == APCI1710_PWM) {
/**************************/ /**************************/
/* Test the PWM selection */ /* Test the PWM selection */
/**************************/ /**************************/
if (b_PWM <= 1) { if (b_PWM <= 1) {
/***************************/ /***************************/
/* Test if PWM initialised */ /* Test if PWM initialised */
/***************************/ /***************************/
dw_Status = inl(devpriv->s_BoardInfos. dw_Status = inl(devpriv->s_BoardInfos.
ui_Address + 12 + (20 * b_PWM) + ui_Address + 12 + (20 * b_PWM) +
(64 * b_ModulNbr)); (64 * b_ModulNbr));
if (dw_Status & 0x10) { if (dw_Status & 0x10) {
/***********************/ /***********************/
/* Test if PWM enabled */ /* Test if PWM enabled */
/***********************/ /***********************/
if (dw_Status & 0x1) { if (dw_Status & 0x1) {
*pb_PWMOutputStatus = *pb_PWMOutputStatus =
...@@ -3514,45 +3514,45 @@ int i_APCI1710_InsnReadGetPWMStatus(struct comedi_device * dev, struct comedi_su ...@@ -3514,45 +3514,45 @@ int i_APCI1710_InsnReadGetPWMStatus(struct comedi_device * dev, struct comedi_su
*pb_ExternGateStatus = *pb_ExternGateStatus =
(unsigned char) ((dw_Status >> 6) (unsigned char) ((dw_Status >> 6)
& 1); & 1);
} // if (dw_Status & 0x1) } /* if (dw_Status & 0x1) */
else { else {
/*******************/ /*******************/
/* PWM not enabled */ /* PWM not enabled */
/*******************/ /*******************/
DPRINTK("PWM not enabled \n"); DPRINTK("PWM not enabled \n");
i_ReturnValue = -6; i_ReturnValue = -6;
} // if (dw_Status & 0x1) } /* if (dw_Status & 0x1) */
} // if (dw_Status & 0x10) } /* if (dw_Status & 0x10) */
else { else {
/***********************/ /***********************/
/* PWM not initialised */ /* PWM not initialised */
/***********************/ /***********************/
DPRINTK("PWM not initialised\n"); DPRINTK("PWM not initialised\n");
i_ReturnValue = -5; i_ReturnValue = -5;
} // if (dw_Status & 0x10) } /* if (dw_Status & 0x10) */
} // if (b_PWM >= 0 && b_PWM <= 1) } /* if (b_PWM >= 0 && b_PWM <= 1) */
else { else {
/******************************/ /******************************/
/* Tor PWM selection is wrong */ /* Tor PWM selection is wrong */
/******************************/ /******************************/
DPRINTK("Tor PWM selection is wrong\n"); DPRINTK("Tor PWM selection is wrong\n");
i_ReturnValue = -4; i_ReturnValue = -4;
} // if (b_PWM >= 0 && b_PWM <= 1) } /* if (b_PWM >= 0 && b_PWM <= 1) */
} else { } else {
/**********************************/ /**********************************/
/* The module is not a PWM module */ /* The module is not a PWM module */
/**********************************/ /**********************************/
DPRINTK("The module is not a PWM module\n"); DPRINTK("The module is not a PWM module\n");
i_ReturnValue = -3; i_ReturnValue = -3;
} }
} else { } else {
/***********************/ /***********************/
/* Module number error */ /* Module number error */
/***********************/ /***********************/
DPRINTK("Module number error\n"); DPRINTK("Module number error\n");
i_ReturnValue = -2; i_ReturnValue = -2;
...@@ -3574,9 +3574,9 @@ int i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device * dev, ...@@ -3574,9 +3574,9 @@ int i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device * dev,
s_FIFOInterruptParameters[devpriv-> s_FIFOInterruptParameters[devpriv->
s_InterruptParameters.ui_Read].ul_OldCounterLatchValue; s_InterruptParameters.ui_Read].ul_OldCounterLatchValue;
/**************************/ /**************************/
/* Increment the read FIFO */ /* Increment the read FIFO */
/***************************/ /***************************/
devpriv-> devpriv->
s_InterruptParameters. s_InterruptParameters.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment