1 | /* Copyright (c) 2006 Rice University */ |
---|
2 | /* All Rights Reserved */ |
---|
3 | /* This code is covered by the Rice-WARP license */ |
---|
4 | /* See http://warp.rice.edu/license/ for details */ |
---|
5 | |
---|
6 | |
---|
7 | ////////////////////////////////////////////////////////////////////////////// |
---|
8 | // Filename: C:\EDK_User_Repository\WARP\drivers\EEPROM_v1_00_a\src\EEPROM.h |
---|
9 | // Version: 1.00.a |
---|
10 | // Description: EEPROM Driver Header File |
---|
11 | // Date: July 28, 2006 |
---|
12 | ////////////////////////////////////////////////////////////////////////////// |
---|
13 | |
---|
14 | #ifndef EEPROM_H |
---|
15 | #define EEPROM_H |
---|
16 | |
---|
17 | /***************************** Include Files *******************************/ |
---|
18 | |
---|
19 | #include "xbasic_types.h" |
---|
20 | #include "xstatus.h" |
---|
21 | #include "xio.h" |
---|
22 | #include "EEPROM_l.h" |
---|
23 | |
---|
24 | /**************************WARP LIBRARIES******************************************/ |
---|
25 | |
---|
26 | |
---|
27 | // Choose the EEPROM to be affected by subsequent reads/writes |
---|
28 | // baseaddr is the base address of the EEPROM peripheral |
---|
29 | // EEPROM_select selects the appropriate EEPROM to drive |
---|
30 | // 0: FPGA Board 1: Radio1 2: Radio2 3: Radio3 4: Radio4 |
---|
31 | // Returns SUCCESS if clock set correctly |
---|
32 | // Returns FAILURE otherwise |
---|
33 | char WarpEEPROM_EEPROMSelect(unsigned int* baseaddr, char EEPROM_select); |
---|
34 | |
---|
35 | // This function checks to see if a valid calibration value is stored on the EEPROM |
---|
36 | // and returns the value if there is. |
---|
37 | // baseaddr is the base address of the EEPROM peripheral |
---|
38 | // RxNTx specifies whether the values are the Rx or Tx values. 1 indicates Rx |
---|
39 | // val_select selects which value to write |
---|
40 | // 1: DC offset 2: Gain IQ 3: Phase IQ |
---|
41 | // Returns a short where the most significant byte is the Q-value and |
---|
42 | // the least significant byte is the I-value. |
---|
43 | short WarpEEPROM_ReadRadioCal(unsigned int* baseaddr, char RxNTx, char val_select); |
---|
44 | |
---|
45 | // This functions writes a calibration value to the EEPROM |
---|
46 | // baseaddr is the base address of the EEPROM peripheral |
---|
47 | // RxNTx specifies whether the values are the Rx or Tx values. 1 indicates Rx |
---|
48 | // val_select selects which value to write |
---|
49 | // 1: DC offset 2: Gain IQ 3: Phase IQ |
---|
50 | // I_val is the I-component to be stored |
---|
51 | // Q_val is the Q-component to be stored |
---|
52 | // Returns SUCCESS (0x00) if all goes well, FAILURE (0xff) otherwise |
---|
53 | char WarpEEPROM_WriteRadioCal(unsigned int* baseaddr, char RxNTx, char val_select, char I_val, char Q_val); |
---|
54 | |
---|
55 | // This function writes a 6-byte MAC address into a 6-byte array addressed by a pointer. |
---|
56 | // baseaddr is the base address of the EEPROM peripheral |
---|
57 | // dev_select specifies which device's MAC address to read |
---|
58 | // 0: FPGA Board 1: Radio1 2: Radio2 3: Radio3 4: Radio4 |
---|
59 | // *MAC is a pointer to a 6-byte array |
---|
60 | void WarpEEPROM_ReadMACAddress(unsigned int* baseaddr, char dev_select, char *MAC); |
---|
61 | |
---|
62 | // This function writes a 6-byte MAC address into the EEPROM. |
---|
63 | // baseaddr is the base address of the EEPROM peripheral |
---|
64 | // dev_select specifies which device's MAC address to read |
---|
65 | // 0: FPGA Board 1: Radio1 2: Radio2 3: Radio3 4: Radio4 |
---|
66 | // *MAC is a pointer to a 6-byte array containing the address |
---|
67 | // Returns SUCCESS (0x00) if all goes well, FAILURE (0xff) otherwise |
---|
68 | char WarpEEPROM_WriteMACAddress(unsigned int* baseaddr, char dev_select, char *MAC); |
---|
69 | |
---|
70 | // Returns the the 2-byte serial number assigned by Rice WARP |
---|
71 | // baseaddr is the base address of the EEPROM peripheral |
---|
72 | short WarpEEPROM_ReadWARPSerial(unsigned int* baseaddr); |
---|
73 | |
---|
74 | // Get Serial number from a EEPROM device. Assumes it is the only device on the bus. |
---|
75 | // baseaddr is the base address of the EEPROM peripheral |
---|
76 | // returns a memory array containing the 1 byte family code, 6 byte serial |
---|
77 | // serial number and 1 byte CRC value |
---|
78 | // *Serial is a pointer to an 8-byte array |
---|
79 | // Returns SUCCESS (0x00) if all goes well, FAILURE (0xff) otherwise |
---|
80 | char WarpEEPROM_ReadDSSerial(unsigned int* baseaddr, unsigned char *Serial); |
---|
81 | |
---|
82 | // This function reads from a specified memory location in the 1024-bit memory. |
---|
83 | // Returns an 8-byte sector of the EEPROM. |
---|
84 | // baseaddr is the base address of the EEPROM peripheral |
---|
85 | // page must be 1-3, and refers to memory pages on the device |
---|
86 | // sector must be 1-3, and refers to the appropriate sector on the device |
---|
87 | // *array is a pointer to an 8-byte array |
---|
88 | // Returns SUCCESS (0x00) if all goes well, FAILURE (0xff) otherwise |
---|
89 | char WarpEEPROM_ReadUserMem(unsigned int* baseaddr, char page, char sector, unsigned char *array); |
---|
90 | |
---|
91 | // Writes a given 8-byte array to a designated location in memory. |
---|
92 | // Essentially a wrapper of the WriteScratch, ReadScratch and Scratch2Mem functions |
---|
93 | // baseaddr is the base address of the EEPROM peripheral |
---|
94 | // page must be 1-3, and refers to memory pages on the device |
---|
95 | // sector must be 1-3, and refers to the appropriate sector on the device |
---|
96 | // *array is a pointer to an 8-byte array |
---|
97 | // Returns SUCCESS (0x00) if all goes well, FAILURE (0xff) otherwise |
---|
98 | char WarpEEPROM_WriteUserMem(unsigned int* baseaddr, char page, char sector, unsigned char *array); |
---|
99 | |
---|
100 | #endif // EEPROM_L_H |
---|