1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-11-18 07:44:57 +00:00
gnss-sdr/firmware/GN3S_v2/include/eeprom.h
Javier Arribas b849b20a8c Added optional support for Sparkfun SiGe GN3S USB GPS RF sampler:
- Added a pre-compiled custom GN3S firmware.
- Added a fully-compliant GNU Radio source block for GN3S USB dongle. It can be used also from GNU Radio companion and from Python applications.
- Added a new GN3S_Signal_Source block. It is possible to disable the GN3S signal source compilation. See README.

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@217 64b25241-fba3-4117-9849-534c7e92360d
2012-07-30 15:46:07 +00:00

41 lines
1.8 KiB
C

#define EEPROM_ADDR 0x51
//-----------------------------------------------------------------------------
// Macros
//-----------------------------------------------------------------------------
// the 3684 DVK board uses port pin PA7 as an EEPROM write-protect enable/disable.
// If your design uses a different pin, modify the following macros accordingly.
#define EEPROM_ENABLE_WRITE_PROTECT() OEA &= ~0x80 // float PA7
#define EEPROM_DISABLE_WRITE_PROTECT() PA7 = 0; OEA |= 0x80 // drive PA7 low
#define MSB(word) (BYTE)(((WORD)(word) >> 8) & 0xff)
#define LSB(word) (BYTE)((WORD)(word) & 0xff)
#define SWAP_ENDIAN(word) ((BYTE*)&word)[0] ^= ((BYTE*)&word)[1];\
((BYTE*)&word)[1] ^= ((BYTE*)&word)[0];\
((BYTE*)&word)[0] ^= ((BYTE*)&word)[1]
//-----------------------------------------------------------------------------
// Function Prototypes
//-----------------------------------------------------------------------------
void EEWaitForStop();
BYTE EEWaitForAck();
static void EEStartAndAddr();
extern void WaitForEEPROMWrite();
BYTE EEPROMWritePage(WORD addr, BYTE xdata * ptr, BYTE len);
BYTE EEPROMRead(WORD addr, BYTE length, BYTE xdata *buf);
void WaitForEEPROMWrite2();
BYTE EEWaitForDone();
BYTE EEPROMGetPageSize();
//-----------------------------------------------------------------------------
// Global Variables
//-----------------------------------------------------------------------------
extern BYTE DB_Addr; // Dual Byte Address stat
extern BYTE I2C_Addr; // I2C address
extern BYTE EE_Page_Size; // EEPROM page size
//-----------------------------------------------------------------------------
// Global Constants
//-----------------------------------------------------------------------------
#define SERIAL_ADDR 0x50