![]() |
EVE 1.0
|
![]() |
Data Structures | |
struct | spi_memory_t |
struct | spi_memory_data_buffer_header |
Macros | |
#define | SPI_MEMORY_HINT_GENERIC 0 |
#define | SPI_MEMORY_HINT_GENERIC_SRAM 1 |
#define | SPI_MEMORY_DATA_BUFFER_COMMAND_SIZE 4 |
#define | SPI_MEMORY_DATA_BUFFER_TYPE(type, size) |
Typedefs | |
typedef void(* | spi_memory_completion_callback_t) (const struct spi_memory_t *Memory, struct spi_memory_data_buffer_header *BufferHeader) |
Functions | |
SPI_MEMORY_DATA_BUFFER_TYPE (spi_memory_generic_buffer_t, 0) | |
Functions called from application programs | |
bool | SpiMemoryInit (const struct spi_memory_t *Memory) |
Name: SpiMemoryInit Waits for power on and then release SPI memory from deep powerdown. KŲ!! ???????????? Called from main program level. More... | |
bool | SpiMemoryDisable (const struct spi_memory_t *Memory) |
Name: SpiMemoryDisable Sets SPI memory in deep powerdown. Called from main program level. More... | |
bool | SpiMemorySetWriteProtection (const struct spi_memory_t *Memory, enum spi_memory_protection_t Protection) |
Name: SpiMemorySetWriteProtection Sets write protection for SPI memory and waits for completion. Called from main program level. More... | |
bool | SpiMemoryEraseSectorAsync (const struct spi_memory_t *Memory, uint32_t SectorIndex) |
Name: SpiMemoryEraseSectorAsync Begines erasing given sector in SPI memory. Called from main program level. At function return SPI transfer is completed; erase is started, but not completed. Caller code should use SpiMemoryIsBusy to wait for the completion. More... | |
bool | SpiMemoryEraseSector (const struct spi_memory_t *Memory, uint32_t SectorIndex) |
Name: SpiMemoryEraseSector Erases given sector in SPI memory and waits for completion. Called from main program level. More... | |
bool | SpiMemoryEraseBlockAsync (const struct spi_memory_t *Memory, uint32_t BlockIndex) |
Name: SpiMemoryEraseBlockAsync Begines erasing given block in SPI memory. Called from main program level. At function return SPI transfer is completed; erase is started, but not completed. Caller code should use SpiMemoryIsBusy to wait for the completion. More... | |
bool | SpiMemoryEraseBlock (const struct spi_memory_t *Memory, uint32_t BlockIndex) |
Name: SpiMemoryEraseBlock Erases given block in SPI memory and waits for completion. Called from main program level. More... | |
bool | SpiMemoryEraseAsync (const struct spi_memory_t *Memory) |
Name: SpiMemoryEraseAsync Begines erasing the whole SPI memory. Called from main program level. At function return SPI transfer is completed; erase is started, but not completed. Caller code should use SpiMemoryIsBusy to wait for the completion. More... | |
bool | SpiMemoryErase (const struct spi_memory_t *Memory) |
Name: SpiMemoryErase Erases the whole SPI memory and waits for completion. Called from main program level. More... | |
bool | SpiMemoryReadAsync (const struct spi_memory_t *Memory, struct spi_memory_data_buffer_header *DstBuffer, uint32_t SrcAddress, uint32_t ByteCount, spi_memory_completion_callback_t Callback) |
Name: SpiMemoryReadAsync Reads bytes from SPI memory to DstBuffer. Called from main program level. Does not wait for completion, the completion callback is called instead when transfer is finished. Calling code should not use SPI bus until the completion callback is called. More... | |
bool | SpiMemoryRead (const struct spi_memory_t *Memory, void *DstBuffer, uint32_t SrcAddress, uint32_t ByteCount) |
Name: SpiMemoryRead Reads bytes from SPI memory to DstBuffer. Called from main program level. More... | |
static bool | SpiMemoryReadPageAsync (const struct spi_memory_t *Memory, struct spi_memory_data_buffer_header *DstBuffer, uint32_t PageIndex, spi_memory_completion_callback_t Callback) |
Name: SpiMemoryReadPageAsync Reads the page PageIndex from SPI memory to DstBuffer. Called from main program level. Does not wait for completion, the completion callback is called instead when transfer is finished. Calling code should not use SPI bus until the completion callback is called. More... | |
static bool | SpiMemoryReadPage (const struct spi_memory_t *Memory, void *DstBuffer, uint32_t PageIndex) |
Name: SpiMemoryReadPage Reads the page PageIndex from SPI memory to DstBuffer. Called from main program level. More... | |
static bool | SpiMemoryReadPageWithOffsetAsync (const struct spi_memory_t *Memory, struct spi_memory_data_buffer_header *DstBuffer, uint32_t PageIndex, uint32_t PageOffset, uint32_t ByteCount, spi_memory_completion_callback_t Callback) |
Name: SpiMemoryReadPageWithOffsetAsync Reads the page PageIndex with offset from SPI memory to DstBuffer. Called from main program level. Does not wait for completion, the completion callback is called instead when transfer is finished. Calling code should not use SPI bus until the completion callback is called. More... | |
static bool | SpiMemoryReadPageWithOffset (const struct spi_memory_t *Memory, void *DstBuffer, uint32_t PageIndex, uint32_t PageOffset, uint32_t ByteCount) |
Name: SpiMemoryReadPageWithOffset Reads the page PageIndex with offset from SPI memory to DstBuffer. Called from main program level. More... | |
bool | SpiMemoryWriteAsync (const struct spi_memory_t *Memory, uint32_t DstAddress, struct spi_memory_data_buffer_header *SrcBuffer, uint32_t ByteCount, spi_memory_completion_callback_t Callback) |
Name: SpiMemoryWriteAsync Writes bytes from SrcBuffer to SPI memory. It the SPI memory is page based, the data must fit into a single page, and the page must be erased before writing. Return after writing is finished. Called from main program level. Does not wait for completion, the completion callback is called instead when SPI transfer is finished. Calling code should not use SPI bus until the completion callback is called. Note that completion of the in-chip writing process is not indicated by any kind of callback. Calling code should use SpiMemoryIsBusy to wait for the completion. More... | |
bool | SpiMemoryWrite (const struct spi_memory_t *Memory, uint32_t DstAddress, const void *SrcBuffer, uint32_t ByteCount) |
Name: SpiMemoryWrite Writes bytes from SrcBuffer to SPI memory. It the SPI memory is page based, the data must fit into a single page, and the page must be erased before writing. Return after writing is finished. Called from main program level. More... | |
static bool | SpiMemoryWritePageAsync (const struct spi_memory_t *Memory, uint32_t PageIndex, struct spi_memory_data_buffer_header *SrcBuffer, spi_memory_completion_callback_t Callback) |
Name: SpiMemoryWritePageAsync Writes page data from SrcBuffer to page PageIndex in SPI memory. The page must be erased before writing. Return after writing is finished. Called from main program level. Does not wait for completion, the completion callback is called instead when SPI transfer is finished. Calling code should not use SPI bus until the completion callback is called. Note that completion of the in-chip writing process is not indicated by any kind of callback. Calling code should use SpiMemoryIsBusy to wait for the completion. More... | |
static bool | SpiMemoryWritePage (const struct spi_memory_t *Memory, uint32_t PageIndex, const void *SrcBuffer) |
Name: SpiMemoryWritePage Writes page data from SrcBuffer to page PageIndex in SPI memory. The page must be erased before writing. Return after writing is finished. Called from main program level. More... | |
bool | SpiMemoryVerify (const struct spi_memory_t *Memory, uint32_t SrcAddress, const void *SrcBuffer, uint32_t ByteCount) |
Name: SpiMemoryVerify Verifies data in SPI memory with SrcBuffer. Called from main program level. More... | |
static bool | SpiMemoryVerifyPage (const struct spi_memory_t *Memory, uint32_t PageIndex, const void *SrcBuffer) |
Name: SpiMemoryVerifyPage Verifies data in page PageIndex in SPI memory with SrcBuffer. Called from main program level. More... | |
bool | SpiMemoryIsBusy (const struct spi_memory_t *Memory) |
Name: SpiMemoryIsBusy Checks if the memory write or erase operation is in progress Called from main program level. More... | |
void | SpiMemoryPowerUp (const struct spi_memory_t *Memory) |
Name: SpiMemoryPowerUp Power up VCC for SPI memory. SpiEnable() must be called after this function to get SPI pin setup. Only to be used from EveSpiPowerUp() More... | |
void | SpiMemoryPowerDown (const struct spi_memory_t *Memory) |
Name: SpiMemoryPowerDown Power down VCC for SPI memory. SpiDisable() must be called prior to this function to get default pin setup. Only to be used from EveSpiPowerDown() More... | |
This SPI Memory driver can be used for FLASH, EEPROM and SRAM configuration.
The configuration data is of type struct spi_memory_t, and is used to configure used memory.
#define SPI_MEMORY_HINT_GENERIC 0 |
No special handling is needed
Definition at line 58 of file spi-memory.h.
#define SPI_MEMORY_HINT_GENERIC_SRAM 1 |
RAM status register is programmed for sequential access
Definition at line 59 of file spi-memory.h.
#define SPI_MEMORY_DATA_BUFFER_COMMAND_SIZE 4 |
Asynchronous data buffer header (command) size
Definition at line 61 of file spi-memory.h.
#define SPI_MEMORY_DATA_BUFFER_TYPE | ( | type, | |
size | |||
) |
Defines a new type for the asynchronous SPI memory buffer of the desired size.
type | Typename of the newly created type. |
size | Amount of bytes in the 'data' part of the message. |
Definition at line 130 of file spi-memory.h.
typedef void(* spi_memory_completion_callback_t) (const struct spi_memory_t *Memory, struct spi_memory_data_buffer_header *BufferHeader) |
Asynchronous callback type
Memory | Pointer to the SPI memory instance object |
BufferHeader | Pointer to the header of the buffer object. To be up-casted to the target type by container_of. |
Definition at line 72 of file spi-memory.h.
SPI_MEMORY_DATA_BUFFER_TYPE | ( | spi_memory_generic_buffer_t | , |
0 | |||
) |
Defines a type for a generic buffer with unknown size.
bool SpiMemoryInit | ( | const struct spi_memory_t * | Memory | ) |
Name: SpiMemoryInit
Waits for power on and then release SPI memory from deep powerdown. KŲ!! ???????????? Called from main program level.
Memory | Pointer to the SPI memory instance object |
bool SpiMemoryDisable | ( | const struct spi_memory_t * | Memory | ) |
Name: SpiMemoryDisable
Sets SPI memory in deep powerdown. Called from main program level.
Memory | Pointer to the SPI memory instance object |
bool SpiMemorySetWriteProtection | ( | const struct spi_memory_t * | Memory, |
enum spi_memory_protection_t | Protection | ||
) |
Name: SpiMemorySetWriteProtection
Sets write protection for SPI memory and waits for completion. Called from main program level.
Memory | Pointer to the SPI memory instance object |
Protection | Parameters for protection to be used |
bool SpiMemoryEraseSectorAsync | ( | const struct spi_memory_t * | Memory, |
uint32_t | SectorIndex | ||
) |
Name: SpiMemoryEraseSectorAsync
Begines erasing given sector in SPI memory. Called from main program level. At function return SPI transfer is completed; erase is started, but not completed. Caller code should use SpiMemoryIsBusy to wait for the completion.
Memory | Pointer to the SPI memory instance object |
SectorIndex | Index for sector to be erased (0 to < (.MemorySize / .SectorSize)) |
bool SpiMemoryEraseSector | ( | const struct spi_memory_t * | Memory, |
uint32_t | SectorIndex | ||
) |
Name: SpiMemoryEraseSector
Erases given sector in SPI memory and waits for completion. Called from main program level.
Memory | Pointer to the SPI memory instance object |
SectorIndex | Index for sector to be erased (0 to < (.MemorySize / .SectorSize)) |
bool SpiMemoryEraseBlockAsync | ( | const struct spi_memory_t * | Memory, |
uint32_t | BlockIndex | ||
) |
Name: SpiMemoryEraseBlockAsync
Begines erasing given block in SPI memory. Called from main program level. At function return SPI transfer is completed; erase is started, but not completed. Caller code should use SpiMemoryIsBusy to wait for the completion.
Memory | Pointer to the SPI memory instance object |
BlockIndex | Index for block to be erased (0 to < (.MemorySize / .BlockSize)) |
bool SpiMemoryEraseBlock | ( | const struct spi_memory_t * | Memory, |
uint32_t | BlockIndex | ||
) |
Name: SpiMemoryEraseBlock
Erases given block in SPI memory and waits for completion. Called from main program level.
Memory | Pointer to the SPI memory instance object |
BlockIndex | Index for block to be erased (0 to < (.MemorySize / .BlockSize)) |
bool SpiMemoryEraseAsync | ( | const struct spi_memory_t * | Memory | ) |
Name: SpiMemoryEraseAsync
Begines erasing the whole SPI memory. Called from main program level. At function return SPI transfer is completed; erase is started, but not completed. Caller code should use SpiMemoryIsBusy to wait for the completion.
Memory | Pointer to the SPI memory instance object |
bool SpiMemoryErase | ( | const struct spi_memory_t * | Memory | ) |
Name: SpiMemoryErase
Erases the whole SPI memory and waits for completion. Called from main program level.
Memory | Pointer to the SPI memory instance object |
bool SpiMemoryReadAsync | ( | const struct spi_memory_t * | Memory, |
struct spi_memory_data_buffer_header * | DstBuffer, | ||
uint32_t | SrcAddress, | ||
uint32_t | ByteCount, | ||
spi_memory_completion_callback_t | Callback | ||
) |
Name: SpiMemoryReadAsync
Reads bytes from SPI memory to DstBuffer. Called from main program level. Does not wait for completion, the completion callback is called instead when transfer is finished. Calling code should not use SPI bus until the completion callback is called.
Memory | Pointer to the SPI memory instance object |
DstBuffer | Destination buffer for read data. |
SrcAddress | Address of first byte to read from SPI memory |
ByteCount | Number of bytes to read from SPI memory |
Callback | Completion callback |
Referenced by SpiMemoryReadPageAsync(), and SpiMemoryReadPageWithOffsetAsync().
bool SpiMemoryRead | ( | const struct spi_memory_t * | Memory, |
void * | DstBuffer, | ||
uint32_t | SrcAddress, | ||
uint32_t | ByteCount | ||
) |
Name: SpiMemoryRead
Reads bytes from SPI memory to DstBuffer. Called from main program level.
Memory | Pointer to the SPI memory instance object |
DstBuffer | Destination buffer for read data |
SrcAddress | Address of first byte to read from SPI memory |
ByteCount | Number of bytes to read from SPI memory |
Referenced by SpiMemoryReadPage(), and SpiMemoryReadPageWithOffset().
|
inlinestatic |
Name: SpiMemoryReadPageAsync
Reads the page PageIndex from SPI memory to DstBuffer. Called from main program level. Does not wait for completion, the completion callback is called instead when transfer is finished. Calling code should not use SPI bus until the completion callback is called.
Memory | Pointer to the SPI memory instance object |
DstBuffer | Destination buffer for read data |
PageIndex | Index of page to read from SPI memory |
Callback | Completion callback |
Definition at line 316 of file spi-memory.h.
References spi_memory_t::PageSizeExponent, and SpiMemoryReadAsync().
|
inlinestatic |
Name: SpiMemoryReadPage
Reads the page PageIndex from SPI memory to DstBuffer. Called from main program level.
Memory | Pointer to the SPI memory instance object |
DstBuffer | Destination buffer for read data |
PageIndex | Index of page to read from SPI memory |
Definition at line 335 of file spi-memory.h.
References spi_memory_t::PageSizeExponent, and SpiMemoryRead().
|
inlinestatic |
Name: SpiMemoryReadPageWithOffsetAsync
Reads the page PageIndex with offset from SPI memory to DstBuffer. Called from main program level. Does not wait for completion, the completion callback is called instead when transfer is finished. Calling code should not use SPI bus until the completion callback is called.
Memory | Pointer to the SPI memory instance object |
DstBuffer | Destination buffer for read data |
PageIndex | Index of page to read from SPI memory |
PageOffset | Offset in page, must be < .PageSize |
ByteCount | Number of bytes to read from SPI memory |
Callback | Completion callback |
Definition at line 359 of file spi-memory.h.
References spi_memory_t::PageSizeExponent, and SpiMemoryReadAsync().
|
inlinestatic |
Name: SpiMemoryReadPageWithOffset
Reads the page PageIndex with offset from SPI memory to DstBuffer. Called from main program level.
Memory | Pointer to the SPI memory instance object |
DstBuffer | Destination buffer for read data |
PageIndex | Index of page to read from SPI memory |
PageOffset | Offset in page, must be < .PageSize |
ByteCount | Number of bytes to read from SPI memory |
Definition at line 382 of file spi-memory.h.
References spi_memory_t::PageSizeExponent, SpiMemoryRead(), SpiMemoryWrite(), and SpiMemoryWriteAsync().
bool SpiMemoryWriteAsync | ( | const struct spi_memory_t * | Memory, |
uint32_t | DstAddress, | ||
struct spi_memory_data_buffer_header * | SrcBuffer, | ||
uint32_t | ByteCount, | ||
spi_memory_completion_callback_t | Callback | ||
) |
Name: SpiMemoryWriteAsync
Writes bytes from SrcBuffer to SPI memory. It the SPI memory is page based, the data must fit into a single page, and the page must be erased before writing. Return after writing is finished. Called from main program level. Does not wait for completion, the completion callback is called instead when SPI transfer is finished. Calling code should not use SPI bus until the completion callback is called. Note that completion of the in-chip writing process is not indicated by any kind of callback. Calling code should use SpiMemoryIsBusy to wait for the completion.
Memory | Pointer to the SPI memory instance object |
DstAddress | Address of first byte to write to SPI memory |
SrcBuffer | Source buffer for the data to be written |
ByteCount | Number of bytes to write to SPI memory |
Callback | Completion callback |
Referenced by SpiMemoryReadPageWithOffset(), and SpiMemoryWritePageAsync().
bool SpiMemoryWrite | ( | const struct spi_memory_t * | Memory, |
uint32_t | DstAddress, | ||
const void * | SrcBuffer, | ||
uint32_t | ByteCount | ||
) |
Name: SpiMemoryWrite
Writes bytes from SrcBuffer to SPI memory. It the SPI memory is page based, the data must fit into a single page, and the page must be erased before writing. Return after writing is finished. Called from main program level.
Memory | Pointer to the SPI memory instance object |
DstAddress | Address of first byte to write to SPI memory |
SrcBuffer | Source buffer for the data to be written |
ByteCount | Number of bytes to write to SPI memory |
Referenced by SpiMemoryReadPageWithOffset(), and SpiMemoryWritePage().
|
inlinestatic |
Name: SpiMemoryWritePageAsync
Writes page data from SrcBuffer to page PageIndex in SPI memory. The page must be erased before writing. Return after writing is finished. Called from main program level. Does not wait for completion, the completion callback is called instead when SPI transfer is finished. Calling code should not use SPI bus until the completion callback is called. Note that completion of the in-chip writing process is not indicated by any kind of callback. Calling code should use SpiMemoryIsBusy to wait for the completion.
Memory | Pointer to the SPI memory instance object |
PageIndex | Index of page to write to SPI memory |
SrcBuffer | Source buffer for page data to be written |
Callback | Completion callback |
Definition at line 457 of file spi-memory.h.
References spi_memory_t::PageSizeExponent, and SpiMemoryWriteAsync().
|
inlinestatic |
Name: SpiMemoryWritePage
Writes page data from SrcBuffer to page PageIndex in SPI memory. The page must be erased before writing. Return after writing is finished. Called from main program level.
Memory | Pointer to the SPI memory instance object |
PageIndex | Index of page to write to SPI memory |
SrcBuffer | Source buffer for page data to be written |
Definition at line 478 of file spi-memory.h.
References spi_memory_t::PageSizeExponent, SpiMemoryVerify(), and SpiMemoryWrite().
bool SpiMemoryVerify | ( | const struct spi_memory_t * | Memory, |
uint32_t | SrcAddress, | ||
const void * | SrcBuffer, | ||
uint32_t | ByteCount | ||
) |
Name: SpiMemoryVerify
Verifies data in SPI memory with SrcBuffer. Called from main program level.
Memory | Pointer to the SPI memory instance object |
SrcAddress | First address to be verified in SPI memory |
SrcBuffer | Source buffer for data to be verified |
ByteCount | Number of bytes to verify in SPI memory |
Referenced by SpiMemoryVerifyPage(), and SpiMemoryWritePage().
|
inlinestatic |
Name: SpiMemoryVerifyPage
Verifies data in page PageIndex in SPI memory with SrcBuffer. Called from main program level.
Memory | Pointer to the SPI memory instance object |
PageIndex | Index of page to be verified in SPI memory |
SrcBuffer | Source buffer for data to be verified |
Definition at line 508 of file spi-memory.h.
References spi_memory_t::PageSizeExponent, SpiMemoryIsBusy(), SpiMemoryPowerDown(), SpiMemoryPowerUp(), and SpiMemoryVerify().
bool SpiMemoryIsBusy | ( | const struct spi_memory_t * | Memory | ) |
Name: SpiMemoryIsBusy
Checks if the memory write or erase operation is in progress Called from main program level.
Memory | Pointer to the SPI memory instance object |
Referenced by SpiMemoryVerifyPage().
void SpiMemoryPowerUp | ( | const struct spi_memory_t * | Memory | ) |
Name: SpiMemoryPowerUp
Power up VCC for SPI memory. SpiEnable() must be called after this function to get SPI pin setup. Only to be used from EveSpiPowerUp()
Memory | Pointer to the SPI memory instance object |
Referenced by SpiMemoryVerifyPage().
void SpiMemoryPowerDown | ( | const struct spi_memory_t * | Memory | ) |
Name: SpiMemoryPowerDown
Power down VCC for SPI memory. SpiDisable() must be called prior to this function to get default pin setup. Only to be used from EveSpiPowerDown()
Memory | Pointer to the SPI memory instance object |
Referenced by SpiMemoryVerifyPage().