ADP SPI interface implementation.
Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | SPI_BAUDRATE 1500000 |
#define | SPI_CHIP_SEL SPI_NPCS3_PA5_GPIO |
#define | SPI_DEVICE_ID 3 |
Embedded debugger SPI interface definitions | |
#define | EDBG_SPI_MODULE SPI |
Functions | |
enum status_code | adp_interface_init (void) |
Initialize EDBG SPI communication for SAM. More... | |
enum status_code | adp_interface_read_response (uint8_t *rx_buf, uint16_t length) |
Read response on SPI from PC. More... | |
static void | adp_interface_send_start (void) |
Send SPI start condition. More... | |
static void | adp_interface_send_stop (void) |
Send SPI stop condition. More... | |
static void | adp_interface_transceive (uint8_t *tx_data, uint8_t *rx_data, uint16_t length) |
Sends and reads data byte on SPI. More... | |
void | adp_interface_transceive_procotol (uint8_t *tx_buf, uint16_t length, uint8_t *rx_buf) |
Sends and reads protocol packet data byte on SPI. More... | |
Variables | |
struct spi_device | SPI_DEVICE |
#define EDBG_SPI_MODULE SPI |
#define SPI_BAUDRATE 1500000 |
Referenced by adp_interface_init().
#define SPI_CHIP_SEL SPI_NPCS3_PA5_GPIO |
#define SPI_DEVICE_ID 3 |
enum status_code adp_interface_init | ( | void | ) |
Initialize EDBG SPI communication for SAM.
References EDBG_SPI_MODULE, SPI_BAUDRATE, spi_enable(), spi_master_init(), spi_master_setup_device(), SPI_MODE_0, STATUS_OK, and sysclk_init().
enum status_code adp_interface_read_response | ( | uint8_t * | rx_buf, |
uint16_t | length | ||
) |
Read response on SPI from PC.
return Status
[in] | rx_buf | Pointer to receive the data |
[in] | length | The length of the read data |
[out] | rx_buf | Pointer to store the received SPI character |
References adp_interface_send_start(), adp_interface_send_stop(), EDBG_SPI_MODULE, spi_read_packet(), and status.
Referenced by adp_interface_transceive_procotol().
|
static |
Send SPI start condition.
References EDBG_SPI_MODULE, and spi_select_device().
Referenced by adp_interface_read_response(), and adp_interface_transceive_procotol().
|
static |
Send SPI stop condition.
References EDBG_SPI_MODULE, and spi_deselect_device().
Referenced by adp_interface_read_response(), and adp_interface_transceive_procotol().
|
static |
Sends and reads data byte on SPI.
[in] | data | Data byte to send |
[in] | tx_data | SPI character to transmit |
[out] | rx_data | Pointer to store the received SPI character |
References EDBG_SPI_MODULE, and spi_transceive_packet().
Referenced by adp_interface_transceive_procotol().
void adp_interface_transceive_procotol | ( | uint8_t * | tx_buf, |
uint16_t | length, | ||
uint8_t * | rx_buf | ||
) |
Sends and reads protocol packet data byte on SPI.
[in] | tx_buf | Pointer to send the protocol packet data |
[in] | length | The length of the send protocol packet data |
[out] | rx_buf | Pointer to store the received SPI character |
References adp_interface_send_start(), adp_interface_send_stop(), and adp_interface_transceive().
struct spi_device SPI_DEVICE |