SPI Peripheral
Bootloader » Peripheral Definitions

SPI peripheral interface. More...

Collaboration diagram for SPI Peripheral:

## Data Structures

struct | spi_transfer_info_t
| Synchronization state between SPI ISR and read/write functions. More...

## Functions

static bool | spi_poll_for_activity (const peripheral_descriptor_t *self)
| SPI slave poll for activity function.
static status_t | spi_full_init (const peripheral_descriptor_t *self, serial_byte_receive_func_t function)
| SPI slave init function.
static void | spi_full_shutdown (const peripheral_descriptor_t *self)
| SPI slave shutdown function.
static void | spi_data_source (uint8_t *source_byte)
| SPI slave sending data function.
static void | spi_initial_data_sink (uint8_t sink_byte, uint16_t instance)
| SPI slave receiving first byte data function.
static void | spi_data_sink (uint8_t sink_byte, uint16_t instance)
| SPI slave receiving data function.
static status_t | spi_write (const peripheral_descriptor_t *self, const uint8_t *buffer, uint32_t byteCount)
| SPI slave writing data function.
void | SPI_SetSystemIRQ (uint32_t instance, PeripheralSystemIRQSetting set)
void | spi_slave_irq_handler (uint32_t instance)
void | SPI0_IRQHandler (void)
void | SPI1_IRQHandler (void)
void | SPI2_IRQHandler (void)

## Variables

const peripheral_control_interface_t | g_spiControlInterface
| SPI slave control interface information. More...
const peripheral_byte_inteface_t | g_spiByteInterface = {.init = NULL, .write = spi_write }
| SPI slave byte interface information. More...
static spi_transfer_info_t | s_spiInfo
| Global state for the SPI slave peripheral interface. More...
static bool | s_spiActivity [FSL_FEATURE_SOC_SPI_COUNT] = { false }
| Flag for detecting device activity.
static bool | s_spiIntialized [FSL_FEATURE_SOC_SPI_COUNT] = { false }
static serial_byte_receive_func_t | s_spi_app_data_sink_callback
| SPI slave receiving data call back function.
static const uint32_t | g_spiBaseAddr [] = SPI_BASE_ADDRS
static const IRQn_Type | spi_irq_ids [FSL_FEATURE_SOC_SPI_COUNT]

## Usage Information

SPI peripheral interface.

## Data Structure Documentation

struct spi_transfer_info_t

Synchronization state between SPI ISR and read/write functions.

### Data Fields

const uint8_t * | writeData
| The applications data to write.
volatile uint32_t | bytesToTransfer
| The total number of bytes to be transmitted.
void(* | data_source )(uint8_t *source_byte)
void(* | data_sink )(uint8_t sink_byte, uint16_t instance)

## Variable Documentation

const peripheral_byte_inteface_t g_spiByteInterface = {.init = NULL, .write = spi_write }

SPI slave byte interface information.

Byte I/O interface for the SPI peripheral driver.

const peripheral_control_interface_t g_spiControlInterface

Initial value:
= {
.pollForActivity = spi_poll_for_activity, .init = spi_full_init, .shutdown = spi_full_shutdown, .pump = 0
}
spi_full_init
static status_t spi_full_init(const peripheral_descriptor_t *self, serial_byte_receive_func_t function)
SPI slave init function.
Definition: spi_peripheral_interface.c:214
spi_full_shutdown
static void spi_full_shutdown(const peripheral_descriptor_t *self)
SPI slave shutdown function.
Definition: spi_peripheral_interface.c:249
spi_poll_for_activity
static bool spi_poll_for_activity(const peripheral_descriptor_t *self)
SPI slave poll for activity function.
Definition: spi_peripheral_interface.c:155

SPI slave control interface information.

Control interface for the SPI peripheral driver.

spi_transfer_info_t s_spiInfo

static

Initial value:
= {
.writeData = 0, .bytesToTransfer = 0, .data_source = spi_data_source, .data_sink = spi_initial_data_sink
}
spi_initial_data_sink
static void spi_initial_data_sink(uint8_t sink_byte, uint16_t instance)
SPI slave receiving first byte data function.
Definition: spi_peripheral_interface.c:187
spi_data_source
static void spi_data_source(uint8_t *source_byte)
SPI slave sending data function.
Definition: spi_peripheral_interface.c:166

Global state for the SPI slave peripheral interface.

const IRQn_Type spi_irq_ids[FSL_FEATURE_SOC_SPI_COUNT]

static

Initial value:
= {
#if defined(SPI0)
SPI0_IRQn,
#else
SPI_IRQn,
#endif
#if (FSL_FEATURE_SOC_SPI_COUNT > 1)
SPI1_IRQn,
#endif
#if (FSL_FEATURE_SOC_SPI_COUNT > 2)
SPI2_IRQn,
#endif
}