= The EEPROM = == Basic Functionality == * 1024-bit memory space divided into 4 pages. * 3 of these are given unlimited user read and write capabilities * the other page is used for storing calibration values and MAC addresses * Each page is divided into 4 sectors of 8-bytes each. Read or write functions must be performed on an entire sector. * These functions require the user to provide a pointer to an 8-byte data array * Readable 64-bit lasered ROM containing 8-bit family code, 48-bit serial code, and 8-bit Cyclic Redundancy check (CRC). * Readable 16-bit serial code given by WARP * The provided libaries are divided into EEPROM_l.c and EEPROM.c -- The latter contains everything the User needs to drive the EEPROM. * The EEPROM.c library provides the following functionality: * Select a radio to be affected by subsequent reads/writes * Read valid calibration values that have been stored to a radio's EEPROM * Write calibration value to a radio's EEPROM * Read valid MAC addresses of the FPGA board and radios from the FPGA's EEPROM * Write MAC addresses of the FPGA board and radios to the FPGA's EEPROM * Read the 16-bit serial number given by WARP * Read the 64-bit lasered ROM written by the EEPROM manufacturer * Read data from the EEPROMs data pages * Write data to the EEPROMs data pages A part of the header file EEPROM.h is given below. '''''char WarpEEPROM_EEPROMSelect(unsigned int* baseaddr, char EEPROM_select)'''''[[BR]] - Choose the EEPROM to be affected by subsequent reads/writes[[BR]] - ''baseaddr'' is the base address of the EEPROM peripheral[[BR]] - ''EEPROM_select'' selects the appropriate EEPROM to drive[[BR]] 0: FPGA Board 1: Radio1 2: Radio2 3: Radio3 4: Radio4[[BR]] - Returns SUCCESS if clock set correctly[[BR]] - Returns FAILURE otherwise [[BR]] '''''short WarpEEPROM_ReadRadioCal(unsigned int* baseaddr, char RxNTx, char val_select)'''''[[BR]] - This function checks to see if a valid calibration value is stored on the EEPROM[[BR]] and returns the value if so.[[BR]] - ''baseaddr'' is the base address of the EEPROM peripheral[[BR]] - ''RxNTx'' specifies whether the values are the Rx or Tx values. 1 indicates Rx[[BR]] - ''val_select'' selects which value to write[[BR]] 0: DC offset 1: Gain IQ 2: Phase IQ[[BR]] - Returns a short where the most significant byte is the Q-value and [[BR]] the least significant byte is the I-value.[[BR]] '''''char WarpEEPROM_WriteRadioCal(unsigned int* baseaddr, char RxNTx, char val_select, char I_val, char Q_val)'''''[[BR]] - This function writes a calibration value to the EEPROM[[BR]] - ''baseaddr'' is the base address of the EEPROM peripheral[[BR]] - ''RxNTx'' specifies whether the values are the Rx or Tx values. 1 indicates Rx[[BR]] - ''val_select'' selects which value to write[[BR]] 0: DC offset 1: Gain IQ 2: Phase IQ[[BR]] - ''I_val'' is the I-component to be stored[[BR]] - ''Q_val'' is the Q-component to be stored[[BR]] - Returns SUCCESS (0x00) if all goes well, FAILURE (0xff) otherwise[[BR]] '''''void WarpEEPROM_ReadMACAddress(unsigned int* baseaddr, char dev_select, char *MAC)'''''[[BR]] - This function writes a 6-byte MAC address into a 6-byte array addressed by a pointer.[[BR]] - ''baseaddr'' is the base address of the EEPROM peripheral[[BR]] - ''dev_select'' specifies which device's MAC address to read[[BR]] 0: FPGA Board 1: Radio1 2: Radio2 3: Radio3 4: Radio4[[BR]] - ''*MAC'' is a pointer to a 6-byte array[[BR]] '''''char WarpEEPROM_WriteMACAddress(unsigned int* baseaddr, char dev_select, char *MAC)'''''[[BR]] - This function writes a 6-byte MAC address into the EEPROM.[[BR]] - ''baseaddr'' is the base address of the EEPROM peripheral[[BR]] - ''dev_select'' specifies which device's MAC address to read[[BR]] 0: FPGA Board 1: Radio1 2: Radio2 3: Radio3 4: Radio4[[BR]] - ''*MAC'' is a pointer to a 6-byte array containing the address[[BR]] - Returns SUCCESS if all goes well, FAILURE otherwise[[BR]] '''''short WarpEEPROM_ReadWARPSerial(unsigned int* baseaddr)'''''[[BR]] - Returns the the 2-byte serial number assigned by Rice WARP[[BR]] - ''baseaddr'' is the base address of the EEPROM peripheral '''''void WarpEEPROM_ReadDSSerial(unsigned int* baseaddr, unsigned char *Serial)'''''[[BR]] - Get Serial number from a EEPROM device. Assumes it is the only device on the bus.[[BR]] - ''baseaddr'' is the base address of the EEPROM peripheral[[BR]] - ''*Serial'' is a pointer to an 8 byte array - returns a memory array containing the 1 byte family code, 6 byte serial[[BR]] serial number and 1 byte CRC value[[BR]] '''''char WarpEEPROM_ReadUserMem(unsigned int* baseaddr, char page, char sector, unsigned char *array)'''''[[BR]] - This function reads from a specified memory location in the 1024-bit memory.[[BR]] - Returns an 8-byte sector of the EEPROM. [[BR]] - ''baseaddr'' is the base address of the EEPROM peripheral[[BR]] - ''page'' must be 1-3, and refers to memory pages on the device[[BR]] - ''sector'' must be 1-3, and refers to the appropriate sector on the device[[BR]] - ''*array'' is a pointer to an 8-byte array[[[BR]] - Returns SUCCESS (0x00) if no error, otherwise FAILURE (0xff) [[BR]] '''''char WarpEEPROM_WriteUserMem(unsigned int* baseaddr, char page, char sector, unsigned char *array)'''''[[BR]] - Writes a given 8-byte array to a designated location in memory.[[BR]] - Essentially a wrapper of the !WriteScratch, !ReadScratch and Scratch2Mem functions[[BR]] - ''baseaddr'' is the base address of the EEPROM peripheral[[BR]] - ''page'' must be 1-3, and refers to memory pages on the device[[BR]] - ''sector'' must be 1-3, and refers to the appropriate sector on the device[[BR]] - ''*array'' is a pointer to an 8-byte array[[BR]] - Returns SUCCESS (0x00) if all goes well, FAILURE (0xff) otherwise [[BR]] See a mapping of the memory space here:[[BR]] [[Image(WARPImages:EEPROM_memmap.png, align=center,300)]]