GNU Radio's HOWTO Package
eeprom.h
Go to the documentation of this file.
1 #define EEPROM_ADDR 0x51
2 
3 //-----------------------------------------------------------------------------
4 // Macros
5 //-----------------------------------------------------------------------------
6 // the 3684 DVK board uses port pin PA7 as an EEPROM write-protect enable/disable.
7 // If your design uses a different pin, modify the following macros accordingly.
8 #define EEPROM_ENABLE_WRITE_PROTECT() OEA &= ~0x80 // float PA7
9 #define EEPROM_DISABLE_WRITE_PROTECT() PA7 = 0; OEA |= 0x80 // drive PA7 low
10 #define MSB(word) (BYTE)(((WORD)(word) >> 8) & 0xff)
11 #define LSB(word) (BYTE)((WORD)(word) & 0xff)
12 
13 #define SWAP_ENDIAN(word) ((BYTE*)&word)[0] ^= ((BYTE*)&word)[1];\
14  ((BYTE*)&word)[1] ^= ((BYTE*)&word)[0];\
15  ((BYTE*)&word)[0] ^= ((BYTE*)&word)[1]
16 
17 //-----------------------------------------------------------------------------
18 // Function Prototypes
19 //-----------------------------------------------------------------------------
20 void EEWaitForStop();
22 static void EEStartAndAddr();
23 extern void WaitForEEPROMWrite();
24 BYTE EEPROMWritePage(WORD addr, BYTE xdata * ptr, BYTE len);
25 BYTE EEPROMRead(WORD addr, BYTE length, BYTE xdata *buf);
26 void WaitForEEPROMWrite2();
29 
30 //-----------------------------------------------------------------------------
31 // Global Variables
32 //-----------------------------------------------------------------------------
33 extern BYTE DB_Addr; // Dual Byte Address stat
34 extern BYTE I2C_Addr; // I2C address
35 extern BYTE EE_Page_Size; // EEPROM page size
36 
37 //-----------------------------------------------------------------------------
38 // Global Constants
39 //-----------------------------------------------------------------------------
40 #define SERIAL_ADDR 0x50
static void EEStartAndAddr()
BYTE I2C_Addr
BYTE EEPROMGetPageSize()
BYTE EEWaitForDone()
BYTE DB_Addr
BYTE EEPROMRead(WORD addr, BYTE length, BYTE xdata *buf)
unsigned char BYTE
Definition: fx2regs.h:72
BYTE EEPROMWritePage(WORD addr, BYTE xdata *ptr, BYTE len)
void WaitForEEPROMWrite2()
void WaitForEEPROMWrite()
void EEWaitForStop()
unsigned short WORD
Definition: fx2regs.h:73
BYTE EE_Page_Size
BYTE EEWaitForAck()