+----------+-----------+------------------------------------------------+
*/
-#define NVCMD_BEGIN_READ (0x7 << 5 ) // nvRam begin read command
-#define NVCMD_LOAD_LOW (0x4 << 5 ) // nvRam load low command
-#define NVCMD_LOAD_HIGH (0x5 << 5 ) // nvRam load high command
-#define EE76_CMD_LEN 13 // bits in instructions
-#define EE_READ 0x0180 // 01 1000 0000 read instruction
+#define NVCMD_BEGIN_READ (0x7 << 5 ) /* nvRam begin read command */
+#define NVCMD_LOAD_LOW (0x4 << 5 ) /* nvRam load low command */
+#define NVCMD_LOAD_HIGH (0x5 << 5 ) /* nvRam load high command */
+#define EE76_CMD_LEN 13 /* bits in instructions */
+#define EE_READ 0x0180 /* 01 1000 0000 read instruction */
#define EEPROM_DIGITALINPUT 0
#define EEPROM_DIGITALOUTPUT 1
struct str_Functionality s_Functions[7];
};
-typedef struct {
+struct str_DigitalInputHeader {
unsigned short w_Nchannel;
unsigned char b_Interruptible;
unsigned short w_NinterruptLogic;
-} str_DigitalInputHeader;
+};
+
+struct str_DigitalOutputHeader {
-typedef struct {
unsigned short w_Nchannel;
-} str_DigitalOutputHeader;
+};
-// used for timer as well as watchdog
-typedef struct {
+/* used for timer as well as watchdog */
+
+struct str_TimerDetails {
+
unsigned short w_HeaderSize;
unsigned char b_Resolution;
- unsigned char b_Mode; // in case of Watchdog it is functionality
+ unsigned char b_Mode; /* in case of Watchdog it is functionality */
unsigned short w_MinTiming;
unsigned char b_TimeBase;
-} str_TimerDetails;
-typedef struct {
+};
+
+struct str_TimerMainHeader {
+
unsigned short w_Ntimer;
- str_TimerDetails s_TimerDetails[4]; // supports 4 timers
-} str_TimerMainHeader;
+ struct str_TimerDetails s_TimerDetails[4]; /* supports 4 timers */
+};
+
typedef struct {
unsigned short w_Nchannel;
unsigned char b_Resolution;
} str_AnalogOutputHeader;
-typedef struct {
+struct str_AnalogInputHeader {
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_EepromReadDigitalInputHeader(unsigned short w_PCIBoardEepromAddress,
char *pc_PCIChipInformation, unsigned short w_Address,
- str_DigitalInputHeader * s_Header);
+ struct str_DigitalInputHeader * s_Header);
int i_EepromReadDigitalOutputHeader(unsigned short w_PCIBoardEepromAddress,
char *pc_PCIChipInformation, unsigned short w_Address,
- str_DigitalOutputHeader * s_Header);
+ struct str_DigitalOutputHeader * s_Header);
int i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress,
char *pc_PCIChipInformation, unsigned short w_Address,
- str_TimerMainHeader * s_Header);
+ struct str_TimerMainHeader * s_Header);
int i_EepromReadAnlogOutputHeader(unsigned short w_PCIBoardEepromAddress,
char *pc_PCIChipInformation, unsigned short w_Address,
int i_EepromReadAnlogInputHeader(unsigned short w_PCIBoardEepromAddress,
char *pc_PCIChipInformation, unsigned short w_Address,
- str_AnalogInputHeader * s_Header);
+ struct str_AnalogInputHeader * s_Header);
/******************************************/
/* Eeprom Specific Functions */
for (b_Counter = 0; b_Counter < 2; b_Counter++)
{
- b_SelectedAddressLow = (w_EepromStartAddress + b_Counter) % 256; //Read the low 8 bit part
+ b_SelectedAddressLow = (w_EepromStartAddress + b_Counter) % 256; /* Read the low 8 bit part */
- b_SelectedAddressHigh = (w_EepromStartAddress + b_Counter) / 256; //Read the high 8 bit part
+ b_SelectedAddressHigh = (w_EepromStartAddress + b_Counter) / 256; /* Read the high 8 bit part */
/************************************/
b_ReadLowByte = b_ReadByte;
- } // if(b_Counter==0)
+ } /* if(b_Counter==0) */
else
{
b_ReadHighByte = b_ReadByte;
- } // if(b_Counter==0)
+ } /* if(b_Counter==0) */
- } // for (b_Counter=0; b_Counter<2; b_Counter++)
+ } /* for (b_Counter=0; b_Counter<2; b_Counter++) */
w_ReadWord = (b_ReadLowByte | (((unsigned short) b_ReadHighByte) * 256));
- } // end of if ((!strcmp(pc_PCIChipInformation, "S5920")) || (!strcmp(pc_PCIChipInformation, "S5933")))
+ } /* end of if ((!strcmp(pc_PCIChipInformation, "S5920")) || (!strcmp(pc_PCIChipInformation, "S5933"))) */
if (!strcmp(pc_PCIChipInformation, "93C76"))
{
unsigned short w_Temp, i, w_Count = 0;
unsigned int ui_Temp;
struct str_MainHeader s_MainHeader;
- str_DigitalInputHeader s_DigitalInputHeader;
- str_DigitalOutputHeader s_DigitalOutputHeader;
- //str_TimerMainHeader s_TimerMainHeader,s_WatchdogMainHeader;
+ struct str_DigitalInputHeader s_DigitalInputHeader;
+ struct str_DigitalOutputHeader s_DigitalOutputHeader;
+ //struct str_TimerMainHeader s_TimerMainHeader,s_WatchdogMainHeader;
str_AnalogOutputHeader s_AnalogOutputHeader;
- str_AnalogInputHeader s_AnalogInputHeader;
+ struct str_AnalogInputHeader s_AnalogInputHeader;
// Read size
s_MainHeader.w_HeaderSize =
break;
case EEPROM_TIMER:
- this_board->i_Timer = 1; //Timer subdevice present
+ this_board->i_Timer = 1; /* Timer subdevice present */
break;
case EEPROM_WATCHDOG:
- this_board->i_Timer = 1; //Timer subdevice present
+ this_board->i_Timer = 1; /* Timer subdevice present */
break;
case EEPROM_TIMER_WATCHDOG_COUNTER:
- this_board->i_Timer = 1; //Timer subdevice present
+ this_board->i_Timer = 1; /* Timer subdevice present */
}
}
+----------------------------------------------------------------------------+
| Function Name : int i_EepromReadDigitalInputHeader(unsigned short |
| w_PCIBoardEepromAddress,char *pc_PCIChipInformation, |
-| unsigned short w_Address,str_DigitalInputHeader *s_Header) |
+| unsigned short w_Address,struct str_DigitalInputHeader *s_Header) |
| |
+----------------------------------------------------------------------------+
| Task : Read Digital Input Header |
| |
| char *pc_PCIChipInformation : PCI Chip Type. |
| |
-| str_DigitalInputHeader *s_Header: Digita Input Header |
+| struct str_DigitalInputHeader *s_Header: Digita Input Header |
| Pointer |
+----------------------------------------------------------------------------+
| Output Parameters : - |
*/
int i_EepromReadDigitalInputHeader(unsigned short w_PCIBoardEepromAddress,
char *pc_PCIChipInformation, unsigned short w_Address,
- str_DigitalInputHeader * s_Header)
+ struct str_DigitalInputHeader *s_Header)
{
unsigned short w_Temp;
- // read nbr of channels
+ /* read nbr of channels */
s_Header->w_Nchannel =
w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
0x100 + w_Address + 6);
- // interruptible or not
+ /* interruptible or not */
w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
pc_PCIChipInformation, 0x100 + w_Address + 8);
s_Header->b_Interruptible = (unsigned char) (w_Temp >> 7) & 0x01;
-// How many interruptible logic
+/* How many interruptible logic */
s_Header->w_NinterruptLogic =
w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
0x100 + w_Address + 10);
+----------------------------------------------------------------------------+
| Function Name : int i_EepromReadDigitalOutputHeader(unsigned short |
| w_PCIBoardEepromAddress,char *pc_PCIChipInformation, |
-| unsigned short w_Address,str_DigitalOutputHeader *s_Header) |
+| unsigned short w_Address,struct str_DigitalOutputHeader *s_Header) |
| |
+----------------------------------------------------------------------------+
| Task : Read Digital Output Header |
| |
| char *pc_PCIChipInformation : PCI Chip Type. |
| |
-| str_DigitalOutputHeader *s_Header: Digital Output Header|
+| struct str_DigitalOutputHeader *s_Header: Digital Output Header|
| Pointer |
+----------------------------------------------------------------------------+
| Output Parameters : - |
*/
int i_EepromReadDigitalOutputHeader(unsigned short w_PCIBoardEepromAddress,
char *pc_PCIChipInformation, unsigned short w_Address,
- str_DigitalOutputHeader * s_Header)
+ struct str_DigitalOutputHeader * s_Header)
{
-// Read Nbr channels
+/* Read Nbr channels */
s_Header->w_Nchannel =
w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
0x100 + w_Address + 6);
+----------------------------------------------------------------------------+
| Function Name : int i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress, |
| char *pc_PCIChipInformation,WORD w_Address, |
-| str_TimerMainHeader *s_Header) |
+| struct str_TimerMainHeader *s_Header) |
+----------------------------------------------------------------------------+
| Task : Read Timer or Watchdog Header |
+----------------------------------------------------------------------------+
| |
| char *pc_PCIChipInformation : PCI Chip Type. |
| |
-| str_TimerMainHeader *s_Header: Timer Header |
+| struct str_TimerMainHeader *s_Header: Timer Header |
| Pointer |
+----------------------------------------------------------------------------+
| Output Parameters : - |
*/
int i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress,
char *pc_PCIChipInformation, unsigned short w_Address,
- str_TimerMainHeader * s_Header)
+ struct str_TimerMainHeader * s_Header)
{
unsigned short i, w_Size = 0, w_Temp;
-//Read No of Timer
+/* Read No of Timer */
s_Header->w_Ntimer =
w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
0x100 + w_Address + 6);
-//Read header size
+/* Read header size */
for (i = 0; i < s_Header->w_Ntimer; i++) {
s_Header->s_TimerDetails[i].w_HeaderSize =
pc_PCIChipInformation,
0x100 + w_Address + 8 + w_Size + 2);
- //Read Resolution
+ /* Read Resolution */
s_Header->s_TimerDetails[i].b_Resolution =
(unsigned char) (w_Temp >> 10) & 0x3F;
- //Read Mode
+ /* Read Mode */
s_Header->s_TimerDetails[i].b_Mode =
(unsigned char) (w_Temp >> 4) & 0x3F;
pc_PCIChipInformation,
0x100 + w_Address + 8 + w_Size + 4);
- //Read MinTiming
+ /* Read MinTiming */
s_Header->s_TimerDetails[i].w_MinTiming = (w_Temp >> 6) & 0x3FF;
- //Read Timebase
+ /* Read Timebase */
s_Header->s_TimerDetails[i].b_TimeBase = (unsigned char) (w_Temp) & 0x3F;
w_Size += s_Header->s_TimerDetails[i].w_HeaderSize;
}
str_AnalogOutputHeader * s_Header)
{
unsigned short w_Temp;
- // No of channels for 1st hard component
+ /* No of channels for 1st hard component */
w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
pc_PCIChipInformation, 0x100 + w_Address + 10);
s_Header->w_Nchannel = (w_Temp >> 4) & 0x03FF;
- // Resolution for 1st hard component
+ /* Resolution for 1st hard component */
w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
pc_PCIChipInformation, 0x100 + w_Address + 16);
s_Header->b_Resolution = (unsigned char) (w_Temp >> 8) & 0xFF;
+----------------------------------------------------------------------------+
| Function Name : int i_EepromReadAnlogInputHeader(unsigned short |
| w_PCIBoardEepromAddress,char *pc_PCIChipInformation, |
-| unsigned short w_Address,str_AnalogInputHeader *s_Header) |
+| unsigned short w_Address,struct str_AnalogInputHeader *s_Header) |
+----------------------------------------------------------------------------+
| Task : Read Nalog Output Header |
+----------------------------------------------------------------------------+
| |
| char *pc_PCIChipInformation : PCI Chip Type. |
| |
-| str_AnalogInputHeader *s_Header:Anlog Input Header |
+| struct str_AnalogInputHeader *s_Header:Anlog Input Header |
| Pointer |
+----------------------------------------------------------------------------+
| Output Parameters : - |
+----------------------------------------------------------------------------+
*/
-// Reads only for ONE hardware component
+/* Reads only for ONE hardware component */
int i_EepromReadAnlogInputHeader(unsigned short w_PCIBoardEepromAddress,
char *pc_PCIChipInformation, unsigned short w_Address,
- str_AnalogInputHeader * s_Header)
+ struct str_AnalogInputHeader * s_Header)
{
unsigned short w_Temp, w_Offset;
w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
0x100 + w_Address + 30);
w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
pc_PCIChipInformation, 0x100 + w_Address + 20);
- s_Header->b_HasDma = (w_Temp >> 13) & 0x01; // whether dma present or not
+ s_Header->b_HasDma = (w_Temp >> 13) & 0x01; /* whether dma present or not */
- w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + w_Address + 72); // reading Y
+ w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + w_Address + 72); /* reading Y */
w_Temp = w_Temp & 0x00FF;
- if (w_Temp) //Y>0
+ if (w_Temp) /* Y>0 */
{
- w_Offset = 74 + (2 * w_Temp) + (10 * (1 + (w_Temp / 16))); // offset of first analog input single header
- w_Offset = w_Offset + 2; // resolution
- } else //Y=0
+ w_Offset = 74 + (2 * w_Temp) + (10 * (1 + (w_Temp / 16))); /* offset of first analog input single header */
+ w_Offset = w_Offset + 2; /* resolution */
+ } else /* Y=0 */
{
w_Offset = 74;
- w_Offset = w_Offset + 2; // resolution
+ w_Offset = w_Offset + 2; /* resolution */
}
-// read Resolution
+/* read Resolution */
w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
pc_PCIChipInformation, 0x100 + w_Address + w_Offset);
- s_Header->b_Resolution = w_Temp & 0x001F; // last 5 bits
+ s_Header->b_Resolution = w_Temp & 0x001F; /* last 5 bits */
return 0;
}