w3_iic_eeprom Driver
Driver for WARP v3 IIC EEPROM master (w3_iic_eeprom_v1_00_b)
Functions

Functions

void iic_eeprom_init (u32 ba, u8 clkDiv)
 
int iic_eeprom_writeByte (u32 ba, u16 addrToWrite, u8 byteToWrite)
 
int iic_eeprom_readByte (u32 ba, u16 addrToRead)
 
u32 w3_eeprom_readSerialNum (u32 ba)
 
u32 w3_eeprom_read_fpga_dna (u32 ba, int lo_hi)
 

Detailed Description

Example:

//Assumes user code sets EEPROM_BASEADDR to base address of w3_iic_eeprom core, as set in xparameters.h
int x;
u32 board_sn;
//Initialize the EEPROM controller at boot
iic_eeprom_init(EEPROM_BASEADDR, 0x64);
//Write a value to the EEPROM (set EEPROM byte address 2345 to 182)
x = iic_eeprom_writeByte(EEPROM_BASEADDR, 2345, 182);
if(x != 0) xil_printf("EEPROM Write Error!\n");
//Read the value back from EEPROM
x = iic_eeprom_readByte(EEPROM_BASEADDR, 2345);
if(x != 182) xil_printf("EEPROM Read Error (read %d, should be 182)!\n", x);
//Read the WARP v3 board serial number from the EEPROM
board_sn = w3_eeprom_readSerialNum(EEPROM_BASEADDDR);
xil_printf("Board s/n: W3-a-%05d\n", board_sn);

Function Documentation

void iic_eeprom_init ( u32  ba,
u8  clkDiv 
)

Initializes the EEPROM controller. This function must be called once at boot before any EEPROM read/write operations.

Parameters
baBase memory address of w3_iic_eeprom pcore
clkDivClock divider for IIC clock (set 0x64 for 160MHz bus)
int iic_eeprom_writeByte ( u32  ba,
u16  addrToWrite,
u8  byteToWrite 
)

Writes one bytes to the EEPROM.

Parameters
baBase memory address of w3_iic_eeprom pcore
addrToWriteByte address to write (in [0,16383])
byteToWriteByte value to write
Returns
Returns 0 if EEPROM write succeeds. Returns -1 if an error occurs.
int iic_eeprom_readByte ( u32  ba,
u16  addrToRead 
)

Reads one bytes to the EEPROM.

Parameters
baBase memory address of w3_iic_eeprom pcore
addrToReadByte address to read (in [0,16383])
Returns
If EEPROM read succeeds, the read byte is returned in the LSB. If an error occurs, returns -1.
u32 w3_eeprom_readSerialNum ( u32  ba)

Reads the WARP v3 board serial number (programmed during manufacturing)

Parameters
baBase memory address of w3_iic_eeprom pcore
Returns
Numeric part of board serial number (prefix "W3-a-" not stored in EEPROM)
u32 w3_eeprom_read_fpga_dna ( u32  ba,
int  lo_hi 
)

Reads part of the 56-bit Virtex-6 FPGA DNA value (copied to EEPROM during manufacturing)

Parameters
baBase memory address of w3_iic_eeprom pcore
lo_hiSelects between 32 LSB or 24 MSB of DNA value (0=LSB, 1=MSB)
Returns
Returns selected portion of FPGA DNA value