![]() |
spips
Vitis Drivers API Documentation
|
Macros | |
| #define | WRITE_STATUS_CMD 1 |
| Write status register command. More... | |
| #define | WRITE_CMD 2 |
| Write data command. More... | |
| #define | READ_CMD 3 |
| Read data command. More... | |
| #define | WRITE_DISABLE_CMD 4 |
| Write disable command. More... | |
| #define | READ_STATUS_CMD 5 |
| Read status register command. More... | |
| #define | WRITE_ENABLE_CMD 6 |
| Write enable command. More... | |
| #define | COMMAND_OFFSET 0 |
| EEPROM instruction. More... | |
| #define | ADDRESS_MSB_OFFSET 1 |
| MSB of address to read or write. More... | |
| #define | ADDRESS_LSB_OFFSET 2 |
| LSB of address to read or write. More... | |
| #define | DATA_OFFSET 3 |
| Start of data in the buffer. More... | |
| #define | WRITE_DATA_OFFSET 3 |
| Start of data to write to the EEPROM. More... | |
| #define | READ_DATA_OFFSET 6 |
| Start of data read from the EEPROM. More... | |
| #define | OVERHEAD_SIZE 3 |
| Command and address bytes. More... | |
| #define | PAGE_SIZE 16 |
| EEPROM page size in bytes. More... | |
| #define | PAGE_COUNT 128 |
| Number of EEPROM pages. More... | |
| #define | MAX_DATA PAGE_COUNT * PAGE_SIZE |
| Max data size. More... | |
| #define | BUFFER_SIZE MAX_DATA + READ_DATA_OFFSET |
| Size of the buffer holding the data and the overhead bytes. More... | |
| #define | EEPROM_SPI_SELECT 0x01 |
| EEPROM slave select. More... | |
Typedefs | |
| typedef u8 | EepromBuffer [BUFFER_SIZE] |
| Holds the data sent to and received from the serial EEPROM device. More... | |
Functions | |
| void | SpiHandler (void *CallBackRef, u32 StatusEvent, unsigned int ByteCount) |
| Handles the status events of the SPI driver. More... | |
| int | SpiPsEepromIntrExample (XSpiPs *SpiInstancePtr, UINTPTR BaseAddress) |
| Illustrates how to use the XSpiPs device driver in interrupt mode. More... | |
| int | main (void) |
| Calls the SPI EEPROM interrupt example. More... | |
Variables | |
| volatile int | TransferInProgress |
| Indicates that an SPI transfer is in progress. More... | |
| int | Error |
| Tracks any errors that occur during interrupt processing. More... | |
| int | Test |
| Holds a test value added to the values written to the EEPROM. More... | |
| EepromBuffer | ReadBuffer |
| Data read from the EEPROM. More... | |
| EepromBuffer | WriteBuffer |
| Data to write to the EEPROM. More... | |
| #define ADDRESS_LSB_OFFSET 2 |
LSB of address to read or write.
Referenced by EepromRead(), and EepromWrite().
| #define ADDRESS_MSB_OFFSET 1 |
MSB of address to read or write.
Referenced by EepromRead(), and EepromWrite().
| #define BUFFER_SIZE MAX_DATA + READ_DATA_OFFSET |
Size of the buffer holding the data and the overhead bytes.
| #define COMMAND_OFFSET 0 |
EEPROM instruction.
Referenced by EepromRead(), and EepromWrite().
| #define DATA_OFFSET 3 |
Start of data in the buffer.
Referenced by EepromRead().
| #define EEPROM_SPI_SELECT 0x01 |
EEPROM slave select.
Referenced by SpiPsEepromIntrExample().
| #define MAX_DATA PAGE_COUNT * PAGE_SIZE |
Max data size.
Referenced by SpiPsEepromIntrExample().
| #define OVERHEAD_SIZE 3 |
Command and address bytes.
Referenced by EepromRead(), and EepromWrite().
| #define PAGE_COUNT 128 |
Number of EEPROM pages.
Referenced by SpiPsEepromIntrExample().
| #define PAGE_SIZE 16 |
EEPROM page size in bytes.
Referenced by SpiPsEepromIntrExample().
| #define READ_CMD 3 |
Read data command.
Referenced by EepromRead().
| #define READ_DATA_OFFSET 6 |
Start of data read from the EEPROM.
Referenced by SpiPsEepromIntrExample().
| #define READ_STATUS_CMD 5 |
Read status register command.
Referenced by EepromWrite().
| #define WRITE_CMD 2 |
Write data command.
Referenced by EepromWrite().
| #define WRITE_DATA_OFFSET 3 |
Start of data to write to the EEPROM.
Referenced by SpiPsEepromIntrExample().
| #define WRITE_DISABLE_CMD 4 |
Write disable command.
| #define WRITE_ENABLE_CMD 6 |
Write enable command.
Referenced by EepromWrite().
| #define WRITE_STATUS_CMD 1 |
Write status register command.
| typedef u8 EepromBuffer[BUFFER_SIZE] |
Holds the data sent to and received from the serial EEPROM device.
The data type sends and receives data to the serial EEPROM device connected to the SPI interface. It is an array of bytes rather than a structure for portability avoiding packing issues. The application must setup the data to be written in this buffer and retrieve the data read from it.
| int main | ( | void | ) |
Calls the SPI EEPROM interrupt example.
References SpiPsEepromIntrExample().
| void SpiHandler | ( | void * | CallBackRef, |
| u32 | StatusEvent, | ||
| unsigned int | ByteCount | ||
| ) |
Handles the status events of the SPI driver.
It is called from an interrupt context such that the amount of processing performed should be minimized. It is called when a transfer of SPI data completes or an error occurs.
This handler provides an example of how to handle SPI interrupts but is application specific.
| [in] | CallBackRef | A reference passed to the handler. |
| [in] | StatusEvent | The status of the SPI . |
| [in] | ByteCount | The number of bytes transferred. |
References Error, and TransferInProgress.
Referenced by SpiPsEepromIntrExample().
| int SpiPsEepromIntrExample | ( | XSpiPs * | SpiInstancePtr, |
| UINTPTR | BaseAddress | ||
| ) |
Illustrates how to use the XSpiPs device driver in interrupt mode.
This test writes and reads data from a serial EEPROM. This part must be present in the hardware to use this example.
| [in] | SpiInstancePtr | Pointer to the SPI driver to use. |
| [in] | BaseAddress | The base address of the device. |
References XSpiPs_Config::BaseAddress, EEPROM_SPI_SELECT, EepromRead(), EepromWrite(), XSpiPs_Config::IntrId, XSpiPs_Config::IntrParent, MAX_DATA, PAGE_COUNT, PAGE_SIZE, READ_DATA_OFFSET, ReadBuffer, SpiHandler(), Test, WRITE_DATA_OFFSET, WriteBuffer, XSpiPs_CfgInitialize(), XSPIPS_CLK_PRESCALE_64, XSPIPS_FORCE_SSELECT_OPTION, XSpiPs_InterruptHandler(), XSpiPs_LookupConfig(), XSPIPS_MASTER_OPTION, XSpiPs_SelfTest(), XSpiPs_SetClkPrescaler(), XSpiPs_SetOptions(), XSpiPs_SetSlaveSelect(), and XSpiPs_SetStatusHandler().
Referenced by main().
| int Error |
Tracks any errors that occur during interrupt processing.
Referenced by SpiHandler(), and SpiPsHandler().
| EepromBuffer ReadBuffer |
Data read from the EEPROM.
Referenced by SpiPsEepromIntrExample(), SpiPsEepromPolledExample(), SpiPsFlashIntrExample(), SpiPsFlashPolledExample(), and SpiPsSlavePolledExample().
| int Test |
Holds a test value added to the values written to the EEPROM.
The variable allows a test value to be added to the values that are written to the EEPROM such that unique values can be generated to guarantee the writes to the EEPROM were successful
Referenced by SpiPsEepromIntrExample(), and SpiPsEepromPolledExample().
| volatile int TransferInProgress |
Indicates that an SPI transfer is in progress.
The variable is shared between non-interrupt processing and interrupt processing such that it must be global.
Referenced by EepromRead(), EepromWrite(), SpiHandler(), and SpiPsHandler().
| EepromBuffer WriteBuffer |
Data to write to the EEPROM.
Referenced by SpiPsEepromIntrExample(), SpiPsEepromPolledExample(), SpiPsFlashIntrExample(), SpiPsFlashPolledExample(), and SpiPsSlavePolledExample().