|
ssize_t | eeprom_spi_command (eeprom_25xxx_t eeprom, uint8_t *cmd, uint8_t len) |
| Sends a generic command to the SPI memory. More...
|
|
ssize_t | eeprom_spi_erase (eeprom_25xxx_t eeprom, uint32_t addr, size_t len) |
| Erases an array of bytes in the EEPROM. Erase Page command is used. More...
|
|
ssize_t | eeprom_spi_read (eeprom_25xxx_t eeprom, void *rxbuf, uint32_t addr, size_t len) |
| Reads the specified number of bytes from the EEPROM. More...
|
|
ssize_t | eeprom_spi_read_status (eeprom_25xxx_t eeprom) |
| Reads the status register of the memory. More...
|
|
ssize_t | eeprom_spi_write (eeprom_25xxx_t eeprom, uint8_t *data, uint32_t addr, size_t len) |
| Writes an array of bytes in the EEPROM. More...
|
|
ssize_t | eeprom_spi_write_enable (eeprom_25xxx_t eeprom) |
| Sets the Write-Enable Latch in the memory. More...
|
|
Platform-specific layer provides a consistent Virtual EEPROM API to upper layers of the driver.
EEPROM API Overview
This API contains the functions to initialize and control 25AAxxxx/25LCxxxx family of EEPROMs (25xx010/25xx020/25xx040/25xx080/25xx160/25xx320/25xx640/25xx128/25xx256/25xx512/25xx1024) of for the Programmable XBee devices. These EEPROMs are user-modifiable read-only memories (ROM) that are connected to the XBee modules trough the SPI interface. They can be erased and reprogrammed (written to) repeatedly.
- Functions to read/write/erase the 25xxx EEPROMs:
Platform-specific layer provides a consistent MACROS API to upper layers of the driver.
25AA/25LC SPI EEPROMs macros
The 25AA/25LC EEPROMs have 11 commands, which may be used along the eeprom_spi_command() function. Such commands are defined by the following macros: -SPI EEPROM 25AA/25LC commands:
- EEPROM_WREN : Set the write enable latch (enable write operations).
- EEPROM_WRITE : Write data to memory array beginning at selected address.
- EEPROM_READ : Read data from memory array beginning at selected address.
- EEPROM_WRDI : Reset the write enable latch (disable write operations).
- EEPROM_RDSR : Read STATUS register.
- EEPROM_WRSR : Write STATUS register.
- EEPROM_PE : Page Erase - erase one page in memory array.
- EEPROM_SE : Sector Erase - erase one sector in memory array.
- EEPROM_CE : Chip Erase - erase all sectors in memory array.
- EEPROM_RDID : Release from Deep power-down and read electronic signature.
- EEPROM_DPD : Deep Power-Down mode.
Also, the status-register's bits are defined by the following macros: -SPI EEPROM 25AA/25LC status register bits:
- EEPROM_SR_WIP : Write-In-Progress bit.
- EEPROM_SR_WEL : Write-Enable-Latch bit.
- EEPROM_SR_WPEN : Write-Protect-Enable bit.
- EEPROM_SR_BP : Block-Protecion bit.
Sends a generic command to the SPI memory.
- Parameters
-
[in] | eeprom | eeprom index to configure (use the name of the component defined by the config.xml) |
[in] | cmd | buffer containing the bytes to be written. This may be one of the 25AA/25LC SPI EEPROMs macros defined. |
[in] | len | number of bytes to write from the buffer. |
- Return values
-
<0 | if there is an error while writing in the EEPROM. |
Erases an array of bytes in the EEPROM. Erase Page command is used.
- Parameters
-
[in] | eeprom | eeprom index to configure (use the name of the component defined by the config.xml) |
[in] | addr | address of the EEPROM to start the erasing process. |
[in] | len | number of bytes to write from the buffer. |
- Return values
-
ssize_t | number of bytes that were erased. |
ERANGE | out of range |
<0 | if there is an error while erasing in the EEPROM. |
Reads the specified number of bytes from the EEPROM.
- Parameters
-
[in] | eeprom | eeprom index to configure (use the name of the component defined by the config.xml) |
[out] | rxbuf | buffer where the read bytes will be stored. |
[in] | addr | address of the EEPROM to start reading from. |
[in] | len | number of bytes to read from the EEPROM. |
- Return values
-
ssize_t | the number of bytes read. |
ERANGE | out of range. |
<0 | if there is an error while reading the EEPROM. |
Reads the status register of the memory.
- Parameters
-
[in] | eeprom | eeprom index to configure (use the name of the component defined by the config.xml) |
[in] | cmd | buffer containing the bytes to be written. |
[in] | len | number of bytes to write from the buffer. |
- Return values
-
Returns | the status register. |
<0 | if there is an error while writing in the EEPROM. |
Writes an array of bytes in the EEPROM.
- Parameters
-
[in] | eeprom | eeprom index to configure (use the name of the component defined by the config.xml) |
[in] | data | buffer containing the bytes to be written. |
[in] | addr | address of the EEPROM to start the writing process. |
[in] | len | number of bytes to write from the buffer. |
- Return values
-
ssize_t | number of bytes that where written. |
ERANGE | out of range |
<0 | if there is an error while writing in the EEPROM. |
Sets the Write-Enable Latch in the memory.
- Parameters
-
[in] | eeprom | eeprom index to configure (use the name of the component defined by the config.xml) |
- Return values
-
<0 | if there is an error while writing in the EEPROM. |