aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c')
-rw-r--r--drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c119
1 files changed, 56 insertions, 63 deletions
diff --git a/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c b/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c
index b0907ec14667..6e9e7ed4dba9 100644
--- a/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c
+++ b/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c
@@ -3,13 +3,13 @@
Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module.
- ADDI-DATA GmbH
- Dieselstrasse 3
- D-77833 Ottersweier
- Tel: +19(0)7223/9493-0
- Fax: +49(0)7223/9493-92
- http://www.addi-data-com
- info@addi-data.com
+ ADDI-DATA GmbH
+ Dieselstrasse 3
+ D-77833 Ottersweier
+ Tel: +19(0)7223/9493-0
+ Fax: +49(0)7223/9493-92
+ http://www.addi-data-com
+ info@addi-data.com
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
@@ -49,37 +49,37 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
#include "addi_amcc_S5920.h"
/*+----------------------------------------------------------------------------+*/
-/*| Function Name : INT i_AddiHeaderRW_ReadEeprom |*/
-/*| (INT i_NbOfWordsToRead, |*/
-/*| DWORD dw_PCIBoardEepromAddress, |*/
-/*| WORD w_EepromStartAddress, |*/
-/*| PWORD pw_DataRead) |*/
+/*| Function Name : int i_AddiHeaderRW_ReadEeprom |*/
+/*| (int i_NbOfWordsToRead, |*/
+/*| unsigned int dw_PCIBoardEepromAddress, |*/
+/*| unsigned short w_EepromStartAddress, |*/
+/*| unsigned short * pw_DataRead) |*/
/*+----------------------------------------------------------------------------+*/
/*| Task : Read word from the 5920 eeprom. |*/
/*+----------------------------------------------------------------------------+*/
-/*| Input Parameters : INT i_NbOfWordsToRead : Nbr. of word to read |*/
-/*| DWORD dw_PCIBoardEepromAddress : Address of the eeprom |*/
-/*| WORD w_EepromStartAddress : Eeprom strat address |*/
+/*| Input Parameters : int i_NbOfWordsToRead : Nbr. of word to read |*/
+/*| unsigned int dw_PCIBoardEepromAddress : Address of the eeprom |*/
+/*| unsigned short w_EepromStartAddress : Eeprom strat address |*/
/*+----------------------------------------------------------------------------+*/
-/*| Output Parameters : PWORD pw_DataRead : Read data |*/
+/*| Output Parameters : unsigned short * pw_DataRead : Read data |*/
/*+----------------------------------------------------------------------------+*/
/*| Return Value : - |*/
/*+----------------------------------------------------------------------------+*/
-INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead,
- DWORD dw_PCIBoardEepromAddress,
- WORD w_EepromStartAddress, PWORD pw_DataRead)
+int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead,
+ unsigned int dw_PCIBoardEepromAddress,
+ unsigned short w_EepromStartAddress, unsigned short *pw_DataRead)
{
- DWORD dw_eeprom_busy = 0;
- INT i_Counter = 0;
- INT i_WordCounter;
- INT i;
- BYTE pb_ReadByte[1];
- BYTE b_ReadLowByte = 0;
- BYTE b_ReadHighByte = 0;
- BYTE b_SelectedAddressLow = 0;
- BYTE b_SelectedAddressHigh = 0;
- WORD w_ReadWord = 0;
+ unsigned int dw_eeprom_busy = 0;
+ int i_Counter = 0;
+ int i_WordCounter;
+ int i;
+ unsigned char pb_ReadByte[1];
+ unsigned char b_ReadLowByte = 0;
+ unsigned char b_ReadHighByte = 0;
+ unsigned char b_SelectedAddressLow = 0;
+ unsigned char b_SelectedAddressHigh = 0;
+ unsigned short w_ReadWord = 0;
for (i_WordCounter = 0; i_WordCounter < i_NbOfWordsToRead;
i_WordCounter++) {
@@ -88,106 +88,99 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead,
inl(dw_PCIBoardEepromAddress +
AMCC_OP_REG_MCSR);
dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
- }
- while (dw_eeprom_busy == EEPROM_BUSY);
+ } while (dw_eeprom_busy == EEPROM_BUSY);
for (i_Counter = 0; i_Counter < 2; i_Counter++) {
- b_SelectedAddressLow = (w_EepromStartAddress + i_Counter) % 256; //Read the low 8 bit part
- b_SelectedAddressHigh = (w_EepromStartAddress + i_Counter) / 256; //Read the high 8 bit part
+ b_SelectedAddressLow = (w_EepromStartAddress + i_Counter) % 256; /* Read the low 8 bit part */
+ b_SelectedAddressHigh = (w_EepromStartAddress + i_Counter) / 256; /* Read the high 8 bit part */
- //Select the load low address mode
+ /* Select the load low address mode */
outb(NVCMD_LOAD_LOW,
dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
3);
- //Wait on busy
+ /* Wait on busy */
do {
dw_eeprom_busy =
inl(dw_PCIBoardEepromAddress +
AMCC_OP_REG_MCSR);
dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
- }
- while (dw_eeprom_busy == EEPROM_BUSY);
+ } while (dw_eeprom_busy == EEPROM_BUSY);
- //Load the low address
+ /* Load the low address */
outb(b_SelectedAddressLow,
dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
2);
- //Wait on busy
+ /* Wait on busy */
do {
dw_eeprom_busy =
inl(dw_PCIBoardEepromAddress +
AMCC_OP_REG_MCSR);
dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
- }
- while (dw_eeprom_busy == EEPROM_BUSY);
+ } while (dw_eeprom_busy == EEPROM_BUSY);
- //Select the load high address mode
+ /* Select the load high address mode */
outb(NVCMD_LOAD_HIGH,
dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
3);
- //Wait on busy
+ /* Wait on busy */
do {
dw_eeprom_busy =
inl(dw_PCIBoardEepromAddress +
AMCC_OP_REG_MCSR);
dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
- }
- while (dw_eeprom_busy == EEPROM_BUSY);
+ } while (dw_eeprom_busy == EEPROM_BUSY);
- //Load the high address
+ /* Load the high address */
outb(b_SelectedAddressHigh,
dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
2);
- //Wait on busy
+ /* Wait on busy */
do {
dw_eeprom_busy =
inl(dw_PCIBoardEepromAddress +
AMCC_OP_REG_MCSR);
dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
- }
- while (dw_eeprom_busy == EEPROM_BUSY);
+ } while (dw_eeprom_busy == EEPROM_BUSY);
- //Select the READ mode
+ /* Select the READ mode */
outb(NVCMD_BEGIN_READ,
dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
3);
- //Wait on busy
+ /* Wait on busy */
do {
dw_eeprom_busy =
inl(dw_PCIBoardEepromAddress +
AMCC_OP_REG_MCSR);
dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
- }
- while (dw_eeprom_busy == EEPROM_BUSY);
+ } while (dw_eeprom_busy == EEPROM_BUSY);
- //Read data into the EEPROM
+ /* Read data into the EEPROM */
*pb_ReadByte =
inb(dw_PCIBoardEepromAddress +
AMCC_OP_REG_MCSR + 2);
- //Wait on busy
+ /* Wait on busy */
do {
dw_eeprom_busy =
inl(dw_PCIBoardEepromAddress +
AMCC_OP_REG_MCSR);
dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
- }
- while (dw_eeprom_busy == EEPROM_BUSY);
+ } while (dw_eeprom_busy == EEPROM_BUSY);
- //Select the upper address part
+ /* Select the upper address part */
if (i_Counter == 0) {
b_ReadLowByte = pb_ReadByte[0];
} else {
b_ReadHighByte = pb_ReadByte[0];
}
- //Sleep
- for (i = 0; i < 10000; i++) ;
+ /* Sleep */
+ msleep(1);
}
w_ReadWord =
@@ -196,8 +189,8 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead,
pw_DataRead[i_WordCounter] = w_ReadWord;
- w_EepromStartAddress += 2; // to read the next word
+ w_EepromStartAddress += 2; /* to read the next word */
- } // for (...) i_NbOfWordsToRead
- return (0);
+ } /* for (...) i_NbOfWordsToRead */
+ return 0;
}