SERCOM SPI master with vectored I/O driver include.
Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.
#include <compiler.h>
#include <gclk.h>
#include <port.h>
#include <spi.h>
#include <status_codes.h>
#include <conf_spi_master_vec.h>
Data Structures | |
struct | spi_master_vec_bufdesc |
Buffer descriptor structure. More... | |
struct | spi_master_vec_config |
Driver configuration structure. More... | |
struct | spi_master_vec_module |
Driver instance. More... | |
Typedefs | |
typedef uint16_t | spi_master_vec_buflen_t |
Buffer length container. More... | |
Enumerations | |
enum | _spi_master_vec_direction { SPI_MASTER_VEC_DIRECTION_READ, SPI_MASTER_VEC_DIRECTION_WRITE, SPI_MASTER_VEC_DIRECTION_BOTH, SPI_MASTER_VEC_DIRECTION_IDLE } |
Transfer direction. More... | |
Functions | |
Configuration and Initialization | |
static void | spi_master_vec_get_config_defaults (struct spi_master_vec_config *const config) |
Initialize configuration with default values. More... | |
enum status_code | spi_master_vec_init (struct spi_master_vec_module *const module, Sercom *const sercom, const struct spi_master_vec_config *const config) |
Initialize hardware and driver instance. More... | |
Enable/Disable and Reset | |
void | spi_master_vec_enable (const struct spi_master_vec_module *const module) |
Enable the SERCOM SPI module. More... | |
void | spi_master_vec_disable (struct spi_master_vec_module *const module) |
Disable the SERCOM SPI module. More... | |
void | spi_master_vec_reset (struct spi_master_vec_module *const module) |
Reset the SERCOM SPI module. More... | |
Lock/Unlock | |
static enum status_code | spi_master_vec_lock (struct spi_master_vec_module *const module) |
Attempt to get lock on driver instance. More... | |
static void | spi_master_vec_unlock (struct spi_master_vec_module *const module) |
Unlock driver instance. More... | |
Read/Write and Status | |
enum status_code | spi_master_vec_transceive_buffer_job (struct spi_master_vec_module *const module, struct spi_master_vec_bufdesc tx_bufdescs[], struct spi_master_vec_bufdesc rx_bufdescs[]) |
Start vectored I/O transfer. More... | |
static enum status_code | spi_master_vec_get_job_status (const struct spi_master_vec_module *const module) |
Get current status of transfer. More... | |
static enum status_code | spi_master_vec_get_job_status_wait (const struct spi_master_vec_module *const module) |
Get status of transfer upon job end. More... | |
static enum status_code | spi_master_vec_transceive_buffer_wait (struct spi_master_vec_module *const module, struct spi_master_vec_bufdesc tx_bufdescs[], struct spi_master_vec_bufdesc rx_bufdescs[]) |
Start vectored I/O transfer, wait for it to end. More... | |