#define EE76_CMD_LEN 13 // bits in instructions
#define EE_READ 0x0180 // 01 1000 0000 read instruction
-#define WORD unsigned short
-#define PWORD unsigned short *
#define PDWORD unsigned int *
#ifndef DWORD
struct str_Functionality {
unsigned char b_Type;
- WORD w_Address;
+ unsigned short w_Address;
};
typedef struct {
- WORD w_HeaderSize;
+ unsigned short w_HeaderSize;
unsigned char b_Nfunctions;
struct str_Functionality s_Functions[7];
} str_MainHeader;
typedef struct {
- WORD w_Nchannel;
+ unsigned short w_Nchannel;
unsigned char b_Interruptible;
- WORD w_NinterruptLogic;
+ unsigned short w_NinterruptLogic;
} str_DigitalInputHeader;
typedef struct {
- WORD w_Nchannel;
+ unsigned short w_Nchannel;
} str_DigitalOutputHeader;
// used for timer as well as watchdog
typedef struct {
- WORD w_HeaderSize;
+ unsigned short w_HeaderSize;
unsigned char b_Resolution;
unsigned char b_Mode; // in case of Watchdog it is functionality
- WORD w_MinTiming;
+ unsigned short w_MinTiming;
unsigned char b_TimeBase;
} str_TimerDetails;
typedef struct {
- WORD w_Ntimer;
+ unsigned short w_Ntimer;
str_TimerDetails s_TimerDetails[4]; // supports 4 timers
} str_TimerMainHeader;
typedef struct {
- WORD w_Nchannel;
+ unsigned short w_Nchannel;
unsigned char b_Resolution;
} str_AnalogOutputHeader;
typedef struct {
- WORD w_Nchannel;
- WORD w_MinConvertTiming;
- WORD w_MinDelayTiming;
+ unsigned short w_Nchannel;
+ unsigned short w_MinConvertTiming;
+ unsigned short w_MinDelayTiming;
unsigned char b_HasDma;
unsigned char b_Resolution;
} str_AnalogInputHeader;
/* Read Header Functions */
/*****************************************/
-INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress,
+INT i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress,
char *pc_PCIChipInformation, struct comedi_device *dev);
-INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress,
- char *pc_PCIChipInformation, WORD w_Address,
+INT i_EepromReadDigitalInputHeader(unsigned short w_PCIBoardEepromAddress,
+ char *pc_PCIChipInformation, unsigned short w_Address,
str_DigitalInputHeader * s_Header);
-INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress,
- char *pc_PCIChipInformation, WORD w_Address,
+INT i_EepromReadDigitalOutputHeader(unsigned short w_PCIBoardEepromAddress,
+ char *pc_PCIChipInformation, unsigned short w_Address,
str_DigitalOutputHeader * s_Header);
-INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress,
- char *pc_PCIChipInformation, WORD w_Address,
+INT i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress,
+ char *pc_PCIChipInformation, unsigned short w_Address,
str_TimerMainHeader * s_Header);
-INT i_EepromReadAnlogOutputHeader(WORD w_PCIBoardEepromAddress,
- char *pc_PCIChipInformation, WORD w_Address,
+INT i_EepromReadAnlogOutputHeader(unsigned short w_PCIBoardEepromAddress,
+ char *pc_PCIChipInformation, unsigned short w_Address,
str_AnalogOutputHeader * s_Header);
-INT i_EepromReadAnlogInputHeader(WORD w_PCIBoardEepromAddress,
- char *pc_PCIChipInformation, WORD w_Address,
+INT i_EepromReadAnlogInputHeader(unsigned short w_PCIBoardEepromAddress,
+ char *pc_PCIChipInformation, unsigned short w_Address,
str_AnalogInputHeader * s_Header);
/******************************************/
/* Eeprom Specific Functions */
/******************************************/
-WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation,
- WORD w_EepromStartAddress);
-void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress);
+unsigned short w_EepromReadWord(unsigned short w_PCIBoardEepromAddress, char *pc_PCIChipInformation,
+ unsigned short w_EepromStartAddress);
+void v_EepromWaitBusy(unsigned short w_PCIBoardEepromAddress);
void v_EepromClock76(DWORD dw_Address, DWORD dw_RegisterValue);
-void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress);
+void v_EepromWaitBusy(unsigned short w_PCIBoardEepromAddress);
void v_EepromSendCommand76(DWORD dw_Address, DWORD dw_EepromCommand,
unsigned char b_DataLengthInBits);
-void v_EepromCs76Read(DWORD dw_Address, WORD w_offset, PWORD pw_Value);
+void v_EepromCs76Read(DWORD dw_Address, unsigned short w_offset, unsigned short * pw_Value);
/*
+----------------------------------------------------------------------------+
-| Function Name : WORD w_EepromReadWord |
-| (WORD w_PCIBoardEepromAddress, |
+| Function Name : unsigned short w_EepromReadWord |
+| (unsigned short w_PCIBoardEepromAddress, |
| char * pc_PCIChipInformation, |
-| WORD w_EepromStartAddress) |
+| unsigned short w_EepromStartAddress) |
+----------------------------------------------------------------------------+
| Task : Read from eepromn a word |
+----------------------------------------------------------------------------+
-| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address |
+| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address |
| |
| char *pc_PCIChipInformation : PCI Chip Type. |
| |
-| WORD w_EepromStartAddress : Selected eeprom address |
+| unsigned short w_EepromStartAddress : Selected eeprom address |
+----------------------------------------------------------------------------+
| Output Parameters : - |
+----------------------------------------------------------------------------+
+----------------------------------------------------------------------------+
*/
-WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation,
- WORD w_EepromStartAddress)
+unsigned short w_EepromReadWord(unsigned short w_PCIBoardEepromAddress, char *pc_PCIChipInformation,
+ unsigned short w_EepromStartAddress)
{
unsigned char b_Counter = 0;
unsigned char b_SelectedAddressHigh = 0;
- WORD w_ReadWord = 0;
+ unsigned short w_ReadWord = 0;
/**************************/
} // for (b_Counter=0; b_Counter<2; b_Counter++)
- w_ReadWord = (b_ReadLowByte | (((WORD) b_ReadHighByte) * 256));
+ w_ReadWord = (b_ReadLowByte | (((unsigned short) b_ReadHighByte) * 256));
} // end of if ((!strcmp(pc_PCIChipInformation, "S5920")) || (!strcmp(pc_PCIChipInformation, "S5933")))
| Function Name : void v_EepromWaitBusy |
-| (WORD w_PCIBoardEepromAddress) |
+| (unsigned short w_PCIBoardEepromAddress) |
+----------------------------------------------------------------------------+
+----------------------------------------------------------------------------+
-| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom base address |
+| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom base address |
+----------------------------------------------------------------------------+
*/
-void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress)
+void v_EepromWaitBusy(unsigned short w_PCIBoardEepromAddress)
{
unsigned char b_EepromBusy = 0;
/* the operator register is AMCC_OP_REG_MCSR+3 */
- /* WORD read EEPROM=0x8000 andAMCC_OP_REG_MCSR+2 */
+ /* unsigned short read EEPROM=0x8000 andAMCC_OP_REG_MCSR+2 */
/* DWORD read EEPROM=0x80000000 and AMCC_OP_REG_MCSR */
| Function Name : void v_EepromCs76Read(DWORD dw_Address, |
-| WORD w_offset, |
+| unsigned short w_offset, |
-| PWORD pw_Value) |
+| unsigned short * pw_Value) |
+---------------------------------------------------------------------------------+
| Input Parameters : DWORD dw_Address : PCI eeprom base address |
-| WORD w_offset : Offset of the adress to read |
+| unsigned short w_offset : Offset of the adress to read |
-| PWORD pw_Value : PCI eeprom 16 bit read value. |
+| unsigned short * pw_Value : PCI eeprom 16 bit read value. |
+---------------------------------------------------------------------------------+
*/
-void v_EepromCs76Read(DWORD dw_Address, WORD w_offset, PWORD pw_Value)
+void v_EepromCs76Read(DWORD dw_Address, unsigned short w_offset, unsigned short * pw_Value)
{
char c_BitPos = 0;
/*
+----------------------------------------------------------------------------+
-| Function Name : INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress, |
+| Function Name : INT i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress, |
| char * pc_PCIChipInformation,struct comedi_device *dev) |
+----------------------------------------------------------------------------+
| Task : Read from eeprom Main Header |
+----------------------------------------------------------------------------+
-| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address |
+| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address |
| |
| char *pc_PCIChipInformation : PCI Chip Type. |
| |
+----------------------------------------------------------------------------+
*/
-INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress,
+INT i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress,
char *pc_PCIChipInformation, struct comedi_device *dev)
{
- WORD w_Temp, i, w_Count = 0;
+ unsigned short w_Temp, i, w_Count = 0;
UINT ui_Temp;
str_MainHeader s_MainHeader;
str_DigitalInputHeader s_DigitalInputHeader;
/*
+----------------------------------------------------------------------------+
-| Function Name : INT i_EepromReadDigitalInputHeader(WORD |
+| Function Name : INT i_EepromReadDigitalInputHeader(unsigned short |
| w_PCIBoardEepromAddress,char *pc_PCIChipInformation, |
-| WORD w_Address,str_DigitalInputHeader *s_Header) |
+| unsigned short w_Address,str_DigitalInputHeader *s_Header) |
| |
+----------------------------------------------------------------------------+
| Task : Read Digital Input Header |
+----------------------------------------------------------------------------+
-| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address |
+| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address |
| |
| char *pc_PCIChipInformation : PCI Chip Type. |
| |
| Return Value : 0 |
+----------------------------------------------------------------------------+
*/
-INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress,
- char *pc_PCIChipInformation, WORD w_Address,
+INT i_EepromReadDigitalInputHeader(unsigned short w_PCIBoardEepromAddress,
+ char *pc_PCIChipInformation, unsigned short w_Address,
str_DigitalInputHeader * s_Header)
{
- WORD w_Temp;
+ unsigned short w_Temp;
// read nbr of channels
s_Header->w_Nchannel =
/*
+----------------------------------------------------------------------------+
-| Function Name : INT i_EepromReadDigitalOutputHeader(WORD |
+| Function Name : INT i_EepromReadDigitalOutputHeader(unsigned short |
| w_PCIBoardEepromAddress,char *pc_PCIChipInformation, |
-| WORD w_Address,str_DigitalOutputHeader *s_Header) |
+| unsigned short w_Address,str_DigitalOutputHeader *s_Header) |
| |
+----------------------------------------------------------------------------+
| Task : Read Digital Output Header |
+----------------------------------------------------------------------------+
-| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address |
+| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address |
| |
| char *pc_PCIChipInformation : PCI Chip Type. |
| |
| Return Value : 0 |
+----------------------------------------------------------------------------+
*/
-INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress,
- char *pc_PCIChipInformation, WORD w_Address,
+INT i_EepromReadDigitalOutputHeader(unsigned short w_PCIBoardEepromAddress,
+ char *pc_PCIChipInformation, unsigned short w_Address,
str_DigitalOutputHeader * s_Header)
{
// Read Nbr channels
/*
+----------------------------------------------------------------------------+
-| Function Name : INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress, |
+| Function Name : INT i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress, |
| char *pc_PCIChipInformation,WORD w_Address, |
| str_TimerMainHeader *s_Header) |
+----------------------------------------------------------------------------+
| Task : Read Timer or Watchdog Header |
+----------------------------------------------------------------------------+
-| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address |
+| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address |
| |
| char *pc_PCIChipInformation : PCI Chip Type. |
| |
| Return Value : 0 |
+----------------------------------------------------------------------------+
*/
-INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress,
- char *pc_PCIChipInformation, WORD w_Address,
+INT i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress,
+ char *pc_PCIChipInformation, unsigned short w_Address,
str_TimerMainHeader * s_Header)
{
- WORD i, w_Size = 0, w_Temp;
+ unsigned short i, w_Size = 0, w_Temp;
//Read No of Timer
s_Header->w_Ntimer =
/*
+----------------------------------------------------------------------------+
-| Function Name : INT i_EepromReadAnlogOutputHeader(WORD |
+| Function Name : INT i_EepromReadAnlogOutputHeader(unsigned short |
| w_PCIBoardEepromAddress,char *pc_PCIChipInformation, |
-| WORD w_Address,str_AnalogOutputHeader *s_Header) |
+| unsigned short w_Address,str_AnalogOutputHeader *s_Header) |
+----------------------------------------------------------------------------+
| Task : Read Nalog Output Header |
+----------------------------------------------------------------------------+
-| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address |
+| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address |
| |
| char *pc_PCIChipInformation : PCI Chip Type. |
| |
+----------------------------------------------------------------------------+
*/
-INT i_EepromReadAnlogOutputHeader(WORD w_PCIBoardEepromAddress,
- char *pc_PCIChipInformation, WORD w_Address,
+INT i_EepromReadAnlogOutputHeader(unsigned short w_PCIBoardEepromAddress,
+ char *pc_PCIChipInformation, unsigned short w_Address,
str_AnalogOutputHeader * s_Header)
{
- WORD w_Temp;
+ unsigned short w_Temp;
// No of channels for 1st hard component
w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
pc_PCIChipInformation, 0x100 + w_Address + 10);
/*
+----------------------------------------------------------------------------+
-| Function Name : INT i_EepromReadAnlogInputHeader(WORD |
+| Function Name : INT i_EepromReadAnlogInputHeader(unsigned short |
| w_PCIBoardEepromAddress,char *pc_PCIChipInformation, |
-| WORD w_Address,str_AnalogInputHeader *s_Header) |
+| unsigned short w_Address,str_AnalogInputHeader *s_Header) |
+----------------------------------------------------------------------------+
| Task : Read Nalog Output Header |
+----------------------------------------------------------------------------+
-| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address |
+| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address |
| |
| char *pc_PCIChipInformation : PCI Chip Type. |
| |
*/
// Reads only for ONE hardware component
-INT i_EepromReadAnlogInputHeader(WORD w_PCIBoardEepromAddress,
- char *pc_PCIChipInformation, WORD w_Address,
+INT i_EepromReadAnlogInputHeader(unsigned short w_PCIBoardEepromAddress,
+ char *pc_PCIChipInformation, unsigned short w_Address,
str_AnalogInputHeader * s_Header)
{
- WORD w_Temp, w_Offset;
+ unsigned short w_Temp, w_Offset;
w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
pc_PCIChipInformation, 0x100 + w_Address + 10);
s_Header->w_Nchannel = (w_Temp >> 4) & 0x03FF;
/*| Function Name : INT i_AddiHeaderRW_ReadEeprom |*/
/*| (INT i_NbOfWordsToRead, |*/
/*| DWORD dw_PCIBoardEepromAddress, |*/
-/*| WORD w_EepromStartAddress, |*/
-/*| PWORD pw_DataRead) |*/
+/*| 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 |*/
+/*| 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)
+ unsigned short w_EepromStartAddress, unsigned short * pw_DataRead)
{
DWORD dw_eeprom_busy = 0;
INT i_Counter = 0;
unsigned char b_ReadHighByte = 0;
unsigned char b_SelectedAddressLow = 0;
unsigned char b_SelectedAddressHigh = 0;
- WORD w_ReadWord = 0;
+ unsigned short w_ReadWord = 0;
for (i_WordCounter = 0; i_WordCounter < i_NbOfWordsToRead;
i_WordCounter++) {
void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress,
str_BoardInfos * BoardInformations)
{
- WORD w_AnalogInputMainHeaderAddress;
- WORD w_AnalogInputComponentAddress;
- WORD w_NumberOfModuls = 0;
- WORD w_CurrentSources[2];
- WORD w_ModulCounter = 0;
- WORD w_FirstHeaderSize = 0;
- WORD w_NumberOfInputs = 0;
- WORD w_CJCFlag = 0;
- WORD w_NumberOfGainValue = 0;
- WORD w_SingleHeaderAddress = 0;
- WORD w_SingleHeaderSize = 0;
- WORD w_Input = 0;
- WORD w_GainFactorAddress = 0;
- WORD w_GainFactorValue[2];
- WORD w_GainIndex = 0;
- WORD w_GainValue = 0;
+ unsigned short w_AnalogInputMainHeaderAddress;
+ unsigned short w_AnalogInputComponentAddress;
+ unsigned short w_NumberOfModuls = 0;
+ unsigned short w_CurrentSources[2];
+ unsigned short w_ModulCounter = 0;
+ unsigned short w_FirstHeaderSize = 0;
+ unsigned short w_NumberOfInputs = 0;
+ unsigned short w_CJCFlag = 0;
+ unsigned short w_NumberOfGainValue = 0;
+ unsigned short w_SingleHeaderAddress = 0;
+ unsigned short w_SingleHeaderSize = 0;
+ unsigned short w_Input = 0;
+ unsigned short w_GainFactorAddress = 0;
+ unsigned short w_GainFactorValue[2];
+ unsigned short w_GainIndex = 0;
+ unsigned short w_GainValue = 0;
/*****************************************/
/** Get the Analog input header address **/