Commit 13962d97 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: addi_apci_16xx: remove unnecessary comments

A lot of the comments in hwdrv_apci16xx.c have whitespace damage and
are simply unnecessary. Just remove them to make the code a bit more
readable.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ebea8c69
...@@ -100,7 +100,6 @@ You should also find the complete GPL in the COPYING file accompanying this sour ...@@ -100,7 +100,6 @@ You should also find the complete GPL in the COPYING file accompanying this sour
| -101 : Data size error | | -101 : Data size error |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev, static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, struct comedi_insn *insn,
...@@ -114,97 +113,53 @@ static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev, ...@@ -114,97 +113,53 @@ static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev,
unsigned char b_NumberOfPort = unsigned char b_NumberOfPort =
(unsigned char) (this_board->i_NbrTTLChannel / 8); (unsigned char) (this_board->i_NbrTTLChannel / 8);
/************************/
/* Test the buffer size */ /* Test the buffer size */
/************************/
if (insn->n >= 1) { if (insn->n >= 1) {
/*******************/
/* Get the command */ /* Get the command */
/* **************** */
b_Command = (unsigned char) data[0]; b_Command = (unsigned char) data[0];
/********************/
/* Test the command */ /* Test the command */
/********************/
if ((b_Command == APCI16XX_TTL_INIT) || if ((b_Command == APCI16XX_TTL_INIT) ||
(b_Command == APCI16XX_TTL_INITDIRECTION) || (b_Command == APCI16XX_TTL_INITDIRECTION) ||
(b_Command == APCI16XX_TTL_OUTPUTMEMORY)) { (b_Command == APCI16XX_TTL_OUTPUTMEMORY)) {
/***************************************/
/* Test the initialisation buffer size */ /* Test the initialisation buffer size */
/***************************************/
if ((b_Command == APCI16XX_TTL_INITDIRECTION) if ((b_Command == APCI16XX_TTL_INITDIRECTION)
&& ((unsigned char) (insn->n - 1) != b_NumberOfPort)) { && ((unsigned char) (insn->n - 1) != b_NumberOfPort)) {
/*******************/
/* Data size error */
/*******************/
printk("\nBuffer size error"); printk("\nBuffer size error");
i_ReturnValue = -101; i_ReturnValue = -101;
} }
if ((b_Command == APCI16XX_TTL_OUTPUTMEMORY) if ((b_Command == APCI16XX_TTL_OUTPUTMEMORY)
&& ((unsigned char) (insn->n) != 2)) { && ((unsigned char) (insn->n) != 2)) {
/*******************/
/* Data size error */
/*******************/
printk("\nBuffer size error"); printk("\nBuffer size error");
i_ReturnValue = -101; i_ReturnValue = -101;
} }
} else { } else {
/************************/
/* Config command error */
/************************/
printk("\nCommand selection error"); printk("\nCommand selection error");
i_ReturnValue = -100; i_ReturnValue = -100;
} }
} else { } else {
/*******************/
/* Data size error */
/*******************/
printk("\nBuffer size error"); printk("\nBuffer size error");
i_ReturnValue = -101; i_ReturnValue = -101;
} }
/**************************************************************************/
/* Test if no error occur and APCI16XX_TTL_INITDIRECTION command selected */ /* Test if no error occur and APCI16XX_TTL_INITDIRECTION command selected */
/**************************************************************************/
if ((i_ReturnValue >= 0) && (b_Command == APCI16XX_TTL_INITDIRECTION)) { if ((i_ReturnValue >= 0) && (b_Command == APCI16XX_TTL_INITDIRECTION)) {
memset(devpriv->ul_TTLPortConfiguration, 0, memset(devpriv->ul_TTLPortConfiguration, 0,
sizeof(devpriv->ul_TTLPortConfiguration)); sizeof(devpriv->ul_TTLPortConfiguration));
/*************************************/
/* Test the port direction selection */ /* Test the port direction selection */
/*************************************/
for (b_Cpt = 1; for (b_Cpt = 1;
(b_Cpt <= b_NumberOfPort) && (i_ReturnValue >= 0); (b_Cpt <= b_NumberOfPort) && (i_ReturnValue >= 0);
b_Cpt++) { b_Cpt++) {
/**********************/
/* Test the direction */ /* Test the direction */
/**********************/
if ((data[b_Cpt] != 0) && (data[b_Cpt] != 0xFF)) { if ((data[b_Cpt] != 0) && (data[b_Cpt] != 0xFF)) {
/************************/
/* Port direction error */
/************************/
printk("\nPort %d direction selection error", printk("\nPort %d direction selection error",
(int) b_Cpt); (int) b_Cpt);
i_ReturnValue = -(int) b_Cpt; i_ReturnValue = -(int) b_Cpt;
} }
/**************************/
/* Save the configuration */ /* Save the configuration */
/**************************/
devpriv->ul_TTLPortConfiguration[(b_Cpt - 1) / 4] = devpriv->ul_TTLPortConfiguration[(b_Cpt - 1) / 4] =
devpriv->ul_TTLPortConfiguration[(b_Cpt - devpriv->ul_TTLPortConfiguration[(b_Cpt -
1) / 4] | (data[b_Cpt] << (8 * ((b_Cpt - 1) / 4] | (data[b_Cpt] << (8 * ((b_Cpt -
...@@ -212,27 +167,15 @@ static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev, ...@@ -212,27 +167,15 @@ static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev,
} }
} }
/**************************/
/* Test if no error occur */ /* Test if no error occur */
/**************************/
if (i_ReturnValue >= 0) { if (i_ReturnValue >= 0) {
/***********************************/
/* Test if TTL port initilaisation */ /* Test if TTL port initilaisation */
/***********************************/
if ((b_Command == APCI16XX_TTL_INIT) if ((b_Command == APCI16XX_TTL_INIT)
|| (b_Command == APCI16XX_TTL_INITDIRECTION)) { || (b_Command == APCI16XX_TTL_INITDIRECTION)) {
/******************************/
/* Set all port configuration */ /* Set all port configuration */
/******************************/
for (b_Cpt = 0; b_Cpt <= b_NumberOfPort; b_Cpt++) { for (b_Cpt = 0; b_Cpt <= b_NumberOfPort; b_Cpt++) {
if ((b_Cpt % 4) == 0) { if ((b_Cpt % 4) == 0) {
/*************************/
/* Set the configuration */ /* Set the configuration */
/*************************/
outl(devpriv-> outl(devpriv->
ul_TTLPortConfiguration[b_Cpt / ul_TTLPortConfiguration[b_Cpt /
4], 4],
...@@ -242,10 +185,7 @@ static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev, ...@@ -242,10 +185,7 @@ static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev,
} }
} }
/************************************************/
/* Test if output memory initialisation command */ /* Test if output memory initialisation command */
/************************************************/
if (b_Command == APCI16XX_TTL_OUTPUTMEMORY) { if (b_Command == APCI16XX_TTL_OUTPUTMEMORY) {
if (data[1]) { if (data[1]) {
devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE; devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE;
...@@ -257,12 +197,6 @@ static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev, ...@@ -257,12 +197,6 @@ static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev,
return i_ReturnValue; return i_ReturnValue;
} }
/*
+----------------------------------------------------------------------------+
| INPUT FUNCTIONS |
+----------------------------------------------------------------------------+
*/
/* /*
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
| Function Name : int i_APCI16XX_InsnBitsReadTTLIO | | Function Name : int i_APCI16XX_InsnBitsReadTTLIO |
...@@ -297,7 +231,6 @@ static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev, ...@@ -297,7 +231,6 @@ static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev,
| -103 : The selected TTL digital input is wrong | | -103 : The selected TTL digital input is wrong |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev, static int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, struct comedi_insn *insn,
...@@ -314,32 +247,17 @@ static int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev, ...@@ -314,32 +247,17 @@ static int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev,
unsigned char *pb_Status; unsigned char *pb_Status;
unsigned int dw_Status; unsigned int dw_Status;
/************************/
/* Test the buffer size */ /* Test the buffer size */
/************************/
if (insn->n >= 1) { if (insn->n >= 1) {
/*******************/
/* Get the command */ /* Get the command */
/* **************** */
b_Command = (unsigned char) data[0]; b_Command = (unsigned char) data[0];
/********************/
/* Test the command */ /* Test the command */
/********************/
if ((b_Command == APCI16XX_TTL_READCHANNEL) if ((b_Command == APCI16XX_TTL_READCHANNEL)
|| (b_Command == APCI16XX_TTL_READPORT)) { || (b_Command == APCI16XX_TTL_READPORT)) {
/**************************/
/* Test the selected port */ /* Test the selected port */
/**************************/
if (b_SelectedPort < b_NumberOfPort) { if (b_SelectedPort < b_NumberOfPort) {
/**********************/
/* Test if input port */ /* Test if input port */
/**********************/
if (((devpriv->ul_TTLPortConfiguration if (((devpriv->ul_TTLPortConfiguration
[b_SelectedPort / [b_SelectedPort /
4] >> (8 * 4] >> (8 *
...@@ -347,78 +265,43 @@ static int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev, ...@@ -347,78 +265,43 @@ static int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev,
% %
4))) & 4))) &
0xFF) == 0) { 0xFF) == 0) {
/***************************/
/* Test the channel number */ /* Test the channel number */
/***************************/
if ((b_Command == if ((b_Command ==
APCI16XX_TTL_READCHANNEL) APCI16XX_TTL_READCHANNEL)
&& (b_InputChannel > 7)) { && (b_InputChannel > 7)) {
/*******************************************/
/* The selected TTL digital input is wrong */
/*******************************************/
printk("\nChannel selection error"); printk("\nChannel selection error");
i_ReturnValue = -103; i_ReturnValue = -103;
} }
} else { } else {
/****************************************/
/* The selected TTL input port is wrong */
/****************************************/
printk("\nPort selection error"); printk("\nPort selection error");
i_ReturnValue = -102; i_ReturnValue = -102;
} }
} else { } else {
/****************************************/
/* The selected TTL input port is wrong */
/****************************************/
printk("\nPort selection error"); printk("\nPort selection error");
i_ReturnValue = -102; i_ReturnValue = -102;
} }
} else { } else {
/************************/
/* Config command error */
/************************/
printk("\nCommand selection error"); printk("\nCommand selection error");
i_ReturnValue = -100; i_ReturnValue = -100;
} }
} else { } else {
/*******************/
/* Data size error */
/*******************/
printk("\nBuffer size error"); printk("\nBuffer size error");
i_ReturnValue = -101; i_ReturnValue = -101;
} }
/**************************/
/* Test if no error occur */ /* Test if no error occur */
/**************************/
if (i_ReturnValue >= 0) { if (i_ReturnValue >= 0) {
pb_Status = (unsigned char *) &data[0]; pb_Status = (unsigned char *) &data[0];
/*******************************/
/* Get the digital inpu status */ /* Get the digital inpu status */
/*******************************/
dw_Status = dw_Status =
inl(devpriv->iobase + 8 + ((b_SelectedPort / 4) * 4)); inl(devpriv->iobase + 8 + ((b_SelectedPort / 4) * 4));
dw_Status = (dw_Status >> (8 * (b_SelectedPort % 4))) & 0xFF; dw_Status = (dw_Status >> (8 * (b_SelectedPort % 4))) & 0xFF;
/***********************/
/* Save the port value */ /* Save the port value */
/***********************/
*pb_Status = (unsigned char) dw_Status; *pb_Status = (unsigned char) dw_Status;
/***************************************/
/* Test if read channel status command */ /* Test if read channel status command */
/***************************************/
if (b_Command == APCI16XX_TTL_READCHANNEL) { if (b_Command == APCI16XX_TTL_READCHANNEL) {
*pb_Status = (*pb_Status >> b_InputChannel) & 1; *pb_Status = (*pb_Status >> b_InputChannel) & 1;
} }
...@@ -448,7 +331,6 @@ static int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev, ...@@ -448,7 +331,6 @@ static int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev,
| -101 : Data size error | | -101 : Data size error |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev, static int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, struct comedi_insn *insn,
...@@ -462,16 +344,10 @@ static int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev, ...@@ -462,16 +344,10 @@ static int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev,
unsigned char b_NumberOfPort = 0; unsigned char b_NumberOfPort = 0;
unsigned int *pls_ReadData = data; unsigned int *pls_ReadData = data;
/********************/
/* Test the command */ /* Test the command */
/********************/
if ((b_Command == APCI16XX_TTL_READ_ALL_INPUTS) if ((b_Command == APCI16XX_TTL_READ_ALL_INPUTS)
|| (b_Command == APCI16XX_TTL_READ_ALL_OUTPUTS)) { || (b_Command == APCI16XX_TTL_READ_ALL_OUTPUTS)) {
/**********************************/
/* Get the number of 32-Bit ports */ /* Get the number of 32-Bit ports */
/**********************************/
b_NumberOfPort = b_NumberOfPort =
(unsigned char) (this_board->i_NbrTTLChannel / 32); (unsigned char) (this_board->i_NbrTTLChannel / 32);
if ((b_NumberOfPort * 32) < if ((b_NumberOfPort * 32) <
...@@ -479,70 +355,41 @@ static int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev, ...@@ -479,70 +355,41 @@ static int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev,
b_NumberOfPort = b_NumberOfPort + 1; b_NumberOfPort = b_NumberOfPort + 1;
} }
/************************/
/* Test the buffer size */ /* Test the buffer size */
/************************/
if (insn->n >= b_NumberOfPort) { if (insn->n >= b_NumberOfPort) {
if (b_Command == APCI16XX_TTL_READ_ALL_INPUTS) { if (b_Command == APCI16XX_TTL_READ_ALL_INPUTS) {
/**************************/
/* Read all digital input */ /* Read all digital input */
/**************************/
for (b_Cpt = 0; b_Cpt < b_NumberOfPort; b_Cpt++) { for (b_Cpt = 0; b_Cpt < b_NumberOfPort; b_Cpt++) {
/************************/
/* Read the 32-Bit port */ /* Read the 32-Bit port */
/************************/
pls_ReadData[b_Cpt] = pls_ReadData[b_Cpt] =
inl(devpriv->iobase + 8 + inl(devpriv->iobase + 8 +
(b_Cpt * 4)); (b_Cpt * 4));
/**************************************/
/* Mask all channels used als outputs */ /* Mask all channels used als outputs */
/**************************************/
pls_ReadData[b_Cpt] = pls_ReadData[b_Cpt] =
pls_ReadData[b_Cpt] & pls_ReadData[b_Cpt] &
(~devpriv-> (~devpriv->
ul_TTLPortConfiguration[b_Cpt]); ul_TTLPortConfiguration[b_Cpt]);
} }
} else { } else {
/****************************/
/* Read all digital outputs */ /* Read all digital outputs */
/****************************/
for (b_Cpt = 0; b_Cpt < b_NumberOfPort; b_Cpt++) { for (b_Cpt = 0; b_Cpt < b_NumberOfPort; b_Cpt++) {
/************************/
/* Read the 32-Bit port */ /* Read the 32-Bit port */
/************************/
pls_ReadData[b_Cpt] = pls_ReadData[b_Cpt] =
inl(devpriv->iobase + 20 + inl(devpriv->iobase + 20 +
(b_Cpt * 4)); (b_Cpt * 4));
/**************************************/
/* Mask all channels used als outputs */ /* Mask all channels used als outputs */
/**************************************/
pls_ReadData[b_Cpt] = pls_ReadData[b_Cpt] =
pls_ReadData[b_Cpt] & devpriv-> pls_ReadData[b_Cpt] & devpriv->
ul_TTLPortConfiguration[b_Cpt]; ul_TTLPortConfiguration[b_Cpt];
} }
} }
} else { } else {
/*******************/
/* Data size error */
/*******************/
printk("\nBuffer size error"); printk("\nBuffer size error");
i_ReturnValue = -101; i_ReturnValue = -101;
} }
} else { } else {
/*****************/
/* Command error */
/*****************/
printk("\nCommand selection error"); printk("\nCommand selection error");
i_ReturnValue = -100; i_ReturnValue = -100;
} }
...@@ -550,12 +397,6 @@ static int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev, ...@@ -550,12 +397,6 @@ static int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev,
return i_ReturnValue; return i_ReturnValue;
} }
/*
+----------------------------------------------------------------------------+
| OUTPUT FUNCTIONS |
+----------------------------------------------------------------------------+
*/
/* /*
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
| Function Name : int i_APCI16XX_InsnBitsWriteTTLIO | | Function Name : int i_APCI16XX_InsnBitsWriteTTLIO |
...@@ -592,7 +433,6 @@ static int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev, ...@@ -592,7 +433,6 @@ static int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev,
| -104 : Output memory disabled | | -104 : Output memory disabled |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device *dev, static int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, struct comedi_insn *insn,
...@@ -608,34 +448,19 @@ static int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device *dev, ...@@ -608,34 +448,19 @@ static int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device *dev,
unsigned char b_OutputChannel = CR_CHAN(insn->chanspec); unsigned char b_OutputChannel = CR_CHAN(insn->chanspec);
unsigned int dw_Status = 0; unsigned int dw_Status = 0;
/************************/
/* Test the buffer size */ /* Test the buffer size */
/************************/
if (insn->n >= 1) { if (insn->n >= 1) {
/*******************/
/* Get the command */ /* Get the command */
/* **************** */
b_Command = (unsigned char) data[0]; b_Command = (unsigned char) data[0];
/********************/
/* Test the command */ /* Test the command */
/********************/
if ((b_Command == APCI16XX_TTL_WRITECHANNEL_ON) || if ((b_Command == APCI16XX_TTL_WRITECHANNEL_ON) ||
(b_Command == APCI16XX_TTL_WRITEPORT_ON) || (b_Command == APCI16XX_TTL_WRITEPORT_ON) ||
(b_Command == APCI16XX_TTL_WRITECHANNEL_OFF) || (b_Command == APCI16XX_TTL_WRITECHANNEL_OFF) ||
(b_Command == APCI16XX_TTL_WRITEPORT_OFF)) { (b_Command == APCI16XX_TTL_WRITEPORT_OFF)) {
/**************************/
/* Test the selected port */ /* Test the selected port */
/**************************/
if (b_SelectedPort < b_NumberOfPort) { if (b_SelectedPort < b_NumberOfPort) {
/***********************/
/* Test if output port */ /* Test if output port */
/***********************/
if (((devpriv->ul_TTLPortConfiguration if (((devpriv->ul_TTLPortConfiguration
[b_SelectedPort / [b_SelectedPort /
4] >> (8 * 4] >> (8 *
...@@ -643,126 +468,71 @@ static int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device *dev, ...@@ -643,126 +468,71 @@ static int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device *dev,
% %
4))) & 4))) &
0xFF) == 0xFF) { 0xFF) == 0xFF) {
/***************************/
/* Test the channel number */ /* Test the channel number */
/***************************/
if (((b_Command == APCI16XX_TTL_WRITECHANNEL_ON) || (b_Command == APCI16XX_TTL_WRITECHANNEL_OFF)) && (b_OutputChannel > 7)) { if (((b_Command == APCI16XX_TTL_WRITECHANNEL_ON) || (b_Command == APCI16XX_TTL_WRITECHANNEL_OFF)) && (b_OutputChannel > 7)) {
/********************************************/
/* The selected TTL digital output is wrong */
/********************************************/
printk("\nChannel selection error"); printk("\nChannel selection error");
i_ReturnValue = -103; i_ReturnValue = -103;
} }
if (((b_Command == APCI16XX_TTL_WRITECHANNEL_OFF) || (b_Command == APCI16XX_TTL_WRITEPORT_OFF)) && (devpriv->b_OutputMemoryStatus == ADDIDATA_DISABLE)) { if (((b_Command == APCI16XX_TTL_WRITECHANNEL_OFF) || (b_Command == APCI16XX_TTL_WRITEPORT_OFF)) && (devpriv->b_OutputMemoryStatus == ADDIDATA_DISABLE)) {
/********************************************/
/* The selected TTL digital output is wrong */
/********************************************/
printk("\nOutput memory disabled"); printk("\nOutput memory disabled");
i_ReturnValue = -104; i_ReturnValue = -104;
} }
/************************/
/* Test the buffer size */ /* Test the buffer size */
/************************/
if (((b_Command == APCI16XX_TTL_WRITEPORT_ON) || (b_Command == APCI16XX_TTL_WRITEPORT_OFF)) && (insn->n < 2)) { if (((b_Command == APCI16XX_TTL_WRITEPORT_ON) || (b_Command == APCI16XX_TTL_WRITEPORT_OFF)) && (insn->n < 2)) {
/*******************/
/* Data size error */
/*******************/
printk("\nBuffer size error"); printk("\nBuffer size error");
i_ReturnValue = -101; i_ReturnValue = -101;
} }
} else { } else {
/*****************************************/
/* The selected TTL output port is wrong */
/*****************************************/
printk("\nPort selection error %lX", printk("\nPort selection error %lX",
(unsigned long)devpriv-> (unsigned long)devpriv->
ul_TTLPortConfiguration[0]); ul_TTLPortConfiguration[0]);
i_ReturnValue = -102; i_ReturnValue = -102;
} }
} else { } else {
/****************************************/
/* The selected TTL output port is wrong */
/****************************************/
printk("\nPort selection error %d %d", printk("\nPort selection error %d %d",
b_SelectedPort, b_NumberOfPort); b_SelectedPort, b_NumberOfPort);
i_ReturnValue = -102; i_ReturnValue = -102;
} }
} else { } else {
/************************/
/* Config command error */
/************************/
printk("\nCommand selection error"); printk("\nCommand selection error");
i_ReturnValue = -100; i_ReturnValue = -100;
} }
} else { } else {
/*******************/
/* Data size error */
/*******************/
printk("\nBuffer size error"); printk("\nBuffer size error");
i_ReturnValue = -101; i_ReturnValue = -101;
} }
/**************************/
/* Test if no error occur */ /* Test if no error occur */
/**************************/
if (i_ReturnValue >= 0) { if (i_ReturnValue >= 0) {
/********************************/
/* Get the digital output state */ /* Get the digital output state */
/********************************/
dw_Status = dw_Status =
inl(devpriv->iobase + 20 + ((b_SelectedPort / 4) * 4)); inl(devpriv->iobase + 20 + ((b_SelectedPort / 4) * 4));
/**********************************/
/* Test if output memory not used */ /* Test if output memory not used */
/**********************************/
if (devpriv->b_OutputMemoryStatus == ADDIDATA_DISABLE) { if (devpriv->b_OutputMemoryStatus == ADDIDATA_DISABLE) {
/*********************************/
/* Clear the selected port value */ /* Clear the selected port value */
/*********************************/
dw_Status = dw_Status =
dw_Status & (0xFFFFFFFFUL - dw_Status & (0xFFFFFFFFUL -
(0xFFUL << (8 * (b_SelectedPort % 4)))); (0xFFUL << (8 * (b_SelectedPort % 4))));
} }
/******************************/
/* Test if setting channel ON */ /* Test if setting channel ON */
/******************************/
if (b_Command == APCI16XX_TTL_WRITECHANNEL_ON) { if (b_Command == APCI16XX_TTL_WRITECHANNEL_ON) {
dw_Status = dw_Status =
dw_Status | (1UL << ((8 * (b_SelectedPort % dw_Status | (1UL << ((8 * (b_SelectedPort %
4)) + b_OutputChannel)); 4)) + b_OutputChannel));
} }
/***************************/
/* Test if setting port ON */ /* Test if setting port ON */
/***************************/
if (b_Command == APCI16XX_TTL_WRITEPORT_ON) { if (b_Command == APCI16XX_TTL_WRITEPORT_ON) {
dw_Status = dw_Status =
dw_Status | ((data[1] & 0xFF) << (8 * dw_Status | ((data[1] & 0xFF) << (8 *
(b_SelectedPort % 4))); (b_SelectedPort % 4)));
} }
/*******************************/
/* Test if setting channel OFF */ /* Test if setting channel OFF */
/*******************************/
if (b_Command == APCI16XX_TTL_WRITECHANNEL_OFF) { if (b_Command == APCI16XX_TTL_WRITECHANNEL_OFF) {
dw_Status = dw_Status =
dw_Status & (0xFFFFFFFFUL - dw_Status & (0xFFFFFFFFUL -
...@@ -770,10 +540,7 @@ static int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device *dev, ...@@ -770,10 +540,7 @@ static int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device *dev,
b_OutputChannel))); b_OutputChannel)));
} }
/****************************/
/* Test if setting port OFF */ /* Test if setting port OFF */
/****************************/
if (b_Command == APCI16XX_TTL_WRITEPORT_OFF) { if (b_Command == APCI16XX_TTL_WRITEPORT_OFF) {
dw_Status = dw_Status =
dw_Status & (0xFFFFFFFFUL - dw_Status & (0xFFFFFFFFUL -
......
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