Commit c9847a6e authored by Conrad Meyer's avatar Conrad Meyer Committed by Greg Kroah-Hartman

Staging: comedi: Kill comment art in hwdrv_apci1500.c

Nudge the commenting in this mess a little further from 'bad.' Much of
it was incorrectly indented.

Another sed cleanup:
  $ sed -i -e '/\/\*\*\*\*\*\*\*\*\**\//,1d' addi-data/hwdrv_apci1500.c
Signed-off-by: default avatarConrad Meyer <cse.cem@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d0ba1e38
...@@ -241,14 +241,10 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, ...@@ -241,14 +241,10 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev,
int i_PatternTransitionCount = 0, i_RegValue; int i_PatternTransitionCount = 0, i_RegValue;
int i; int i;
/*************************************************/
/* Selects the master interrupt control register */ /* Selects the master interrupt control register */
/*************************************************/
outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL, outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/**********************************************/
/* Disables the main interrupt on the board */ /* Disables the main interrupt on the board */
/**********************************************/
outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
if (data[0] == 1) { if (data[0] == 1) {
...@@ -327,17 +323,13 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, ...@@ -327,17 +323,13 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev,
} /* for (i_Count = i_MaxChannel; i_Count >0;i_Count --) */ } /* for (i_Count = i_MaxChannel; i_Count >0;i_Count --) */
if (data[0] == 1) { if (data[0] == 1) {
/****************************/
/* Test the interrupt logic */ /* Test the interrupt logic */
/****************************/
if (data[1] == APCI1500_AND || if (data[1] == APCI1500_AND ||
data[1] == APCI1500_OR || data[1] == APCI1500_OR ||
data[1] == APCI1500_OR_PRIORITY) { data[1] == APCI1500_OR_PRIORITY) {
/**************************************/
/* Tests if a transition was declared */ /* Tests if a transition was declared */
/* for a OR PRIORITY logic */ /* for a OR PRIORITY logic */
/**************************************/
if (data[1] == APCI1500_OR_PRIORITY if (data[1] == APCI1500_OR_PRIORITY
&& i_PatternTransition != 0) { && i_PatternTransition != 0) {
...@@ -346,10 +338,8 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, ...@@ -346,10 +338,8 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev,
return -EINVAL; return -EINVAL;
} /* if (data[1]== APCI1500_OR_PRIORITY && i_PatternTransition != 0) */ } /* if (data[1]== APCI1500_OR_PRIORITY && i_PatternTransition != 0) */
/*************************************/
/* Tests if more than one transition */ /* Tests if more than one transition */
/* was declared for an AND logic */ /* was declared for an AND logic */
/*************************************/
if (data[1] == APCI1500_AND) { if (data[1] == APCI1500_AND) {
for (i_Count = 0; i_Count < 8; i_Count++) { for (i_Count = 0; i_Count < 8; i_Count++) {
...@@ -367,21 +357,15 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, ...@@ -367,21 +357,15 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev,
} /* if (i_PatternTransitionCount > 1) */ } /* if (i_PatternTransitionCount > 1) */
} /* if (data[1]== APCI1500_AND) */ } /* if (data[1]== APCI1500_AND) */
/*****************************************************************/
/* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */ /* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */
/*****************************************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/******************/
/* Disable Port A */ /* Disable Port A */
/******************/
outb(0xF0, outb(0xF0,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/**********************************************/
/* Selects the polarity register of port 1 */ /* Selects the polarity register of port 1 */
/**********************************************/
outb(APCI1500_RW_PORT_A_PATTERN_POLARITY, outb(APCI1500_RW_PORT_A_PATTERN_POLARITY,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -389,20 +373,16 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, ...@@ -389,20 +373,16 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/*********************************************/
/* Selects the pattern mask register of */ /* Selects the pattern mask register of */
/* port 1 */ /* port 1 */
/*********************************************/
outb(APCI1500_RW_PORT_A_PATTERN_MASK, outb(APCI1500_RW_PORT_A_PATTERN_MASK,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
outb(i_PatternMask, outb(i_PatternMask,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/********************************************/
/* Selects the pattern transition register */ /* Selects the pattern transition register */
/* of port 1 */ /* of port 1 */
/********************************************/
outb(APCI1500_RW_PORT_A_PATTERN_TRANSITION, outb(APCI1500_RW_PORT_A_PATTERN_TRANSITION,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -410,10 +390,8 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, ...@@ -410,10 +390,8 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/******************************************/
/* Selects the mode specification mask */ /* Selects the mode specification mask */
/* register of port 1 */ /* register of port 1 */
/******************************************/
outb(APCI1500_RW_PORT_A_SPECIFICATION, outb(APCI1500_RW_PORT_A_SPECIFICATION,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -421,17 +399,13 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, ...@@ -421,17 +399,13 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev,
inb(devpriv->iobase + inb(devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/******************************************/
/* Selects the mode specification mask */ /* Selects the mode specification mask */
/* register of port 1 */ /* register of port 1 */
/******************************************/
outb(APCI1500_RW_PORT_A_SPECIFICATION, outb(APCI1500_RW_PORT_A_SPECIFICATION,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/**********************/
/* Port A new mode */ /* Port A new mode */
/**********************/
i_RegValue = (i_RegValue & 0xF9) | data[1] | 0x9; i_RegValue = (i_RegValue & 0xF9) | data[1] | 0x9;
outb(i_RegValue, outb(i_RegValue,
...@@ -440,16 +414,12 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, ...@@ -440,16 +414,12 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev,
i_Event1Status = 1; i_Event1Status = 1;
/*****************************************************************/
/* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */ /* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */
/*****************************************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/*****************/
/* Enable Port A */ /* Enable Port A */
/*****************/
outb(0xF4, outb(0xF4,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -462,32 +432,22 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, ...@@ -462,32 +432,22 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev,
} /* else }// if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY) */ } /* else }// if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY) */
} /* if (data[0]== 1) */ } /* if (data[0]== 1) */
/************************************/
/* Test if event setting for port 2 */ /* Test if event setting for port 2 */
/************************************/
if (data[0] == 2) { if (data[0] == 2) {
/************************/
/* Test the event logic */ /* Test the event logic */
/************************/
if (data[1] == APCI1500_OR) { if (data[1] == APCI1500_OR) {
/*****************************************************************/
/* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */ /* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */
/*****************************************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/******************/
/* Disable Port B */ /* Disable Port B */
/******************/
outb(0x74, outb(0x74,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/****************************************/
/* Selects the mode specification mask */ /* Selects the mode specification mask */
/* register of port B */ /* register of port B */
/****************************************/
outb(APCI1500_RW_PORT_B_SPECIFICATION, outb(APCI1500_RW_PORT_B_SPECIFICATION,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -495,10 +455,8 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, ...@@ -495,10 +455,8 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev,
inb(devpriv->iobase + inb(devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/******************************************/
/* Selects the mode specification mask */ /* Selects the mode specification mask */
/* register of port B */ /* register of port B */
/******************************************/
outb(APCI1500_RW_PORT_B_SPECIFICATION, outb(APCI1500_RW_PORT_B_SPECIFICATION,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -507,37 +465,29 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, ...@@ -507,37 +465,29 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/**********************************/
/* Selects error channels 1 and 2 */ /* Selects error channels 1 and 2 */
/**********************************/
i_PatternMask = (i_PatternMask | 0xC0); i_PatternMask = (i_PatternMask | 0xC0);
i_PatternPolarity = (i_PatternPolarity | 0xC0); i_PatternPolarity = (i_PatternPolarity | 0xC0);
i_PatternTransition = (i_PatternTransition | 0xC0); i_PatternTransition = (i_PatternTransition | 0xC0);
/**********************************************/
/* Selects the polarity register of port 2 */ /* Selects the polarity register of port 2 */
/**********************************************/
outb(APCI1500_RW_PORT_B_PATTERN_POLARITY, outb(APCI1500_RW_PORT_B_PATTERN_POLARITY,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
outb(i_PatternPolarity, outb(i_PatternPolarity,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/**********************************************/
/* Selects the pattern transition register */ /* Selects the pattern transition register */
/* of port 2 */ /* of port 2 */
/**********************************************/
outb(APCI1500_RW_PORT_B_PATTERN_TRANSITION, outb(APCI1500_RW_PORT_B_PATTERN_TRANSITION,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
outb(i_PatternTransition, outb(i_PatternTransition,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/**********************************************/
/* Selects the pattern Mask register */ /* Selects the pattern Mask register */
/* of port 2 */ /* of port 2 */
/**********************************************/
outb(APCI1500_RW_PORT_B_PATTERN_MASK, outb(APCI1500_RW_PORT_B_PATTERN_MASK,
devpriv->iobase + devpriv->iobase +
...@@ -546,20 +496,16 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, ...@@ -546,20 +496,16 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/******************************************/
/* Selects the mode specification mask */ /* Selects the mode specification mask */
/* register of port 2 */ /* register of port 2 */
/******************************************/
outb(APCI1500_RW_PORT_B_SPECIFICATION, outb(APCI1500_RW_PORT_B_SPECIFICATION,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
i_RegValue = i_RegValue =
inb(devpriv->iobase + inb(devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/******************************************/
/* Selects the mode specification mask */ /* Selects the mode specification mask */
/* register of port 2 */ /* register of port 2 */
/******************************************/
outb(APCI1500_RW_PORT_B_SPECIFICATION, outb(APCI1500_RW_PORT_B_SPECIFICATION,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -569,16 +515,12 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, ...@@ -569,16 +515,12 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev,
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
i_Event2Status = 1; i_Event2Status = 1;
/*****************************************************************/
/* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */ /* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */
/*****************************************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/*****************/
/* Enable Port B */ /* Enable Port B */
/*****************/
outb(0xF4, outb(0xF4,
devpriv->iobase + devpriv->iobase +
...@@ -627,48 +569,30 @@ static int i_APCI1500_StartStopInputEvent(struct comedi_device *dev, ...@@ -627,48 +569,30 @@ static int i_APCI1500_StartStopInputEvent(struct comedi_device *dev,
switch (data[0]) { switch (data[0]) {
case START: case START:
/*************************/
/* Tests the port number */ /* Tests the port number */
/*************************/
if (data[1] == 1 || data[1] == 2) { if (data[1] == 1 || data[1] == 2) {
/***************************/
/* Test if port 1 selected */ /* Test if port 1 selected */
/***************************/
if (data[1] == 1) { if (data[1] == 1) {
/*****************************/
/* Test if event initialised */ /* Test if event initialised */
/*****************************/
if (i_Event1Status == 1) { if (i_Event1Status == 1) {
/*****************************************************************/
/* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */ /* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */
/*****************************************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/******************/
/* Disable Port A */ /* Disable Port A */
/******************/
outb(0xF0, outb(0xF0,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***************************************************/
/* Selects the command and status register of */ /* Selects the command and status register of */
/* port 1 */ /* port 1 */
/***************************************************/
outb(APCI1500_RW_PORT_A_COMMAND_AND_STATUS, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(APCI1500_RW_PORT_A_COMMAND_AND_STATUS, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*************************************/
/* Allows the pattern interrupt */ /* Allows the pattern interrupt */
/*************************************/
outb(0xC0, outb(0xC0,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************************/
/* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */ /* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */
/*****************************************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************/
/* Enable Port A */ /* Enable Port A */
/*****************/
outb(0xF4, outb(0xF4,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -681,11 +605,8 @@ static int i_APCI1500_StartStopInputEvent(struct comedi_device *dev, ...@@ -681,11 +605,8 @@ static int i_APCI1500_StartStopInputEvent(struct comedi_device *dev,
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/* Selects the master interrupt control register */ /* Selects the master interrupt control register */
/*************************************************/
outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/**********************************************/
/* Authorizes the main interrupt on the board */ /* Authorizes the main interrupt on the board */
/**********************************************/
outb(0xD0, outb(0xD0,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -700,44 +621,29 @@ static int i_APCI1500_StartStopInputEvent(struct comedi_device *dev, ...@@ -700,44 +621,29 @@ static int i_APCI1500_StartStopInputEvent(struct comedi_device *dev,
if (data[1] == 2) { if (data[1] == 2) {
if (i_Event2Status == 1) { if (i_Event2Status == 1) {
/*****************************************************************/
/* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */ /* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */
/*****************************************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/******************/
/* Disable Port B */ /* Disable Port B */
/******************/
outb(0x74, outb(0x74,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***************************************************/
/* Selects the command and status register of */ /* Selects the command and status register of */
/* port 2 */ /* port 2 */
/***************************************************/
outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*************************************/
/* Allows the pattern interrupt */ /* Allows the pattern interrupt */
/*************************************/
outb(0xC0, outb(0xC0,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************************/
/* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */ /* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */
/*****************************************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************/
/* Enable Port B */ /* Enable Port B */
/*****************/
outb(0xF4, outb(0xF4,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/* Selects the master interrupt control register */ /* Selects the master interrupt control register */
/*************************************************/
outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/**********************************************/
/* Authorizes the main interrupt on the board */ /* Authorizes the main interrupt on the board */
/**********************************************/
outb(0xD0, outb(0xD0,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -759,48 +665,30 @@ static int i_APCI1500_StartStopInputEvent(struct comedi_device *dev, ...@@ -759,48 +665,30 @@ static int i_APCI1500_StartStopInputEvent(struct comedi_device *dev,
break; break;
case STOP: case STOP:
/*************************/
/* Tests the port number */ /* Tests the port number */
/*************************/
if (data[1] == 1 || data[1] == 2) { if (data[1] == 1 || data[1] == 2) {
/***************************/
/* Test if port 1 selected */ /* Test if port 1 selected */
/***************************/
if (data[1] == 1) { if (data[1] == 1) {
/*****************************/
/* Test if event initialised */ /* Test if event initialised */
/*****************************/
if (i_Event1Status == 1) { if (i_Event1Status == 1) {
/*****************************************************************/
/* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */ /* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */
/*****************************************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/******************/
/* Disable Port A */ /* Disable Port A */
/******************/
outb(0xF0, outb(0xF0,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***************************************************/
/* Selects the command and status register of */ /* Selects the command and status register of */
/* port 1 */ /* port 1 */
/***************************************************/
outb(APCI1500_RW_PORT_A_COMMAND_AND_STATUS, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(APCI1500_RW_PORT_A_COMMAND_AND_STATUS, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*************************************/
/* Inhibits the pattern interrupt */ /* Inhibits the pattern interrupt */
/*************************************/
outb(0xE0, outb(0xE0,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************************/
/* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */ /* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */
/*****************************************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************/
/* Enable Port A */ /* Enable Port A */
/*****************/
outb(0xF4, outb(0xF4,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -813,38 +701,24 @@ static int i_APCI1500_StartStopInputEvent(struct comedi_device *dev, ...@@ -813,38 +701,24 @@ static int i_APCI1500_StartStopInputEvent(struct comedi_device *dev,
} /* else if(i_Event1Status==1) */ } /* else if(i_Event1Status==1) */
} /* if (data[1]==1) */ } /* if (data[1]==1) */
if (data[1] == 2) { if (data[1] == 2) {
/*****************************/
/* Test if event initialised */ /* Test if event initialised */
/*****************************/
if (i_Event2Status == 1) { if (i_Event2Status == 1) {
/*****************************************************************/
/* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */ /* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */
/*****************************************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/******************/
/* Disable Port B */ /* Disable Port B */
/******************/
outb(0x74, outb(0x74,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***************************************************/
/* Selects the command and status register of */ /* Selects the command and status register of */
/* port 2 */ /* port 2 */
/***************************************************/
outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*************************************/
/* Inhibits the pattern interrupt */ /* Inhibits the pattern interrupt */
/*************************************/
outb(0xE0, outb(0xE0,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************************/
/* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */ /* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */
/*****************************************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************/
/* Enable Port B */ /* Enable Port B */
/*****************/
outb(0xF4, outb(0xF4,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -900,9 +774,7 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev, ...@@ -900,9 +774,7 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev,
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_DummyRead = 0; int i_DummyRead = 0;
/******************/
/* Software reset */ /* Software reset */
/******************/
i_DummyRead = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_DummyRead = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
i_DummyRead = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_DummyRead = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
...@@ -910,16 +782,12 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev, ...@@ -910,16 +782,12 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev,
outb(1, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(1, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the master configuration control register */ /* Selects the master configuration control register */
/*****************************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(0xF4, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0xF4, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the mode specification register of port A */ /* Selects the mode specification register of port A */
/*****************************************************/
outb(APCI1500_RW_PORT_A_SPECIFICATION, outb(APCI1500_RW_PORT_A_SPECIFICATION,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(0x10, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0x10, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
...@@ -951,9 +819,7 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev, ...@@ -951,9 +819,7 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev,
/* Deletes the register */ /* Deletes the register */
outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the mode specification register of port B */ /* Selects the mode specification register of port B */
/*****************************************************/
outb(APCI1500_RW_PORT_B_SPECIFICATION, outb(APCI1500_RW_PORT_B_SPECIFICATION,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(0x10, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0x10, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
...@@ -983,9 +849,7 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev, ...@@ -983,9 +849,7 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev,
/* Deletes the register */ /* Deletes the register */
outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the data path polarity register of port C */ /* Selects the data path polarity register of port C */
/*****************************************************/
outb(APCI1500_RW_PORT_C_DATA_PCITCH_POLARITY, outb(APCI1500_RW_PORT_C_DATA_PCITCH_POLARITY,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* High level of port C means 1 */ /* High level of port C means 1 */
...@@ -1000,9 +864,7 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev, ...@@ -1000,9 +864,7 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Deletes it */ /* Deletes it */
outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/******************************************************/
/* Selects the command and status register of timer 1 */ /* Selects the command and status register of timer 1 */
/******************************************************/
outb(APCI1500_RW_CPT_TMR1_CMD_STATUS, outb(APCI1500_RW_CPT_TMR1_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Deletes IP and IUS */ /* Deletes IP and IUS */
...@@ -1012,9 +874,7 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev, ...@@ -1012,9 +874,7 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Deactivates the interrupt management of timer 1 */ /* Deactivates the interrupt management of timer 1 */
outb(0xE0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0xE0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/******************************************************/
/* Selects the command and status register of timer 2 */ /* Selects the command and status register of timer 2 */
/******************************************************/
outb(APCI1500_RW_CPT_TMR2_CMD_STATUS, outb(APCI1500_RW_CPT_TMR2_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Deletes IP and IUS */ /* Deletes IP and IUS */
...@@ -1024,9 +884,7 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev, ...@@ -1024,9 +884,7 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Deactivates Timer 2 interrupt management: */ /* Deactivates Timer 2 interrupt management: */
outb(0xE0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0xE0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/******************************************************/
/* Selects the command and status register of timer 3 */ /* Selects the command and status register of timer 3 */
/******************************************************/
outb(APCI1500_RW_CPT_TMR3_CMD_STATUS, outb(APCI1500_RW_CPT_TMR3_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Deletes IP and IUS */ /* Deletes IP and IUS */
...@@ -1036,9 +894,7 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev, ...@@ -1036,9 +894,7 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Deactivates interrupt management of timer 3: */ /* Deactivates interrupt management of timer 3: */
outb(0xE0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0xE0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*************************************************/
/* Selects the master interrupt control register */ /* Selects the master interrupt control register */
/*************************************************/
outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL, outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Deletes all interrupts */ /* Deletes all interrupts */
...@@ -1368,123 +1224,91 @@ static int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device *dev, ...@@ -1368,123 +1224,91 @@ static int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device *dev,
} /* switch(data[4]) */ } /* switch(data[4]) */
i_TimerCounterMode = data[2] | data[4] | 7; i_TimerCounterMode = data[2] | data[4] | 7;
/*************************/
/* Test the reload value */ /* Test the reload value */
/*************************/
if ((data[3] >= 0) && (data[3] <= 65535)) { if ((data[3] >= 0) && (data[3] <= 65535)) {
if (data[7] == APCI1500_ENABLE if (data[7] == APCI1500_ENABLE
|| data[7] == APCI1500_DISABLE) { || data[7] == APCI1500_DISABLE) {
/************************************************/
/* Selects the mode register of timer/counter 1 */ /* Selects the mode register of timer/counter 1 */
/************************************************/
outb(APCI1500_RW_CPT_TMR1_MODE_SPECIFICATION, outb(APCI1500_RW_CPT_TMR1_MODE_SPECIFICATION,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***********************/
/* Writes the new mode */ /* Writes the new mode */
/***********************/
outb(i_TimerCounterMode, outb(i_TimerCounterMode,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/****************************************************/
/* Selects the constant register of timer/counter 1 */ /* Selects the constant register of timer/counter 1 */
/****************************************************/
outb(APCI1500_RW_CPT_TMR1_TIME_CST_LOW, outb(APCI1500_RW_CPT_TMR1_TIME_CST_LOW,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/*************************/
/* Writes the low value */ /* Writes the low value */
/*************************/
outb(data[3], outb(data[3],
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/****************************************************/
/* Selects the constant register of timer/counter 1 */ /* Selects the constant register of timer/counter 1 */
/****************************************************/
outb(APCI1500_RW_CPT_TMR1_TIME_CST_HIGH, outb(APCI1500_RW_CPT_TMR1_TIME_CST_HIGH,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/**************************/
/* Writes the high value */ /* Writes the high value */
/**************************/
data[3] = data[3] >> 8; data[3] = data[3] >> 8;
outb(data[3], outb(data[3],
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/*********************************************/
/* Selects the master configuration register */ /* Selects the master configuration register */
/*********************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/**********************/
/* Reads the register */ /* Reads the register */
/**********************/
i_MasterConfiguration = i_MasterConfiguration =
inb(devpriv->iobase + inb(devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/********************************************************/
/* Enables timer/counter 1 and triggers timer/counter 1 */ /* Enables timer/counter 1 and triggers timer/counter 1 */
/********************************************************/
i_MasterConfiguration = i_MasterConfiguration =
i_MasterConfiguration | 0x40; i_MasterConfiguration | 0x40;
/*********************************************/
/* Selects the master configuration register */ /* Selects the master configuration register */
/*********************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/********************************/
/* Writes the new configuration */ /* Writes the new configuration */
/********************************/
outb(i_MasterConfiguration, outb(i_MasterConfiguration,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/****************************************/
/* Selects the commands register of */ /* Selects the commands register of */
/* timer/counter 1 */ /* timer/counter 1 */
/****************************************/
outb(APCI1500_RW_CPT_TMR1_CMD_STATUS, outb(APCI1500_RW_CPT_TMR1_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***************************/
/* Disable timer/counter 1 */ /* Disable timer/counter 1 */
/***************************/
outb(0x0, outb(0x0,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/****************************************/
/* Selects the commands register of */ /* Selects the commands register of */
/* timer/counter 1 */ /* timer/counter 1 */
/****************************************/
outb(APCI1500_RW_CPT_TMR1_CMD_STATUS, outb(APCI1500_RW_CPT_TMR1_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***************************/
/* Trigger timer/counter 1 */ /* Trigger timer/counter 1 */
/***************************/
outb(0x2, outb(0x2,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -1562,123 +1386,91 @@ static int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device *dev, ...@@ -1562,123 +1386,91 @@ static int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device *dev,
i_TimerCounterMode = data[2] | data[4] | data[5] | data[6] | 7; i_TimerCounterMode = data[2] | data[4] | data[5] | data[6] | 7;
/*************************/
/* Test the reload value */ /* Test the reload value */
/*************************/
if ((data[3] >= 0) && (data[3] <= 65535)) { if ((data[3] >= 0) && (data[3] <= 65535)) {
if (data[7] == APCI1500_ENABLE if (data[7] == APCI1500_ENABLE
|| data[7] == APCI1500_DISABLE) { || data[7] == APCI1500_DISABLE) {
/************************************************/
/* Selects the mode register of timer/counter 2 */ /* Selects the mode register of timer/counter 2 */
/************************************************/
outb(APCI1500_RW_CPT_TMR2_MODE_SPECIFICATION, outb(APCI1500_RW_CPT_TMR2_MODE_SPECIFICATION,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***********************/
/* Writes the new mode */ /* Writes the new mode */
/***********************/
outb(i_TimerCounterMode, outb(i_TimerCounterMode,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/****************************************************/
/* Selects the constant register of timer/counter 2 */ /* Selects the constant register of timer/counter 2 */
/****************************************************/
outb(APCI1500_RW_CPT_TMR2_TIME_CST_LOW, outb(APCI1500_RW_CPT_TMR2_TIME_CST_LOW,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/*************************/
/* Writes the low value */ /* Writes the low value */
/*************************/
outb(data[3], outb(data[3],
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/****************************************************/
/* Selects the constant register of timer/counter 2 */ /* Selects the constant register of timer/counter 2 */
/****************************************************/
outb(APCI1500_RW_CPT_TMR2_TIME_CST_HIGH, outb(APCI1500_RW_CPT_TMR2_TIME_CST_HIGH,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/**************************/
/* Writes the high value */ /* Writes the high value */
/**************************/
data[3] = data[3] >> 8; data[3] = data[3] >> 8;
outb(data[3], outb(data[3],
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/*********************************************/
/* Selects the master configuration register */ /* Selects the master configuration register */
/*********************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/**********************/
/* Reads the register */ /* Reads the register */
/**********************/
i_MasterConfiguration = i_MasterConfiguration =
inb(devpriv->iobase + inb(devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/********************************************************/
/* Enables timer/counter 2 and triggers timer/counter 2 */ /* Enables timer/counter 2 and triggers timer/counter 2 */
/********************************************************/
i_MasterConfiguration = i_MasterConfiguration =
i_MasterConfiguration | 0x20; i_MasterConfiguration | 0x20;
/*********************************************/
/* Selects the master configuration register */ /* Selects the master configuration register */
/*********************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/********************************/
/* Writes the new configuration */ /* Writes the new configuration */
/********************************/
outb(i_MasterConfiguration, outb(i_MasterConfiguration,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/****************************************/
/* Selects the commands register of */ /* Selects the commands register of */
/* timer/counter 2 */ /* timer/counter 2 */
/****************************************/
outb(APCI1500_RW_CPT_TMR2_CMD_STATUS, outb(APCI1500_RW_CPT_TMR2_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***************************/
/* Disable timer/counter 2 */ /* Disable timer/counter 2 */
/***************************/
outb(0x0, outb(0x0,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/****************************************/
/* Selects the commands register of */ /* Selects the commands register of */
/* timer/counter 2 */ /* timer/counter 2 */
/****************************************/
outb(APCI1500_RW_CPT_TMR2_CMD_STATUS, outb(APCI1500_RW_CPT_TMR2_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***************************/
/* Trigger timer/counter 1 */ /* Trigger timer/counter 1 */
/***************************/
outb(0x2, outb(0x2,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -1740,142 +1532,104 @@ static int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device *dev, ...@@ -1740,142 +1532,104 @@ static int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device *dev,
return -EINVAL; return -EINVAL;
} /* switch(data[6]) */ } /* switch(data[6]) */
/*****************************/
/* Test if used for watchdog */ /* Test if used for watchdog */
/*****************************/
if (data[2] == APCI1500_WATCHDOG) { if (data[2] == APCI1500_WATCHDOG) {
/*****************************/
/* - Enables the output line */ /* - Enables the output line */
/* - Enables retrigger */ /* - Enables retrigger */
/* - Pulses output */ /* - Pulses output */
/*****************************/
i_TimerCounterMode = data[2] | data[4] | 0x54; i_TimerCounterMode = data[2] | data[4] | 0x54;
} /* if (data[2] == APCI1500_WATCHDOG) */ } /* if (data[2] == APCI1500_WATCHDOG) */
else { else {
i_TimerCounterMode = data[2] | data[4] | data[6] | 7; i_TimerCounterMode = data[2] | data[4] | data[6] | 7;
} /* elseif (data[2] == APCI1500_WATCHDOG) */ } /* elseif (data[2] == APCI1500_WATCHDOG) */
/*************************/
/* Test the reload value */ /* Test the reload value */
/*************************/
if ((data[3] >= 0) && (data[3] <= 65535)) { if ((data[3] >= 0) && (data[3] <= 65535)) {
if (data[7] == APCI1500_ENABLE if (data[7] == APCI1500_ENABLE
|| data[7] == APCI1500_DISABLE) { || data[7] == APCI1500_DISABLE) {
/************************************************/
/* Selects the mode register of watchdog/counter 3 */ /* Selects the mode register of watchdog/counter 3 */
/************************************************/
outb(APCI1500_RW_CPT_TMR3_MODE_SPECIFICATION, outb(APCI1500_RW_CPT_TMR3_MODE_SPECIFICATION,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***********************/
/* Writes the new mode */ /* Writes the new mode */
/***********************/
outb(i_TimerCounterMode, outb(i_TimerCounterMode,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/****************************************************/
/* Selects the constant register of watchdog/counter 3 */ /* Selects the constant register of watchdog/counter 3 */
/****************************************************/
outb(APCI1500_RW_CPT_TMR3_TIME_CST_LOW, outb(APCI1500_RW_CPT_TMR3_TIME_CST_LOW,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/*************************/
/* Writes the low value */ /* Writes the low value */
/*************************/
outb(data[3], outb(data[3],
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/****************************************************/
/* Selects the constant register of watchdog/counter 3 */ /* Selects the constant register of watchdog/counter 3 */
/****************************************************/
outb(APCI1500_RW_CPT_TMR3_TIME_CST_HIGH, outb(APCI1500_RW_CPT_TMR3_TIME_CST_HIGH,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/**************************/
/* Writes the high value */ /* Writes the high value */
/**************************/
data[3] = data[3] >> 8; data[3] = data[3] >> 8;
outb(data[3], outb(data[3],
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/*********************************************/
/* Selects the master configuration register */ /* Selects the master configuration register */
/*********************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/**********************/
/* Reads the register */ /* Reads the register */
/**********************/
i_MasterConfiguration = i_MasterConfiguration =
inb(devpriv->iobase + inb(devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/********************************************************/
/* Enables watchdog/counter 3 and triggers watchdog/counter 3 */ /* Enables watchdog/counter 3 and triggers watchdog/counter 3 */
/********************************************************/
i_MasterConfiguration = i_MasterConfiguration =
i_MasterConfiguration | 0x10; i_MasterConfiguration | 0x10;
/*********************************************/
/* Selects the master configuration register */ /* Selects the master configuration register */
/*********************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/********************************/
/* Writes the new configuration */ /* Writes the new configuration */
/********************************/
outb(i_MasterConfiguration, outb(i_MasterConfiguration,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/********************/
/* Test if COUNTER */ /* Test if COUNTER */
/********************/
if (data[2] == APCI1500_COUNTER) { if (data[2] == APCI1500_COUNTER) {
/*************************************/
/* Selects the command register of */ /* Selects the command register of */
/* watchdog/counter 3 */ /* watchdog/counter 3 */
/*************************************/
outb(APCI1500_RW_CPT_TMR3_CMD_STATUS, outb(APCI1500_RW_CPT_TMR3_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/*************************************************/
/* Disable the watchdog/counter 3 and starts it */ /* Disable the watchdog/counter 3 and starts it */
/*************************************************/
outb(0x0, outb(0x0,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/*************************************/
/* Selects the command register of */ /* Selects the command register of */
/* watchdog/counter 3 */ /* watchdog/counter 3 */
/*************************************/
outb(APCI1500_RW_CPT_TMR3_CMD_STATUS, outb(APCI1500_RW_CPT_TMR3_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/*************************************************/
/* Trigger the watchdog/counter 3 and starts it */ /* Trigger the watchdog/counter 3 and starts it */
/*************************************************/
outb(0x2, outb(0x2,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -1953,13 +1707,9 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev, ...@@ -1953,13 +1707,9 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev,
else { else {
i_CommandAndStatusValue = 0xE4; /* disable the interrupt */ i_CommandAndStatusValue = 0xE4; /* disable the interrupt */
} /* elseif(i_TimerCounterWatchdogInterrupt==1) */ } /* elseif(i_TimerCounterWatchdogInterrupt==1) */
/**************************/
/* Starts timer/counter 1 */ /* Starts timer/counter 1 */
/**************************/
i_TimerCounter1Enabled = 1; i_TimerCounter1Enabled = 1;
/********************************************/
/* Selects the commands and status register */ /* Selects the commands and status register */
/********************************************/
outb(APCI1500_RW_CPT_TMR1_CMD_STATUS, outb(APCI1500_RW_CPT_TMR1_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -1976,13 +1726,9 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev, ...@@ -1976,13 +1726,9 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev,
case STOP: case STOP:
/**************************/
/* Stop timer/counter 1 */ /* Stop timer/counter 1 */
/**************************/
/********************************************/
/* Selects the commands and status register */ /* Selects the commands and status register */
/********************************************/
outb(APCI1500_RW_CPT_TMR1_CMD_STATUS, outb(APCI1500_RW_CPT_TMR1_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -1995,23 +1741,17 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev, ...@@ -1995,23 +1741,17 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev,
case TRIGGER: case TRIGGER:
if (i_TimerCounter1Init == 1) { if (i_TimerCounter1Init == 1) {
if (i_TimerCounter1Enabled == 1) { if (i_TimerCounter1Enabled == 1) {
/************************/
/* Set Trigger and gate */ /* Set Trigger and gate */
/************************/
i_CommandAndStatusValue = 0x6; i_CommandAndStatusValue = 0x6;
} /* if( i_TimerCounter1Enabled==1) */ } /* if( i_TimerCounter1Enabled==1) */
else { else {
/***************/
/* Set Trigger */ /* Set Trigger */
/***************/
i_CommandAndStatusValue = 0x2; i_CommandAndStatusValue = 0x2;
} /* elseif(i_TimerCounter1Enabled==1) */ } /* elseif(i_TimerCounter1Enabled==1) */
/********************************************/
/* Selects the commands and status register */ /* Selects the commands and status register */
/********************************************/
outb(APCI1500_RW_CPT_TMR1_CMD_STATUS, outb(APCI1500_RW_CPT_TMR1_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -2043,13 +1783,9 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev, ...@@ -2043,13 +1783,9 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev,
else { else {
i_CommandAndStatusValue = 0xE4; /* disable the interrupt */ i_CommandAndStatusValue = 0xE4; /* disable the interrupt */
} /* elseif(i_TimerCounterWatchdogInterrupt==1) */ } /* elseif(i_TimerCounterWatchdogInterrupt==1) */
/**************************/
/* Starts timer/counter 2 */ /* Starts timer/counter 2 */
/**************************/
i_TimerCounter2Enabled = 1; i_TimerCounter2Enabled = 1;
/********************************************/
/* Selects the commands and status register */ /* Selects the commands and status register */
/********************************************/
outb(APCI1500_RW_CPT_TMR2_CMD_STATUS, outb(APCI1500_RW_CPT_TMR2_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -2066,13 +1802,9 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev, ...@@ -2066,13 +1802,9 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev,
case STOP: case STOP:
/**************************/
/* Stop timer/counter 2 */ /* Stop timer/counter 2 */
/**************************/
/********************************************/
/* Selects the commands and status register */ /* Selects the commands and status register */
/********************************************/
outb(APCI1500_RW_CPT_TMR2_CMD_STATUS, outb(APCI1500_RW_CPT_TMR2_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -2084,23 +1816,17 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev, ...@@ -2084,23 +1816,17 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev,
case TRIGGER: case TRIGGER:
if (i_TimerCounter2Init == 1) { if (i_TimerCounter2Init == 1) {
if (i_TimerCounter2Enabled == 1) { if (i_TimerCounter2Enabled == 1) {
/************************/
/* Set Trigger and gate */ /* Set Trigger and gate */
/************************/
i_CommandAndStatusValue = 0x6; i_CommandAndStatusValue = 0x6;
} /* if( i_TimerCounter2Enabled==1) */ } /* if( i_TimerCounter2Enabled==1) */
else { else {
/***************/
/* Set Trigger */ /* Set Trigger */
/***************/
i_CommandAndStatusValue = 0x2; i_CommandAndStatusValue = 0x2;
} /* elseif(i_TimerCounter2Enabled==1) */ } /* elseif(i_TimerCounter2Enabled==1) */
/********************************************/
/* Selects the commands and status register */ /* Selects the commands and status register */
/********************************************/
outb(APCI1500_RW_CPT_TMR2_CMD_STATUS, outb(APCI1500_RW_CPT_TMR2_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -2131,13 +1857,9 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev, ...@@ -2131,13 +1857,9 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev,
else { else {
i_CommandAndStatusValue = 0xE4; /* disable the interrupt */ i_CommandAndStatusValue = 0xE4; /* disable the interrupt */
} /* elseif(i_TimerCounterWatchdogInterrupt==1) */ } /* elseif(i_TimerCounterWatchdogInterrupt==1) */
/**************************/
/* Starts Watchdog/counter 3 */ /* Starts Watchdog/counter 3 */
/**************************/
i_WatchdogCounter3Enabled = 1; i_WatchdogCounter3Enabled = 1;
/********************************************/
/* Selects the commands and status register */ /* Selects the commands and status register */
/********************************************/
outb(APCI1500_RW_CPT_TMR3_CMD_STATUS, outb(APCI1500_RW_CPT_TMR3_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -2155,13 +1877,9 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev, ...@@ -2155,13 +1877,9 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev,
case STOP: case STOP:
/**************************/
/* Stop Watchdog/counter 3 */ /* Stop Watchdog/counter 3 */
/**************************/
/********************************************/
/* Selects the commands and status register */ /* Selects the commands and status register */
/********************************************/
outb(APCI1500_RW_CPT_TMR3_CMD_STATUS, outb(APCI1500_RW_CPT_TMR3_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -2176,23 +1894,17 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev, ...@@ -2176,23 +1894,17 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev,
case 0: /* triggering counter 3 */ case 0: /* triggering counter 3 */
if (i_WatchdogCounter3Init == 1) { if (i_WatchdogCounter3Init == 1) {
if (i_WatchdogCounter3Enabled == 1) { if (i_WatchdogCounter3Enabled == 1) {
/************************/
/* Set Trigger and gate */ /* Set Trigger and gate */
/************************/
i_CommandAndStatusValue = 0x6; i_CommandAndStatusValue = 0x6;
} /* if( i_WatchdogCounter3Enabled==1) */ } /* if( i_WatchdogCounter3Enabled==1) */
else { else {
/***************/
/* Set Trigger */ /* Set Trigger */
/***************/
i_CommandAndStatusValue = 0x2; i_CommandAndStatusValue = 0x2;
} /* elseif(i_WatchdogCounter3Enabled==1) */ } /* elseif(i_WatchdogCounter3Enabled==1) */
/********************************************/
/* Selects the commands and status register */ /* Selects the commands and status register */
/********************************************/
outb(APCI1500_RW_CPT_TMR3_CMD_STATUS, outb(APCI1500_RW_CPT_TMR3_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -2210,9 +1922,7 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev, ...@@ -2210,9 +1922,7 @@ static int i_apci1500_timer_watchdog(struct comedi_device *dev,
/* triggering Watchdog 3 */ /* triggering Watchdog 3 */
if (i_WatchdogCounter3Init == 1) { if (i_WatchdogCounter3Init == 1) {
/********************************************/
/* Selects the commands and status register */ /* Selects the commands and status register */
/********************************************/
outb(APCI1500_RW_CPT_TMR3_CMD_STATUS, outb(APCI1500_RW_CPT_TMR3_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -2283,23 +1993,17 @@ static int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev, ...@@ -2283,23 +1993,17 @@ static int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev,
/* Read counter/timer1 */ /* Read counter/timer1 */
if (i_TimerCounter1Init == 1) { if (i_TimerCounter1Init == 1) {
if (i_TimerCounter1Enabled == 1) { if (i_TimerCounter1Enabled == 1) {
/************************/
/* Set RCC and gate */ /* Set RCC and gate */
/************************/
i_CommandAndStatusValue = 0xC; i_CommandAndStatusValue = 0xC;
} /* if( i_TimerCounter1Init==1) */ } /* if( i_TimerCounter1Init==1) */
else { else {
/***************/
/* Set RCC */ /* Set RCC */
/***************/
i_CommandAndStatusValue = 0x8; i_CommandAndStatusValue = 0x8;
} /* elseif(i_TimerCounter1Init==1) */ } /* elseif(i_TimerCounter1Init==1) */
/********************************************/
/* Selects the commands and status register */ /* Selects the commands and status register */
/********************************************/
outb(APCI1500_RW_CPT_TMR1_CMD_STATUS, outb(APCI1500_RW_CPT_TMR1_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -2307,9 +2011,7 @@ static int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev, ...@@ -2307,9 +2011,7 @@ static int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***************************************/
/* Selects the counter register (high) */ /* Selects the counter register (high) */
/***************************************/
outb(APCI1500_R_CPT_TMR1_VALUE_HIGH, outb(APCI1500_R_CPT_TMR1_VALUE_HIGH,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -2335,23 +2037,17 @@ static int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev, ...@@ -2335,23 +2037,17 @@ static int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev,
/* Read counter/timer2 */ /* Read counter/timer2 */
if (i_TimerCounter2Init == 1) { if (i_TimerCounter2Init == 1) {
if (i_TimerCounter2Enabled == 1) { if (i_TimerCounter2Enabled == 1) {
/************************/
/* Set RCC and gate */ /* Set RCC and gate */
/************************/
i_CommandAndStatusValue = 0xC; i_CommandAndStatusValue = 0xC;
} /* if( i_TimerCounter2Init==1) */ } /* if( i_TimerCounter2Init==1) */
else { else {
/***************/
/* Set RCC */ /* Set RCC */
/***************/
i_CommandAndStatusValue = 0x8; i_CommandAndStatusValue = 0x8;
} /* elseif(i_TimerCounter2Init==1) */ } /* elseif(i_TimerCounter2Init==1) */
/********************************************/
/* Selects the commands and status register */ /* Selects the commands and status register */
/********************************************/
outb(APCI1500_RW_CPT_TMR2_CMD_STATUS, outb(APCI1500_RW_CPT_TMR2_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -2359,9 +2055,7 @@ static int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev, ...@@ -2359,9 +2055,7 @@ static int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***************************************/
/* Selects the counter register (high) */ /* Selects the counter register (high) */
/***************************************/
outb(APCI1500_R_CPT_TMR2_VALUE_HIGH, outb(APCI1500_R_CPT_TMR2_VALUE_HIGH,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -2387,23 +2081,17 @@ static int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev, ...@@ -2387,23 +2081,17 @@ static int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev,
/* Read counter/watchdog2 */ /* Read counter/watchdog2 */
if (i_WatchdogCounter3Init == 1) { if (i_WatchdogCounter3Init == 1) {
if (i_WatchdogCounter3Enabled == 1) { if (i_WatchdogCounter3Enabled == 1) {
/************************/
/* Set RCC and gate */ /* Set RCC and gate */
/************************/
i_CommandAndStatusValue = 0xC; i_CommandAndStatusValue = 0xC;
} /* if( i_TimerCounter2Init==1) */ } /* if( i_TimerCounter2Init==1) */
else { else {
/***************/
/* Set RCC */ /* Set RCC */
/***************/
i_CommandAndStatusValue = 0x8; i_CommandAndStatusValue = 0x8;
} /* elseif(i_WatchdogCounter3Init==1) */ } /* elseif(i_WatchdogCounter3Init==1) */
/********************************************/
/* Selects the commands and status register */ /* Selects the commands and status register */
/********************************************/
outb(APCI1500_RW_CPT_TMR3_CMD_STATUS, outb(APCI1500_RW_CPT_TMR3_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -2411,9 +2099,7 @@ static int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev, ...@@ -2411,9 +2099,7 @@ static int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***************************************/
/* Selects the counter register (high) */ /* Selects the counter register (high) */
/***************************************/
outb(APCI1500_R_CPT_TMR3_VALUE_HIGH, outb(APCI1500_R_CPT_TMR3_VALUE_HIGH,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -2525,135 +2211,95 @@ static int i_APCI1500_ConfigureInterrupt(struct comedi_device *dev, ...@@ -2525,135 +2211,95 @@ static int i_APCI1500_ConfigureInterrupt(struct comedi_device *dev,
} /* else if(data[0]==0) */ } /* else if(data[0]==0) */
} /* elseif(data[0]==1) */ } /* elseif(data[0]==1) */
/*****************************************************/
/* Selects the mode specification register of port B */ /* Selects the mode specification register of port B */
/*****************************************************/
outb(APCI1500_RW_PORT_B_SPECIFICATION, outb(APCI1500_RW_PORT_B_SPECIFICATION,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
i_RegValue = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_RegValue = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(APCI1500_RW_PORT_B_SPECIFICATION, outb(APCI1500_RW_PORT_B_SPECIFICATION,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*********************************************/
/* Writes the new configuration (APCI1500_OR) */ /* Writes the new configuration (APCI1500_OR) */
/*********************************************/
i_RegValue = (i_RegValue & 0xF9) | APCI1500_OR; i_RegValue = (i_RegValue & 0xF9) | APCI1500_OR;
outb(i_RegValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(i_RegValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the command and status register of port B */ /* Selects the command and status register of port B */
/*****************************************************/
outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS, outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************/
/* Authorises the interrupt on the board */ /* Authorises the interrupt on the board */
/*****************************************/
outb(0xC0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0xC0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/***************************************************/
/* Selects the pattern polarity register of port B */ /* Selects the pattern polarity register of port B */
/***************************************************/
outb(APCI1500_RW_PORT_B_PATTERN_POLARITY, outb(APCI1500_RW_PORT_B_PATTERN_POLARITY,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(i_Constant, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(i_Constant, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the pattern transition register of port B */ /* Selects the pattern transition register of port B */
/*****************************************************/
outb(APCI1500_RW_PORT_B_PATTERN_TRANSITION, outb(APCI1500_RW_PORT_B_PATTERN_TRANSITION,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(i_Constant, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(i_Constant, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/***********************************************/
/* Selects the pattern mask register of port B */ /* Selects the pattern mask register of port B */
/***********************************************/
outb(APCI1500_RW_PORT_B_PATTERN_MASK, outb(APCI1500_RW_PORT_B_PATTERN_MASK,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(i_Constant, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(i_Constant, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the command and status register of port A */ /* Selects the command and status register of port A */
/*****************************************************/
outb(APCI1500_RW_PORT_A_COMMAND_AND_STATUS, outb(APCI1500_RW_PORT_A_COMMAND_AND_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
i_RegValue = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_RegValue = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(APCI1500_RW_PORT_A_COMMAND_AND_STATUS, outb(APCI1500_RW_PORT_A_COMMAND_AND_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/***********************************/
/* Deletes the interrupt of port A */ /* Deletes the interrupt of port A */
/***********************************/
i_RegValue = (i_RegValue & 0x0F) | 0x20; i_RegValue = (i_RegValue & 0x0F) | 0x20;
outb(i_RegValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(i_RegValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the command and status register of port B */ /* Selects the command and status register of port B */
/*****************************************************/
outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS, outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
i_RegValue = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_RegValue = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS, outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/***********************************/
/* Deletes the interrupt of port B */ /* Deletes the interrupt of port B */
/***********************************/
i_RegValue = (i_RegValue & 0x0F) | 0x20; i_RegValue = (i_RegValue & 0x0F) | 0x20;
outb(i_RegValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(i_RegValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the command and status register of timer 1 */ /* Selects the command and status register of timer 1 */
/*****************************************************/
outb(APCI1500_RW_CPT_TMR1_CMD_STATUS, outb(APCI1500_RW_CPT_TMR1_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
i_RegValue = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_RegValue = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(APCI1500_RW_CPT_TMR1_CMD_STATUS, outb(APCI1500_RW_CPT_TMR1_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/***********************************/
/* Deletes the interrupt of timer 1 */ /* Deletes the interrupt of timer 1 */
/***********************************/
i_RegValue = (i_RegValue & 0x0F) | 0x20; i_RegValue = (i_RegValue & 0x0F) | 0x20;
outb(i_RegValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(i_RegValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the command and status register of timer 2 */ /* Selects the command and status register of timer 2 */
/*****************************************************/
outb(APCI1500_RW_CPT_TMR2_CMD_STATUS, outb(APCI1500_RW_CPT_TMR2_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
i_RegValue = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_RegValue = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(APCI1500_RW_CPT_TMR2_CMD_STATUS, outb(APCI1500_RW_CPT_TMR2_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/***********************************/
/* Deletes the interrupt of timer 2 */ /* Deletes the interrupt of timer 2 */
/***********************************/
i_RegValue = (i_RegValue & 0x0F) | 0x20; i_RegValue = (i_RegValue & 0x0F) | 0x20;
outb(i_RegValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(i_RegValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the command and status register of timer 3 */ /* Selects the command and status register of timer 3 */
/*****************************************************/
outb(APCI1500_RW_CPT_TMR3_CMD_STATUS, outb(APCI1500_RW_CPT_TMR3_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
i_RegValue = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_RegValue = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(APCI1500_RW_CPT_TMR3_CMD_STATUS, outb(APCI1500_RW_CPT_TMR3_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/***********************************/
/* Deletes the interrupt of timer 3 */ /* Deletes the interrupt of timer 3 */
/***********************************/
i_RegValue = (i_RegValue & 0x0F) | 0x20; i_RegValue = (i_RegValue & 0x0F) | 0x20;
outb(i_RegValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(i_RegValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*************************************************/
/* Selects the master interrupt control register */ /* Selects the master interrupt control register */
/*************************************************/
outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL, outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/**********************************************/
/* Authorizes the main interrupt on the board */ /* Authorizes the main interrupt on the board */
/**********************************************/
outb(0xD0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0xD0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/***************************/
/* Enables the PCI interrupt */ /* Enables the PCI interrupt */
/*****************************/
outl(0x3000, devpriv->i_IobaseAmcc + 0x38); outl(0x3000, devpriv->i_IobaseAmcc + 0x38);
ui_Status = inl(devpriv->i_IobaseAmcc + 0x10); ui_Status = inl(devpriv->i_IobaseAmcc + 0x10);
ui_Status = inl(devpriv->i_IobaseAmcc + 0x38); ui_Status = inl(devpriv->i_IobaseAmcc + 0x38);
...@@ -2688,44 +2334,28 @@ static void v_APCI1500_Interrupt(int irq, void *d) ...@@ -2688,44 +2334,28 @@ static void v_APCI1500_Interrupt(int irq, void *d)
int i_RegValue = 0; int i_RegValue = 0;
i_InterruptMask = 0; i_InterruptMask = 0;
/***********************************/
/* Read the board interrupt status */ /* Read the board interrupt status */
/***********************************/
ui_InterruptStatus = inl(devpriv->i_IobaseAmcc + 0x38); ui_InterruptStatus = inl(devpriv->i_IobaseAmcc + 0x38);
/***************************************/
/* Test if board generated a interrupt */ /* Test if board generated a interrupt */
/***************************************/
if ((ui_InterruptStatus & 0x800000) == 0x800000) { if ((ui_InterruptStatus & 0x800000) == 0x800000) {
/************************/
/* Disable all Interrupt */ /* Disable all Interrupt */
/************************/
/*************************************************/
/* Selects the master interrupt control register */ /* Selects the master interrupt control register */
/*************************************************/
/* outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL,devpriv->iobase+APCI1500_Z8536_CONTROL_REGISTER); */ /* outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL,devpriv->iobase+APCI1500_Z8536_CONTROL_REGISTER); */
/**********************************************/
/* Disables the main interrupt on the board */ /* Disables the main interrupt on the board */
/**********************************************/
/* outb(0x00,devpriv->iobase+APCI1500_Z8536_CONTROL_REGISTER); */ /* outb(0x00,devpriv->iobase+APCI1500_Z8536_CONTROL_REGISTER); */
/*****************************************************/
/* Selects the command and status register of port A */ /* Selects the command and status register of port A */
/*****************************************************/
outb(APCI1500_RW_PORT_A_COMMAND_AND_STATUS, outb(APCI1500_RW_PORT_A_COMMAND_AND_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
i_RegValue = i_RegValue =
inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
if ((i_RegValue & 0x60) == 0x60) { if ((i_RegValue & 0x60) == 0x60) {
/*****************************************************/
/* Selects the command and status register of port A */ /* Selects the command and status register of port A */
/*****************************************************/
outb(APCI1500_RW_PORT_A_COMMAND_AND_STATUS, outb(APCI1500_RW_PORT_A_COMMAND_AND_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***********************************/
/* Deletes the interrupt of port A */ /* Deletes the interrupt of port A */
/***********************************/
i_RegValue = (i_RegValue & 0x0F) | 0x20; i_RegValue = (i_RegValue & 0x0F) | 0x20;
outb(i_RegValue, outb(i_RegValue,
devpriv->iobase + devpriv->iobase +
...@@ -2739,9 +2369,7 @@ static void v_APCI1500_Interrupt(int irq, void *d) ...@@ -2739,9 +2369,7 @@ static void v_APCI1500_Interrupt(int irq, void *d)
inb(devpriv->iobase + inb(devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***************************************************/
/* Selects the interrupt vector register of port A */ /* Selects the interrupt vector register of port A */
/***************************************************/
outb(APCI1500_RW_PORT_A_INTERRUPT_CONTROL, outb(APCI1500_RW_PORT_A_INTERRUPT_CONTROL,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
...@@ -2757,44 +2385,32 @@ static void v_APCI1500_Interrupt(int irq, void *d) ...@@ -2757,44 +2385,32 @@ static void v_APCI1500_Interrupt(int irq, void *d)
} /* elseif(i_Logic==APCI1500_OR_PRIORITY) */ } /* elseif(i_Logic==APCI1500_OR_PRIORITY) */
} /* if ((i_RegValue & 0x60) == 0x60) */ } /* if ((i_RegValue & 0x60) == 0x60) */
/*****************************************************/
/* Selects the command and status register of port B */ /* Selects the command and status register of port B */
/*****************************************************/
outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS, outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
i_RegValue = i_RegValue =
inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
if ((i_RegValue & 0x60) == 0x60) { if ((i_RegValue & 0x60) == 0x60) {
/*****************************************************/
/* Selects the command and status register of port B */ /* Selects the command and status register of port B */
/*****************************************************/
outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS, outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***********************************/
/* Deletes the interrupt of port B */ /* Deletes the interrupt of port B */
/***********************************/
i_RegValue = (i_RegValue & 0x0F) | 0x20; i_RegValue = (i_RegValue & 0x0F) | 0x20;
outb(i_RegValue, outb(i_RegValue,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/****************/
/* Reads port B */ /* Reads port B */
/****************/
i_RegValue = i_RegValue =
inb((unsigned int) devpriv->iobase + inb((unsigned int) devpriv->iobase +
APCI1500_Z8536_PORT_B); APCI1500_Z8536_PORT_B);
i_RegValue = i_RegValue & 0xC0; i_RegValue = i_RegValue & 0xC0;
/**************************************/
/* Tests if this is an external error */ /* Tests if this is an external error */
/**************************************/
if (i_RegValue) { if (i_RegValue) {
/* Disable the interrupt */ /* Disable the interrupt */
/*****************************************************/
/* Selects the command and status register of port B */ /* Selects the command and status register of port B */
/*****************************************************/
outl(0x0, devpriv->i_IobaseAmcc + 0x38); outl(0x0, devpriv->i_IobaseAmcc + 0x38);
if (i_RegValue & 0x80) { if (i_RegValue & 0x80) {
...@@ -2812,46 +2428,34 @@ static void v_APCI1500_Interrupt(int irq, void *d) ...@@ -2812,46 +2428,34 @@ static void v_APCI1500_Interrupt(int irq, void *d)
} /* if (i_RegValue) */ } /* if (i_RegValue) */
} /* if ((i_RegValue & 0x60) == 0x60) */ } /* if ((i_RegValue & 0x60) == 0x60) */
/*****************************************************/
/* Selects the command and status register of timer 1 */ /* Selects the command and status register of timer 1 */
/*****************************************************/
outb(APCI1500_RW_CPT_TMR1_CMD_STATUS, outb(APCI1500_RW_CPT_TMR1_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
i_RegValue = i_RegValue =
inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
if ((i_RegValue & 0x60) == 0x60) { if ((i_RegValue & 0x60) == 0x60) {
/*****************************************************/
/* Selects the command and status register of timer 1 */ /* Selects the command and status register of timer 1 */
/*****************************************************/
outb(APCI1500_RW_CPT_TMR1_CMD_STATUS, outb(APCI1500_RW_CPT_TMR1_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***********************************/
/* Deletes the interrupt of timer 1 */ /* Deletes the interrupt of timer 1 */
/***********************************/
i_RegValue = (i_RegValue & 0x0F) | 0x20; i_RegValue = (i_RegValue & 0x0F) | 0x20;
outb(i_RegValue, outb(i_RegValue,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
i_InterruptMask = i_InterruptMask | 4; i_InterruptMask = i_InterruptMask | 4;
} /* if ((i_RegValue & 0x60) == 0x60) */ } /* if ((i_RegValue & 0x60) == 0x60) */
/*****************************************************/
/* Selects the command and status register of timer 2 */ /* Selects the command and status register of timer 2 */
/*****************************************************/
outb(APCI1500_RW_CPT_TMR2_CMD_STATUS, outb(APCI1500_RW_CPT_TMR2_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
i_RegValue = i_RegValue =
inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
if ((i_RegValue & 0x60) == 0x60) { if ((i_RegValue & 0x60) == 0x60) {
/*****************************************************/
/* Selects the command and status register of timer 2 */ /* Selects the command and status register of timer 2 */
/*****************************************************/
outb(APCI1500_RW_CPT_TMR2_CMD_STATUS, outb(APCI1500_RW_CPT_TMR2_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***********************************/
/* Deletes the interrupt of timer 2 */ /* Deletes the interrupt of timer 2 */
/***********************************/
i_RegValue = (i_RegValue & 0x0F) | 0x20; i_RegValue = (i_RegValue & 0x0F) | 0x20;
outb(i_RegValue, outb(i_RegValue,
devpriv->iobase + devpriv->iobase +
...@@ -2859,23 +2463,17 @@ static void v_APCI1500_Interrupt(int irq, void *d) ...@@ -2859,23 +2463,17 @@ static void v_APCI1500_Interrupt(int irq, void *d)
i_InterruptMask = i_InterruptMask | 8; i_InterruptMask = i_InterruptMask | 8;
} /* if ((i_RegValue & 0x60) == 0x60) */ } /* if ((i_RegValue & 0x60) == 0x60) */
/*****************************************************/
/* Selects the command and status register of timer 3 */ /* Selects the command and status register of timer 3 */
/*****************************************************/
outb(APCI1500_RW_CPT_TMR3_CMD_STATUS, outb(APCI1500_RW_CPT_TMR3_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
i_RegValue = i_RegValue =
inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
if ((i_RegValue & 0x60) == 0x60) { if ((i_RegValue & 0x60) == 0x60) {
/*****************************************************/
/* Selects the command and status register of timer 3 */ /* Selects the command and status register of timer 3 */
/*****************************************************/
outb(APCI1500_RW_CPT_TMR3_CMD_STATUS, outb(APCI1500_RW_CPT_TMR3_CMD_STATUS,
devpriv->iobase + devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER); APCI1500_Z8536_CONTROL_REGISTER);
/***********************************/
/* Deletes the interrupt of timer 3 */ /* Deletes the interrupt of timer 3 */
/***********************************/
i_RegValue = (i_RegValue & 0x0F) | 0x20; i_RegValue = (i_RegValue & 0x0F) | 0x20;
outb(i_RegValue, outb(i_RegValue,
devpriv->iobase + devpriv->iobase +
...@@ -2889,18 +2487,12 @@ static void v_APCI1500_Interrupt(int irq, void *d) ...@@ -2889,18 +2487,12 @@ static void v_APCI1500_Interrupt(int irq, void *d)
} /* if ((i_RegValue & 0x60) == 0x60) */ } /* if ((i_RegValue & 0x60) == 0x60) */
send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */
/***********************/
/* Enable all Interrupts */ /* Enable all Interrupts */
/***********************/
/*************************************************/
/* Selects the master interrupt control register */ /* Selects the master interrupt control register */
/*************************************************/
outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL, outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/**********************************************/
/* Authorizes the main interrupt on the board */ /* Authorizes the main interrupt on the board */
/**********************************************/
outb(0xD0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0xD0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
} /* if ((ui_InterruptStatus & 0x800000) == 0x800000) */ } /* if ((ui_InterruptStatus & 0x800000) == 0x800000) */
else { else {
...@@ -2944,9 +2536,7 @@ static int i_APCI1500_Reset(struct comedi_device *dev) ...@@ -2944,9 +2536,7 @@ static int i_APCI1500_Reset(struct comedi_device *dev)
i_TimerCounter2Enabled = 0; i_TimerCounter2Enabled = 0;
i_WatchdogCounter3Enabled = 0; i_WatchdogCounter3Enabled = 0;
/******************/
/* Software reset */ /* Software reset */
/******************/
i_DummyRead = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_DummyRead = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
i_DummyRead = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_DummyRead = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
...@@ -2954,16 +2544,12 @@ static int i_APCI1500_Reset(struct comedi_device *dev) ...@@ -2954,16 +2544,12 @@ static int i_APCI1500_Reset(struct comedi_device *dev)
outb(1, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(1, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the master configuration control register */ /* Selects the master configuration control register */
/*****************************************************/
outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL, outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(0xF4, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0xF4, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the mode specification register of port A */ /* Selects the mode specification register of port A */
/*****************************************************/
outb(APCI1500_RW_PORT_A_SPECIFICATION, outb(APCI1500_RW_PORT_A_SPECIFICATION,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(0x10, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0x10, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
...@@ -2995,9 +2581,7 @@ static int i_APCI1500_Reset(struct comedi_device *dev) ...@@ -2995,9 +2581,7 @@ static int i_APCI1500_Reset(struct comedi_device *dev)
/* Deletes the register */ /* Deletes the register */
outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the mode specification register of port B */ /* Selects the mode specification register of port B */
/*****************************************************/
outb(APCI1500_RW_PORT_B_SPECIFICATION, outb(APCI1500_RW_PORT_B_SPECIFICATION,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(0x10, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0x10, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
...@@ -3027,9 +2611,7 @@ static int i_APCI1500_Reset(struct comedi_device *dev) ...@@ -3027,9 +2611,7 @@ static int i_APCI1500_Reset(struct comedi_device *dev)
/* Deletes the register */ /* Deletes the register */
outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the data path polarity register of port C */ /* Selects the data path polarity register of port C */
/*****************************************************/
outb(APCI1500_RW_PORT_C_DATA_PCITCH_POLARITY, outb(APCI1500_RW_PORT_C_DATA_PCITCH_POLARITY,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* High level of port C means 1 */ /* High level of port C means 1 */
...@@ -3044,9 +2626,7 @@ static int i_APCI1500_Reset(struct comedi_device *dev) ...@@ -3044,9 +2626,7 @@ static int i_APCI1500_Reset(struct comedi_device *dev)
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Deletes it */ /* Deletes it */
outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/******************************************************/
/* Selects the command and status register of timer 1 */ /* Selects the command and status register of timer 1 */
/******************************************************/
outb(APCI1500_RW_CPT_TMR1_CMD_STATUS, outb(APCI1500_RW_CPT_TMR1_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Deletes IP and IUS */ /* Deletes IP and IUS */
...@@ -3056,9 +2636,7 @@ static int i_APCI1500_Reset(struct comedi_device *dev) ...@@ -3056,9 +2636,7 @@ static int i_APCI1500_Reset(struct comedi_device *dev)
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Deactivates the interrupt management of timer 1 */ /* Deactivates the interrupt management of timer 1 */
outb(0xE0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0xE0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/******************************************************/
/* Selects the command and status register of timer 2 */ /* Selects the command and status register of timer 2 */
/******************************************************/
outb(APCI1500_RW_CPT_TMR2_CMD_STATUS, outb(APCI1500_RW_CPT_TMR2_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Deletes IP and IUS */ /* Deletes IP and IUS */
...@@ -3068,9 +2646,7 @@ static int i_APCI1500_Reset(struct comedi_device *dev) ...@@ -3068,9 +2646,7 @@ static int i_APCI1500_Reset(struct comedi_device *dev)
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Deactivates Timer 2 interrupt management: */ /* Deactivates Timer 2 interrupt management: */
outb(0xE0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0xE0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/******************************************************/
/* Selects the command and status register of timer 3 */ /* Selects the command and status register of timer 3 */
/******************************************************/
outb(APCI1500_RW_CPT_TMR3_CMD_STATUS, outb(APCI1500_RW_CPT_TMR3_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Deletes IP and IUS */ /* Deletes IP and IUS */
...@@ -3080,71 +2656,43 @@ static int i_APCI1500_Reset(struct comedi_device *dev) ...@@ -3080,71 +2656,43 @@ static int i_APCI1500_Reset(struct comedi_device *dev)
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Deactivates interrupt management of timer 3: */ /* Deactivates interrupt management of timer 3: */
outb(0xE0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0xE0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*************************************************/
/* Selects the master interrupt control register */ /* Selects the master interrupt control register */
/*************************************************/
outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL, outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* Deletes all interrupts */ /* Deletes all interrupts */
outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/* reset all the digital outputs */ /* reset all the digital outputs */
outw(0x0, devpriv->i_IobaseAddon + APCI1500_DIGITAL_OP); outw(0x0, devpriv->i_IobaseAddon + APCI1500_DIGITAL_OP);
/*******************************/
/* Disable the board interrupt */ /* Disable the board interrupt */
/*******************************/
/*************************************************/
/* Selects the master interrupt control register */ /* Selects the master interrupt control register */
/*************************************************/
outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL, outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/****************************/
/* Deactivates all interrupts */ /* Deactivates all interrupts */
/******************************/
outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the command and status register of port A */ /* Selects the command and status register of port A */
/*****************************************************/
outb(APCI1500_RW_PORT_A_COMMAND_AND_STATUS, outb(APCI1500_RW_PORT_A_COMMAND_AND_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/****************************/
/* Deactivates all interrupts */ /* Deactivates all interrupts */
/******************************/
outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the command and status register of port B */ /* Selects the command and status register of port B */
/*****************************************************/
outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS, outb(APCI1500_RW_PORT_B_COMMAND_AND_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/****************************/
/* Deactivates all interrupts */ /* Deactivates all interrupts */
/******************************/
outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the command and status register of timer 1 */ /* Selects the command and status register of timer 1 */
/*****************************************************/
outb(APCI1500_RW_CPT_TMR1_CMD_STATUS, outb(APCI1500_RW_CPT_TMR1_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/****************************/
/* Deactivates all interrupts */ /* Deactivates all interrupts */
/******************************/
outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the command and status register of timer 2 */ /* Selects the command and status register of timer 2 */
/*****************************************************/
outb(APCI1500_RW_CPT_TMR2_CMD_STATUS, outb(APCI1500_RW_CPT_TMR2_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/****************************/
/* Deactivates all interrupts */ /* Deactivates all interrupts */
/******************************/
outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/*****************************************************/
/* Selects the command and status register of timer 3*/ /* Selects the command and status register of timer 3*/
/*****************************************************/
outb(APCI1500_RW_CPT_TMR3_CMD_STATUS, outb(APCI1500_RW_CPT_TMR3_CMD_STATUS,
devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
/****************************/
/* Deactivates all interrupts */ /* Deactivates all interrupts */
/******************************/
outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
return 0; return 0;
} }
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