Connection of the AT25DFx SerialFlash to SPI interface driver.
This file manages the connection of the AT25DFx SerialFlash driver to an SPI service (could be spi master service or usart in spi mode). The SPI service selection depends on AT25DFX_USES_SPI_MASTER_SERVICE or AT25DFX_USES_USART_SPI_SERVICE in conf_at25dfx.h.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | AT25DFX_CS 0 |
#define | AT25DFX_SPI_MODULE 0 |
Functions | |
void | at25dfx_spi_deselect_device (uint8_t mem_id) |
Deselect one external SerialFlash component. More... | |
void | at25dfx_spi_init (void) |
Initialize SPI external resource for AT25DFx SerialFlash driver. More... | |
status_code_t | at25dfx_spi_read_byte (uint8_t *data) |
Get one byte (read) from the SerialFlash. More... | |
status_code_t | at25dfx_spi_read_packet (void const *data, size_t len) |
Receive a sequence of bytes from a SerialFlash. More... | |
void | at25dfx_spi_select_device (uint8_t mem_id) |
Select one external SerialFlash component. More... | |
status_code_t | at25dfx_spi_write_byte (uint8_t data) |
Send one byte to the SerialFlash. More... | |
status_code_t | at25dfx_spi_write_packet (void const *data, size_t len) |
Send a sequence of bytes to a SerialFlash. More... | |
#define AT25DFX_CS 0 |
#define AT25DFX_SPI_MODULE 0 |
void at25dfx_spi_deselect_device | ( | uint8_t | mem_id | ) |
Deselect one external SerialFlash component.
mem_id | The SerialFlash index number. |
References AT25DFX_SPI_MODULE, spi_deselect_device(), UNUSED, and usart_spi_deselect_device().
Referenced by at25dfx_send_command().
void at25dfx_spi_init | ( | void | ) |
Initialize SPI external resource for AT25DFx SerialFlash driver.
This function initializes the SerialFlash component as well as the SPI service that the memory is connected to.
References AT25DFX_SPI_MODULE, spi_enable(), spi_master_init(), spi_master_setup_device(), SPI_MODE_0, usart_spi_init(), and usart_spi_setup_device().
Referenced by at25dfx_initialize().
status_code_t at25dfx_spi_read_byte | ( | uint8_t * | data | ) |
Get one byte (read) from the SerialFlash.
data | Data buffer to read. |
References AT25DFX_SPI_MODULE, spi_read_packet(), and usart_spi_read_packet().
status_code_t at25dfx_spi_read_packet | ( | void const * | data, |
size_t | len | ||
) |
Receive a sequence of bytes from a SerialFlash.
data | Data buffer to read |
len | Length of data |
References AT25DFX_SPI_MODULE, spi_read_packet(), and usart_spi_read_packet().
Referenced by at25dfx_send_command().
void at25dfx_spi_select_device | ( | uint8_t | mem_id | ) |
Select one external SerialFlash component.
mem_id | The SerialFlash index number. |
References AT25DFX_SPI_MODULE, spi_select_device(), UNUSED, and usart_spi_select_device().
Referenced by at25dfx_send_command().
status_code_t at25dfx_spi_write_byte | ( | uint8_t | data | ) |
Send one byte to the SerialFlash.
data | The data byte to send. |
References AT25DFX_SPI_MODULE, spi_write_packet(), and usart_spi_write_packet().
status_code_t at25dfx_spi_write_packet | ( | void const * | data, |
size_t | len | ||
) |
Send a sequence of bytes to a SerialFlash.
data | Data buffer to write |
len | Length of data |
References AT25DFX_SPI_MODULE, spi_write_packet(), and usart_spi_write_packet().
Referenced by at25dfx_send_command().