46 #define MAX_NUM_WITH_DECODER 0x10    51 #define MAX_NUM_WITHOUT_DECODER 0x04    56 #define NONE_CHIP_SELECT_ID 0x0f    61 #define DEFAULT_CHIP_ID 0    71         flexcom_enable(BOARD_FLEXCOM_SPI);
    72         flexcom_set_opmode(BOARD_FLEXCOM_SPI, FLEXCOM_SPI);
   110         if (-1 == baud_div) {
   111                 Assert(0 == 
"Failed to find baudrate divider");
 static void spi_set_master_mode(Spi *p_spi)
Set SPI to Master mode. 
 
void spi_set_clock_phase(Spi *p_spi, uint32_t ul_pcs_ch, uint32_t ul_phase)
Set Data Capture Phase. 
 
void spi_configure_cs_behavior(Spi *p_spi, uint32_t ul_pcs_ch, uint32_t ul_cs_behavior)
Configure CS behavior for SPI transfer (spi_cs_behavior_t). 
 
#define UNUSED(v)
Marking v as a unused parameter or value. 
 
static void spi_read_single(Spi *p_spi, uint8_t *data)
Receive one byte from an SPI device. 
 
void spi_select_device(Spi *p_spi, struct spi_device *device)
Select the given device on the SPI bus. 
 
void spi_master_init(Spi *p_spi)
Initialize the SPI in master mode. 
 
void spi_deselect_device(Spi *p_spi, struct spi_device *device)
Deselect the given device on the SPI bus. 
 
int16_t spi_set_baudrate_div(Spi *p_spi, uint32_t ul_pcs_ch, uint8_t uc_baudrate_divider)
Set Serial Clock Baud Rate divider value (SCBR). 
 
#define CONFIG_SPI_MASTER_BITS_PER_TRANSFER
Default Configuration of SPI Master Bits per Transfer Definition. 
 
board_spi_select_id_t id
Board specific select id. 
 
#define CONFIG_SPI_MASTER_DELAY_BS
Default Configuration of SPI Master Delay BS. 
 
void spi_set_bits_per_transfer(Spi *p_spi, uint32_t ul_pcs_ch, uint32_t ul_bits)
Set number of bits per transfer. 
 
static uint32_t spi_get_peripheral_select_decode_setting(Spi *p_spi)
Get Peripheral Select Decode mode. 
 
void spi_set_clock_polarity(Spi *p_spi, uint32_t ul_pcs_ch, uint32_t ul_polarity)
Set clock default state. 
 
#define CONFIG_SPI_MASTER_DELAY_BCT
Default Configuration of SPI Master Delay BCT. 
 
static void spi_reset(Spi *p_spi)
Reset SPI and set it to Slave mode. 
 
static uint32_t spi_is_tx_ready(Spi *p_spi)
Check if all transmissions are ready. 
 
status_code_t spi_transceive_packet(Spi *p_spi, uint8_t *tx_data, uint8_t *rx_data, size_t len)
Send and receive a sequence of bytes from an SPI device. 
 
static void spi_disable_loopback(Spi *p_spi)
Disable loopback mode. 
 
static uint32_t sysclk_get_peripheral_hz(void)
Retrieves the current rate in Hz of the peripheral clocks. 
 
void spi_enable_clock(Spi *p_spi)
Enable SPI clock. 
 
#define CONFIG_SPI_MASTER_DELAY_BCS
Default Configuration of SPI Master Delay BCS. 
 
status_code_t spi_write_packet(Spi *p_spi, const uint8_t *data, size_t len)
Send a sequence of bytes to an SPI device. 
 
static void spi_disable_peripheral_select_decode(Spi *p_spi)
Disable Peripheral Select Decode. 
 
static void spi_disable_mode_fault_detect(Spi *p_spi)
Disable Mode Fault Detection. 
 
void spi_set_peripheral_chip_select_value(Spi *p_spi, uint32_t ul_value)
Set Peripheral Chip Select (PCS) value. 
 
USBInterfaceDescriptor data
 
#define CONFIG_SPI_MASTER_DUMMY
Default Configuration of SPI Master Dummy Field. 
 
static void spi_write_single(Spi *p_spi, uint8_t data)
Write one byte to an SPI device. 
 
#define DEFAULT_CHIP_ID
The default chip select id. 
 
int16_t spi_calc_baudrate_div(const uint32_t baudrate, uint32_t mck)
Calculate the baudrate divider. 
 
enum status_code status_code_t
 
static uint32_t spi_is_rx_ready(Spi *p_spi)
Check if all receptions are ready. 
 
static uint32_t spi_is_tx_empty(Spi *p_spi)
Check if all transmissions are complete. 
 
static void spi_set_fixed_peripheral_select(Spi *p_spi)
Set Fixed Peripheral Select. Peripheral Chip Select is controlled by SPI_MR. 
 
void spi_set_transfer_delay(Spi *p_spi, uint32_t ul_pcs_ch, uint8_t uc_dlybs, uint8_t uc_dlybct)
Configure timing for SPI transfer. 
 
uint8_t spi_flags_t
SPI Flags Definition. 
 
#define NONE_CHIP_SELECT_ID
Max number when the chip selects are directly connected to peripheral device. 
 
void spi_set_delay_between_chip_select(Spi *p_spi, uint32_t ul_delay)
Set delay between chip selects (in number of MCK clocks). If DLYBCS <= 6, 6 MCK clocks will be insert...
 
Polled SPI device definition. 
 
uint32_t board_spi_select_id_t
Board SPI Select Id Definition. 
 
#define Assert(expr)
This macro is used to test fatal errors. 
 
SPI master common service for SAM. 
 
#define MAX_NUM_WITH_DECODER
Max number when the chip selects are connected to a 4- to 16-bit decoder. 
 
void spi_master_setup_device(Spi *p_spi, struct spi_device *device, spi_flags_t flags, uint32_t baud_rate, board_spi_select_id_t sel_id)
Set up an SPI device. 
 
#define MAX_NUM_WITHOUT_DECODER
Max number when the chip selects are directly connected to peripheral device. 
 
static void spi_set_lastxfer(Spi *p_spi)
Issue a LASTXFER command. The next transfer is the last transfer and after that CS is de-asserted...
 
status_code_t spi_read_packet(Spi *p_spi, uint8_t *data, size_t len)
Receive a sequence of bytes from an SPI device.