iPXE
|
Three-wire serial interface. More...
Go to the source code of this file.
Macros | |
#define | THREEWIRE_READ 0x6 |
Read data from memory array. More... | |
#define | THREEWIRE_WRITE 0x5 |
Write data to memory array. More... | |
#define | THREEWIRE_EWEN 0x4 |
Write enable. More... | |
#define | THREEWIRE_EWEN_ADDRESS INT_MAX |
Address to be used for write enable command. More... | |
#define | THREEWIRE_WRITE_MDELAY 10 |
Time to wait for write cycles to complete. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER) | |
int | threewire_read (struct nvs_device *nvs, unsigned int address, void *data, size_t len) |
Read data from three-wire device. More... | |
int | threewire_write (struct nvs_device *nvs, unsigned int address, const void *data, size_t len) |
Write data to three-wire device. More... | |
int | threewire_detect_address_len (struct spi_device *device) |
Autodetect device address length. More... | |
static | __attribute__ ((always_inline)) void init_at93c06(struct spi_device *device |
Initialise Atmel AT93C06 serial EEPROM. More... | |
init_at93cx6 (device, organisation) | |
Variables | |
static unsigned int | organisation |
device nvs | block_size = 1 |
device | command_len = 3 |
device device nvs | read = threewire_read |
device nvs | write = threewire_write |
device | address_len = ( ( organisation == 8 ) ? 7 : 6 ) |
Three-wire serial interface.
The Atmel three-wire interface is a subset of the (newer) SPI interface, and is implemented here as a layer on top of the SPI support.
Definition in file threewire.h.
FILE_LICENCE | ( | GPL2_OR_LATER | ) |
int threewire_read | ( | struct nvs_device * | nvs, |
unsigned int | address, | ||
void * | data, | ||
size_t | len | ||
) |
Read data from three-wire device.
nvs | NVS device |
address | Address from which to read |
data | Data buffer |
len | Length of data buffer |
rc | Return status code |
Definition at line 47 of file threewire.c.
References address, assert(), bus, data, DBGC, len, NULL, spi_device::nvs, rc, SPI_MODE_THREEWIRE, strerror(), and THREEWIRE_READ.
Referenced by threewire_detect_address_len().
int threewire_write | ( | struct nvs_device * | nvs, |
unsigned int | address, | ||
const void * | data, | ||
size_t | len | ||
) |
Write data to three-wire device.
nvs | NVS device |
address | Address from which to read |
data | Data buffer |
len | Length of data buffer |
rc | Return status code |
Definition at line 77 of file threewire.c.
References address, assert(), bus, data, DBGC, len, mdelay(), NULL, spi_device::nvs, rc, SPI_MODE_THREEWIRE, strerror(), THREEWIRE_EWEN, THREEWIRE_EWEN_ADDRESS, THREEWIRE_WRITE, and THREEWIRE_WRITE_MDELAY.
int threewire_detect_address_len | ( | struct spi_device * | device | ) |
Autodetect device address length.
device | SPI device |
rc | Return status code |
Definition at line 119 of file threewire.c.
References DBGC, NULL, rc, SPI_AUTODETECT_ADDRESS_LEN, strerror(), threewire_read(), and nvs_device::word_len_log2.
Referenced by ifec_init_eeprom().