|
@@ -130,9 +130,10 @@ You should also find the complete GPL in the COPYING file accompanying this sour
|
|
|
| this CHRONOS version |
|
|
|
+----------------------------------------------------------------------------+
|
|
|
*/
|
|
|
-
|
|
|
-int i_APCI1710_InsnConfigInitChrono(struct comedi_device *dev, struct comedi_subdevice *s,
|
|
|
- struct comedi_insn *insn, unsigned int *data)
|
|
|
+static int i_APCI1710_InsnConfigInitChrono(struct comedi_device *dev,
|
|
|
+ struct comedi_subdevice *s,
|
|
|
+ struct comedi_insn *insn,
|
|
|
+ unsigned int *data)
|
|
|
{
|
|
|
struct addi_private *devpriv = dev->private;
|
|
|
int i_ReturnValue = 0;
|
|
@@ -840,9 +841,10 @@ struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) |
|
|
|
-8: data[0] wrong input |
|
|
|
+----------------------------------------------------------------------------+
|
|
|
*/
|
|
|
-
|
|
|
-int i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev,
|
|
|
- struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
|
|
|
+static int i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev,
|
|
|
+ struct comedi_subdevice *s,
|
|
|
+ struct comedi_insn *insn,
|
|
|
+ unsigned int *data)
|
|
|
{
|
|
|
struct addi_private *devpriv = dev->private;
|
|
|
int i_ReturnValue = 0;
|
|
@@ -1077,88 +1079,6 @@ int i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev,
|
|
|
return i_ReturnValue;
|
|
|
}
|
|
|
|
|
|
-/*
|
|
|
-+----------------------------------------------------------------------------+
|
|
|
-| Function Name :INT i_APCI1710_InsnReadChrono(struct comedi_device *dev,struct comedi_subdevice *s,
|
|
|
-struct comedi_insn *insn,unsigned int *data) |
|
|
|
-+----------------------------------------------------------------------------+
|
|
|
-| Task : Read functions for Timer |
|
|
|
-+----------------------------------------------------------------------------+
|
|
|
-| Input Parameters :
|
|
|
-+----------------------------------------------------------------------------+
|
|
|
-| Output Parameters : - |
|
|
|
-+----------------------------------------------------------------------------+
|
|
|
-| Return Value :
|
|
|
-+----------------------------------------------------------------------------+
|
|
|
-*/
|
|
|
-
|
|
|
-int i_APCI1710_InsnReadChrono(struct comedi_device *dev, struct comedi_subdevice *s,
|
|
|
- struct comedi_insn *insn, unsigned int *data)
|
|
|
-{
|
|
|
- struct addi_private *devpriv = dev->private;
|
|
|
- unsigned char b_ReadType;
|
|
|
- int i_ReturnValue = insn->n;
|
|
|
-
|
|
|
- b_ReadType = CR_CHAN(insn->chanspec);
|
|
|
-
|
|
|
- switch (b_ReadType) {
|
|
|
- case APCI1710_CHRONO_PROGRESS_STATUS:
|
|
|
- i_ReturnValue = i_APCI1710_GetChronoProgressStatus(dev,
|
|
|
- (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
|
|
|
- break;
|
|
|
-
|
|
|
- case APCI1710_CHRONO_READVALUE:
|
|
|
- i_ReturnValue = i_APCI1710_ReadChronoValue(dev,
|
|
|
- (unsigned char) CR_AREF(insn->chanspec),
|
|
|
- (unsigned int) insn->unused[0],
|
|
|
- (unsigned char *) &data[0], (unsigned int *) &data[1]);
|
|
|
- break;
|
|
|
-
|
|
|
- case APCI1710_CHRONO_CONVERTVALUE:
|
|
|
- i_ReturnValue = i_APCI1710_ConvertChronoValue(dev,
|
|
|
- (unsigned char) CR_AREF(insn->chanspec),
|
|
|
- (unsigned int) insn->unused[0],
|
|
|
- (unsigned int *) &data[0],
|
|
|
- (unsigned char *) &data[1],
|
|
|
- (unsigned char *) &data[2],
|
|
|
- (unsigned int *) &data[3],
|
|
|
- (unsigned int *) &data[4], (unsigned int *) &data[5]);
|
|
|
- break;
|
|
|
-
|
|
|
- case APCI1710_CHRONO_READINTERRUPT:
|
|
|
- printk("In Chrono Read Interrupt\n");
|
|
|
-
|
|
|
- data[0] = devpriv->s_InterruptParameters.
|
|
|
- s_FIFOInterruptParameters[devpriv->
|
|
|
- s_InterruptParameters.ui_Read].b_OldModuleMask;
|
|
|
- data[1] = devpriv->s_InterruptParameters.
|
|
|
- s_FIFOInterruptParameters[devpriv->
|
|
|
- s_InterruptParameters.ui_Read].ul_OldInterruptMask;
|
|
|
- data[2] = devpriv->s_InterruptParameters.
|
|
|
- s_FIFOInterruptParameters[devpriv->
|
|
|
- s_InterruptParameters.ui_Read].ul_OldCounterLatchValue;
|
|
|
-
|
|
|
- /**************************/
|
|
|
- /* Increment the read FIFO */
|
|
|
- /***************************/
|
|
|
-
|
|
|
- devpriv->
|
|
|
- s_InterruptParameters.
|
|
|
- ui_Read = (devpriv->
|
|
|
- s_InterruptParameters.
|
|
|
- ui_Read + 1) % APCI1710_SAVE_INTERRUPT;
|
|
|
- break;
|
|
|
-
|
|
|
- default:
|
|
|
- printk("ReadType Parameter wrong\n");
|
|
|
- }
|
|
|
-
|
|
|
- if (i_ReturnValue >= 0)
|
|
|
- i_ReturnValue = insn->n;
|
|
|
- return i_ReturnValue;
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
/*
|
|
|
+----------------------------------------------------------------------------+
|
|
|
| Function Name : _INT_ i_APCI1710_GetChronoProgressStatus |
|
|
@@ -1196,9 +1116,9 @@ int i_APCI1710_InsnReadChrono(struct comedi_device *dev, struct comedi_subdevice
|
|
|
| "i_APCI1710_InitChrono" |
|
|
|
+----------------------------------------------------------------------------+
|
|
|
*/
|
|
|
-
|
|
|
-int i_APCI1710_GetChronoProgressStatus(struct comedi_device *dev,
|
|
|
- unsigned char b_ModulNbr, unsigned char *pb_ChronoStatus)
|
|
|
+static int i_APCI1710_GetChronoProgressStatus(struct comedi_device *dev,
|
|
|
+ unsigned char b_ModulNbr,
|
|
|
+ unsigned char *pb_ChronoStatus)
|
|
|
{
|
|
|
struct addi_private *devpriv = dev->private;
|
|
|
int i_ReturnValue = 0;
|
|
@@ -1358,10 +1278,11 @@ int i_APCI1710_GetChronoProgressStatus(struct comedi_device *dev,
|
|
|
| directly the chronometer measured timing. |
|
|
|
+----------------------------------------------------------------------------+
|
|
|
*/
|
|
|
-
|
|
|
-int i_APCI1710_ReadChronoValue(struct comedi_device *dev,
|
|
|
- unsigned char b_ModulNbr,
|
|
|
- unsigned int ui_TimeOut, unsigned char *pb_ChronoStatus, unsigned int *pul_ChronoValue)
|
|
|
+static int i_APCI1710_ReadChronoValue(struct comedi_device *dev,
|
|
|
+ unsigned char b_ModulNbr,
|
|
|
+ unsigned int ui_TimeOut,
|
|
|
+ unsigned char *pb_ChronoStatus,
|
|
|
+ unsigned int *pul_ChronoValue)
|
|
|
{
|
|
|
struct addi_private *devpriv = dev->private;
|
|
|
int i_ReturnValue = 0;
|
|
@@ -1622,14 +1543,15 @@ int i_APCI1710_ReadChronoValue(struct comedi_device *dev,
|
|
|
| "i_APCI1710_InitChrono" |
|
|
|
+----------------------------------------------------------------------------+
|
|
|
*/
|
|
|
-
|
|
|
-int i_APCI1710_ConvertChronoValue(struct comedi_device *dev,
|
|
|
- unsigned char b_ModulNbr,
|
|
|
- unsigned int ul_ChronoValue,
|
|
|
- unsigned int *pul_Hour,
|
|
|
- unsigned char *pb_Minute,
|
|
|
- unsigned char *pb_Second,
|
|
|
- unsigned int *pui_MilliSecond, unsigned int *pui_MicroSecond, unsigned int *pui_NanoSecond)
|
|
|
+static int i_APCI1710_ConvertChronoValue(struct comedi_device *dev,
|
|
|
+ unsigned char b_ModulNbr,
|
|
|
+ unsigned int ul_ChronoValue,
|
|
|
+ unsigned int *pul_Hour,
|
|
|
+ unsigned char *pb_Minute,
|
|
|
+ unsigned char *pb_Second,
|
|
|
+ unsigned int *pui_MilliSecond,
|
|
|
+ unsigned int *pui_MicroSecond,
|
|
|
+ unsigned int *pui_NanoSecond)
|
|
|
{
|
|
|
struct addi_private *devpriv = dev->private;
|
|
|
int i_ReturnValue = 0;
|
|
@@ -1760,6 +1682,89 @@ int i_APCI1710_ConvertChronoValue(struct comedi_device *dev,
|
|
|
return i_ReturnValue;
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
++----------------------------------------------------------------------------+
|
|
|
+| Function Name :INT i_APCI1710_InsnReadChrono(struct comedi_device *dev,struct comedi_subdevice *s,
|
|
|
+struct comedi_insn *insn,unsigned int *data) |
|
|
|
++----------------------------------------------------------------------------+
|
|
|
+| Task : Read functions for Timer |
|
|
|
++----------------------------------------------------------------------------+
|
|
|
+| Input Parameters :
|
|
|
++----------------------------------------------------------------------------+
|
|
|
+| Output Parameters : - |
|
|
|
++----------------------------------------------------------------------------+
|
|
|
+| Return Value :
|
|
|
++----------------------------------------------------------------------------+
|
|
|
+*/
|
|
|
+static int i_APCI1710_InsnReadChrono(struct comedi_device *dev,
|
|
|
+ struct comedi_subdevice *s,
|
|
|
+ struct comedi_insn *insn,
|
|
|
+ unsigned int *data)
|
|
|
+{
|
|
|
+ struct addi_private *devpriv = dev->private;
|
|
|
+ unsigned char b_ReadType;
|
|
|
+ int i_ReturnValue = insn->n;
|
|
|
+
|
|
|
+ b_ReadType = CR_CHAN(insn->chanspec);
|
|
|
+
|
|
|
+ switch (b_ReadType) {
|
|
|
+ case APCI1710_CHRONO_PROGRESS_STATUS:
|
|
|
+ i_ReturnValue = i_APCI1710_GetChronoProgressStatus(dev,
|
|
|
+ (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case APCI1710_CHRONO_READVALUE:
|
|
|
+ i_ReturnValue = i_APCI1710_ReadChronoValue(dev,
|
|
|
+ (unsigned char) CR_AREF(insn->chanspec),
|
|
|
+ (unsigned int) insn->unused[0],
|
|
|
+ (unsigned char *) &data[0], (unsigned int *) &data[1]);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case APCI1710_CHRONO_CONVERTVALUE:
|
|
|
+ i_ReturnValue = i_APCI1710_ConvertChronoValue(dev,
|
|
|
+ (unsigned char) CR_AREF(insn->chanspec),
|
|
|
+ (unsigned int) insn->unused[0],
|
|
|
+ (unsigned int *) &data[0],
|
|
|
+ (unsigned char *) &data[1],
|
|
|
+ (unsigned char *) &data[2],
|
|
|
+ (unsigned int *) &data[3],
|
|
|
+ (unsigned int *) &data[4], (unsigned int *) &data[5]);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case APCI1710_CHRONO_READINTERRUPT:
|
|
|
+ printk("In Chrono Read Interrupt\n");
|
|
|
+
|
|
|
+ data[0] = devpriv->s_InterruptParameters.
|
|
|
+ s_FIFOInterruptParameters[devpriv->
|
|
|
+ s_InterruptParameters.ui_Read].b_OldModuleMask;
|
|
|
+ data[1] = devpriv->s_InterruptParameters.
|
|
|
+ s_FIFOInterruptParameters[devpriv->
|
|
|
+ s_InterruptParameters.ui_Read].ul_OldInterruptMask;
|
|
|
+ data[2] = devpriv->s_InterruptParameters.
|
|
|
+ s_FIFOInterruptParameters[devpriv->
|
|
|
+ s_InterruptParameters.ui_Read].ul_OldCounterLatchValue;
|
|
|
+
|
|
|
+ /**************************/
|
|
|
+ /* Increment the read FIFO */
|
|
|
+ /***************************/
|
|
|
+
|
|
|
+ devpriv->
|
|
|
+ s_InterruptParameters.
|
|
|
+ ui_Read = (devpriv->
|
|
|
+ s_InterruptParameters.
|
|
|
+ ui_Read + 1) % APCI1710_SAVE_INTERRUPT;
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ printk("ReadType Parameter wrong\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (i_ReturnValue >= 0)
|
|
|
+ i_ReturnValue = insn->n;
|
|
|
+ return i_ReturnValue;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
+----------------------------------------------------------------------------+
|
|
|
| Function Name : int i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev,struct comedi_subdevice *s,
|
|
@@ -1880,9 +1885,10 @@ int i_APCI1710_ConvertChronoValue(struct comedi_device *dev,
|
|
|
| "i_APCI1710_InitChrono" |
|
|
|
+----------------------------------------------------------------------------+
|
|
|
*/
|
|
|
-
|
|
|
-int i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev,
|
|
|
- struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
|
|
|
+static int i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev,
|
|
|
+ struct comedi_subdevice *s,
|
|
|
+ struct comedi_insn *insn,
|
|
|
+ unsigned int *data)
|
|
|
{
|
|
|
struct addi_private *devpriv = dev->private;
|
|
|
int i_ReturnValue = 0;
|