EFR32 Blue Gecko 12 Software Documentation  efr32bg12-doc-5.1.2
SPIDRV

Detailed Description

SPIDRV Serial Peripheral Interface Driver.

The source files for the SPI driver library resides in the emdrv/spidrv folder, and are named spidrv.c and spidrv.h.


Introduction

The SPI driver support the SPI capabilities of EFM32/EZR32/EFR32 USARTs. The driver is fully reentrant and several driver instances can coexist. The driver does not buffer or queue data. The driver has SPI transfer functions for both master and slave SPI mode. Both synchronous and asynchronous transfer functions are present. Synchronous transfer functions are blocking and will not return to caller before the transfer has completed. Asynchronous transfer functions report transfer completion with callback functions. Transfers are done using DMA.

Note
Transfer completion callback functions are called from within the DMA interrupt handler with interrupts disabled.


Configuration Options

Some properties of the SPIDRV driver are compile-time configurable. These properties are stored in a file named spidrv_config.h. A template for this file, containing default values, resides in the emdrv/config folder. Currently the configuration options are:

To configure SPIDRV, provide your own configuration file. Here is a sample spidrv_config.h file:

#ifndef __SILICON_LABS_SPIDRV_CONFIG_H__
#define __SILICON_LABS_SPIDRV_CONFIG_H__

// SPIDRV configuration option. Use this define to include the
// slave part of the SPIDRV API.
#define EMDRV_SPIDRV_INCLUDE_SLAVE

#endif

The properties of each SPI driver instance are set at run-time via the SPIDRV_Init_t data structure input parameter to the SPIDRV_Init() function.


The API

This section contain brief descriptions of the functions in the API. You will find detailed information on input and output parameters and return values by clicking on the hyperlinked function names. Most functions return an error code, ECODE_EMDRV_SPIDRV_OK is returned on success, see ecode.h and spidrv.h for other error codes.

Your application code must include one header file: spidrv.h.

SPIDRV_Init(), SPIDRV_DeInit()
These functions initializes or deinitializes the SPIDRV driver. Typically SPIDRV_Init() is called once in your startup code.

SPIDRV_GetTransferStatus()
Query the status of a transfer. Reports number of items (frames) transmitted and remaining.

SPIDRV_AbortTransfer()
Stop an ongoing transfer.

SPIDRV_SetBitrate(), SPIDRV_GetBitrate()
Set or query SPI bus bitrate.

SPIDRV_SetFramelength(), SPIDRV_GetFramelength()
Set or query SPI bus frame length.

SPIDRV_MReceive(), SPIDRV_MReceiveB()
SPIDRV_MTransfer(), SPIDRV_MTransferB(), SPIDRV_MTransferSingleItemB()
SPIDRV_MTransmit(), SPIDRV_MTransmitB()
SPIDRV_SReceive(), SPIDRV_SReceiveB()
SPIDRV_STransfer(), SPIDRV_STransferB()
SPIDRV_STransmit(), SPIDRV_STransmitB()
SPI transfer functions for SPI masters have an uppercase M in their name, the slave counterparts have an S.

Transfer functions come in both synchronous and asynchronous versions, the synchronous versions have an uppercase B (for Blocking) at the end of their function name. Synchronous functions will not return before the transfer has completed. The aynchronous functions signal transfer completion with a callback function.

Transmit functions discards received data, receive functions transmit a fixed data pattern set when the driver is initialized (SPIDRV_Init_t::dummyTxValue). Transfer functions both receive and transmit data.

All slave transfer functions have a millisecond timeout parameter. Use 0 for no (infinite) timeout.


Example

#include "spidrv.h"

SPIDRV_HandleData_t handleData;
SPIDRV_Handle_t handle = &handleData;

void TransferComplete( SPIDRV_Handle_t handle,
                       Ecode_t transferStatus,
                       int itemsTransferred )
{
  if ( transferStatus == ECODE_EMDRV_SPIDRV_OK )
  {
    // Success !
  }
}

int main( void )
{
  uint8_t buffer[10];
  SPIDRV_Init_t initData = SPIDRV_MASTER_USART2;

  // Initialize a SPI driver instance
  SPIDRV_Init( handle, &initData );

  // Transmit data using a blocking transmit function
  SPIDRV_MTransmitB( handle, buffer, 10 );

  // Transmit data using a callback to catch transfer completion.
  SPIDRV_MTransmit( handle, buffer, 10, TransferComplete );
}

Data Structures

struct  SPIDRV_HandleData
 
struct  SPIDRV_Init
 

Macros

#define ECODE_EMDRV_SPIDRV_ABORTED   ( ECODE_EMDRV_SPIDRV_BASE | 0x00000007 )
 SPI transfer has been aborted.
 
#define ECODE_EMDRV_SPIDRV_BUSY   ( ECODE_EMDRV_SPIDRV_BASE | 0x00000003 )
 The SPI port is busy.
 
#define ECODE_EMDRV_SPIDRV_DMA_ALLOC_ERROR   ( ECODE_EMDRV_SPIDRV_BASE | 0x00000009 )
 Unable to allocated DMA channels.
 
#define ECODE_EMDRV_SPIDRV_IDLE   ( ECODE_EMDRV_SPIDRV_BASE | 0x00000006 )
 No SPI transfer in progress.
 
#define ECODE_EMDRV_SPIDRV_ILLEGAL_HANDLE   ( ECODE_EMDRV_SPIDRV_BASE | 0x00000001 )
 Illegal SPI handle.
 
#define ECODE_EMDRV_SPIDRV_MODE_ERROR   ( ECODE_EMDRV_SPIDRV_BASE | 0x00000008 )
 SPI master used slave API or vica versa.
 
#define ECODE_EMDRV_SPIDRV_OK   ( ECODE_OK )
 Success return value.
 
#define ECODE_EMDRV_SPIDRV_PARAM_ERROR   ( ECODE_EMDRV_SPIDRV_BASE | 0x00000002 )
 Illegal input parameter.
 
#define ECODE_EMDRV_SPIDRV_TIMEOUT   ( ECODE_EMDRV_SPIDRV_BASE | 0x00000005 )
 SPI transfer timeout.
 
#define ECODE_EMDRV_SPIDRV_TIMER_ALLOC_ERROR   ( ECODE_EMDRV_SPIDRV_BASE | 0x00000004 )
 Unable to allocated timeout timer.
 
#define SPIDRV_MASTER_USART0
 Configuration data for SPI master using USART0. More...
 
#define SPIDRV_MASTER_USART1
 Configuration data for SPI master using USART1. More...
 
#define SPIDRV_MASTER_USART2
 Configuration data for SPI master using USART2. More...
 
#define SPIDRV_MASTER_USART3
 Configuration data for SPI master using USART3. More...
 
#define SPIDRV_SLAVE_USART0
 Configuration data for SPI slave using USART0. More...
 
#define SPIDRV_SLAVE_USART1
 Configuration data for SPI slave using USART1. More...
 
#define SPIDRV_SLAVE_USART2
 Configuration data for SPI slave using USART2. More...
 
#define SPIDRV_SLAVE_USART3
 Configuration data for SPI slave using USART3. More...
 

Typedefs

typedef enum SPIDRV_BitOrder SPIDRV_BitOrder_t
 SPI bus bit order.
 
typedef void(* SPIDRV_Callback_t) (struct SPIDRV_HandleData *handle, Ecode_t transferStatus, int itemsTransferred)
 SPIDRV transfer completion callback function. More...
 
typedef enum SPIDRV_ClockMode SPIDRV_ClockMode_t
 SPI clock mode (clock polarity and phase).
 
typedef enum SPIDRV_CsControl SPIDRV_CsControl_t
 SPI master chip select (CS) control scheme.
 
typedef SPIDRV_HandleData_tSPIDRV_Handle_t
 SPI driver instance handle.
 
typedef struct SPIDRV_HandleData SPIDRV_HandleData_t
 
typedef struct SPIDRV_Init SPIDRV_Init_t
 
typedef enum SPIDRV_SlaveStart SPIDRV_SlaveStart_t
 SPI slave transfer start scheme.
 
typedef enum SPIDRV_Type SPIDRV_Type_t
 SPI driver instance type.
 

Enumerations

enum  SPIDRV_BitOrder {
  spidrvBitOrderLsbFirst = 0,
  spidrvBitOrderMsbFirst = 1
}
 SPI bus bit order. More...
 
enum  SPIDRV_ClockMode {
  spidrvClockMode0 = 0,
  spidrvClockMode1 = 1,
  spidrvClockMode2 = 2,
  spidrvClockMode3 = 3
}
 SPI clock mode (clock polarity and phase). More...
 
enum  SPIDRV_CsControl {
  spidrvCsControlAuto = 0,
  spidrvCsControlApplication = 1
}
 SPI master chip select (CS) control scheme. More...
 
enum  SPIDRV_SlaveStart {
  spidrvSlaveStartImmediate = 0,
  spidrvSlaveStartDelayed = 1
}
 SPI slave transfer start scheme. More...
 
enum  SPIDRV_Type {
  spidrvMaster = 0,
  spidrvSlave = 1
}
 SPI driver instance type. More...
 

Functions

Ecode_t SPIDRV_AbortTransfer (SPIDRV_Handle_t handle)
 Abort an ongoing SPI transfer. More...
 
Ecode_t SPIDRV_DeInit (SPIDRV_Handle_t handle)
 Deinitialize a SPI driver instance. More...
 
Ecode_t SPIDRV_GetBitrate (SPIDRV_Handle_t handle, uint32_t *bitRate)
 Get current SPI bus bitrate. More...
 
Ecode_t SPIDRV_GetFramelength (SPIDRV_Handle_t handle, uint32_t *frameLength)
 Get current SPI framelength. More...
 
Ecode_t SPIDRV_GetTransferStatus (SPIDRV_Handle_t handle, int *itemsTransferred, int *itemsRemaining)
 Get the status of a SPI transfer. More...
 
Ecode_t SPIDRV_Init (SPIDRV_Handle_t handle, SPIDRV_Init_t *initData)
 Initialize a SPI driver instance. More...
 
Ecode_t SPIDRV_MReceive (SPIDRV_Handle_t handle, void *buffer, int count, SPIDRV_Callback_t callback)
 Start a SPI master receive transfer. More...
 
Ecode_t SPIDRV_MReceiveB (SPIDRV_Handle_t handle, void *buffer, int count)
 Start a SPI master blocking receive transfer. More...
 
Ecode_t SPIDRV_MTransfer (SPIDRV_Handle_t handle, const void *txBuffer, void *rxBuffer, int count, SPIDRV_Callback_t callback)
 Start a SPI master transfer. More...
 
Ecode_t SPIDRV_MTransferB (SPIDRV_Handle_t handle, const void *txBuffer, void *rxBuffer, int count)
 Start a SPI master blocking transfer. More...
 
Ecode_t SPIDRV_MTransferSingleItemB (SPIDRV_Handle_t handle, uint32_t txValue, void *rxValue)
 Start a SPI master blocking single item (frame) transfer. More...
 
Ecode_t SPIDRV_MTransmit (SPIDRV_Handle_t handle, const void *buffer, int count, SPIDRV_Callback_t callback)
 Start a SPI master transmit transfer. More...
 
Ecode_t SPIDRV_MTransmitB (SPIDRV_Handle_t handle, const void *buffer, int count)
 Start a SPI master blocking transmit transfer. More...
 
Ecode_t SPIDRV_SetBitrate (SPIDRV_Handle_t handle, uint32_t bitRate)
 Set SPI bus bitrate. More...
 
Ecode_t SPIDRV_SetFramelength (SPIDRV_Handle_t handle, uint32_t frameLength)
 Set SPI framelength. More...
 
Ecode_t SPIDRV_SReceive (SPIDRV_Handle_t handle, void *buffer, int count, SPIDRV_Callback_t callback, int timeoutMs)
 Start a SPI slave receive transfer. More...
 
Ecode_t SPIDRV_SReceiveB (SPIDRV_Handle_t handle, void *buffer, int count, int timeoutMs)
 Start a SPI slave blocking receive transfer. More...
 
Ecode_t SPIDRV_STransfer (SPIDRV_Handle_t handle, const void *txBuffer, void *rxBuffer, int count, SPIDRV_Callback_t callback, int timeoutMs)
 Start a SPI slave transfer. More...
 
Ecode_t SPIDRV_STransferB (SPIDRV_Handle_t handle, const void *txBuffer, void *rxBuffer, int count, int timeoutMs)
 Start a SPI slave blocking transfer. More...
 
Ecode_t SPIDRV_STransmit (SPIDRV_Handle_t handle, const void *buffer, int count, SPIDRV_Callback_t callback, int timeoutMs)
 Start a SPI slave transmit transfer. More...
 
Ecode_t SPIDRV_STransmitB (SPIDRV_Handle_t handle, const void *buffer, int count, int timeoutMs)
 Start a SPI slave blocking transmit transfer. More...
 

Macro Definition Documentation

#define SPIDRV_MASTER_USART0
Value:
{ \
USART0, /* USART port */ \
_USART_ROUTELOC0_TXLOC_LOC0, /* USART Tx pin location number */ \
_USART_ROUTELOC0_RXLOC_LOC0, /* USART Rx pin location number */ \
_USART_ROUTELOC0_CLKLOC_LOC1, /* USART Clk pin location number */ \
_USART_ROUTELOC0_CSLOC_LOC1, /* USART Cs pin location number */ \
1000000, /* Bitrate */ \
8, /* Frame length */ \
0, /* Dummy tx value for rx only funcs */ \
spidrvMaster, /* SPI mode */ \
spidrvBitOrderMsbFirst, /* Bit order on bus */ \
spidrvClockMode0, /* SPI clock/phase mode */ \
spidrvCsControlAuto, /* CS controlled by the driver */ \
spidrvSlaveStartImmediate /* Slave start transfers immediately*/ \
}
MSB bit is transmitted first.
Definition: spidrv.h:65
#define USART0
#define _USART_ROUTELOC0_CLKLOC_LOC1
#define _USART_ROUTELOC0_TXLOC_LOC0
SPI mode 0: CLKPOL=0, CLKPHA=0.
Definition: spidrv.h:71
CS controlled by SPI driver.
Definition: spidrv.h:80
#define _USART_ROUTELOC0_CSLOC_LOC1
Act as SPI master.
Definition: spidrv.h:57
#define _USART_ROUTELOC0_RXLOC_LOC0

Configuration data for SPI master using USART0.

Definition at line 180 of file spidrv.h.

#define SPIDRV_MASTER_USART1
Value:
{ \
USART1, /* USART port */ \
_USART_ROUTELOC0_TXLOC_LOC11, /* USART Tx pin location number */ \
_USART_ROUTELOC0_RXLOC_LOC11, /* USART Rx pin location number */ \
_USART_ROUTELOC0_CLKLOC_LOC11,/* USART Clk pin location number */ \
_USART_ROUTELOC0_CSLOC_LOC11, /* USART Cs pin location number */ \
1000000, /* Bitrate */ \
8, /* Frame length */ \
0, /* Dummy tx value for rx only funcs */ \
spidrvMaster, /* SPI mode */ \
spidrvBitOrderMsbFirst, /* Bit order on bus */ \
spidrvClockMode0, /* SPI clock/phase mode */ \
spidrvCsControlAuto, /* CS controlled by the driver */ \
spidrvSlaveStartImmediate /* Slave start transfers immediately*/ \
}
#define USART1
MSB bit is transmitted first.
Definition: spidrv.h:65
#define _USART_ROUTELOC0_CLKLOC_LOC11
SPI mode 0: CLKPOL=0, CLKPHA=0.
Definition: spidrv.h:71
CS controlled by SPI driver.
Definition: spidrv.h:80
#define _USART_ROUTELOC0_RXLOC_LOC11
Act as SPI master.
Definition: spidrv.h:57
#define _USART_ROUTELOC0_CSLOC_LOC11
#define _USART_ROUTELOC0_TXLOC_LOC11

Configuration data for SPI master using USART1.

Definition at line 200 of file spidrv.h.

Referenced by KSZ8851SNL_SPI_Init().

#define SPIDRV_MASTER_USART2
Value:
{ \
USART2, /* USART port */ \
_USART_ROUTELOC0_TXLOC_LOC0, /* USART Tx pin location number */ \
_USART_ROUTELOC0_RXLOC_LOC0, /* USART Rx pin location number */ \
_USART_ROUTELOC0_CLKLOC_LOC0, /* USART Clk pin location number */ \
_USART_ROUTELOC0_CSLOC_LOC0, /* USART Cs pin location number */ \
1000000, /* Bitrate */ \
8, /* Frame length */ \
0, /* Dummy tx value for rx only funcs */ \
spidrvMaster, /* SPI mode */ \
spidrvBitOrderMsbFirst, /* Bit order on bus */ \
spidrvClockMode0, /* SPI clock/phase mode */ \
spidrvCsControlAuto, /* CS controlled by the driver */ \
spidrvSlaveStartImmediate /* Slave start transfers immediately*/ \
}
#define _USART_ROUTELOC0_CSLOC_LOC0
MSB bit is transmitted first.
Definition: spidrv.h:65
#define _USART_ROUTELOC0_CLKLOC_LOC0
#define USART2
#define _USART_ROUTELOC0_TXLOC_LOC0
SPI mode 0: CLKPOL=0, CLKPHA=0.
Definition: spidrv.h:71
CS controlled by SPI driver.
Definition: spidrv.h:80
Act as SPI master.
Definition: spidrv.h:57
#define _USART_ROUTELOC0_RXLOC_LOC0

Configuration data for SPI master using USART2.

Definition at line 220 of file spidrv.h.

#define SPIDRV_MASTER_USART3
Value:
{ \
USART3, /* USART port */ \
_USART_ROUTELOC0_TXLOC_LOC0, /* USART Tx pin location number */ \
_USART_ROUTELOC0_RXLOC_LOC0, /* USART Rx pin location number */ \
_USART_ROUTELOC0_CLKLOC_LOC0, /* USART Clk pin location number */ \
_USART_ROUTELOC0_CSLOC_LOC0, /* USART Cs pin location number */ \
1000000, /* Bitrate */ \
8, /* Frame length */ \
0, /* Dummy tx value for rx only funcs */ \
spidrvMaster, /* SPI mode */ \
spidrvBitOrderMsbFirst, /* Bit order on bus */ \
spidrvClockMode0, /* SPI clock/phase mode */ \
spidrvCsControlAuto, /* CS controlled by the driver */ \
spidrvSlaveStartImmediate /* Slave start transfers immediately*/ \
}
#define _USART_ROUTELOC0_CSLOC_LOC0
MSB bit is transmitted first.
Definition: spidrv.h:65
#define _USART_ROUTELOC0_CLKLOC_LOC0
#define _USART_ROUTELOC0_TXLOC_LOC0
SPI mode 0: CLKPOL=0, CLKPHA=0.
Definition: spidrv.h:71
CS controlled by SPI driver.
Definition: spidrv.h:80
Act as SPI master.
Definition: spidrv.h:57
#define _USART_ROUTELOC0_RXLOC_LOC0
#define USART3

Configuration data for SPI master using USART3.

Definition at line 240 of file spidrv.h.

#define SPIDRV_SLAVE_USART0
Value:
{ \
USART0, /* USART port */ \
_USART_ROUTELOC0_TXLOC_LOC0, /* USART Tx pin location number */ \
_USART_ROUTELOC0_RXLOC_LOC0, /* USART Rx pin location number */ \
_USART_ROUTELOC0_CLKLOC_LOC1, /* USART Clk pin location number */ \
_USART_ROUTELOC0_CSLOC_LOC1, /* USART Cs pin location number */ \
0, /* Bitrate */ \
8, /* Frame length */ \
0, /* Dummy tx value for rx only funcs */ \
spidrvSlave, /* SPI mode */ \
spidrvBitOrderMsbFirst, /* Bit order on bus */ \
spidrvClockMode0, /* SPI clock/phase mode */ \
spidrvCsControlAuto, /* CS controlled by the driver */ \
spidrvSlaveStartImmediate /* Slave start transfers immediately*/ \
}
Act as SPI slave.
Definition: spidrv.h:58
MSB bit is transmitted first.
Definition: spidrv.h:65
#define USART0
#define _USART_ROUTELOC0_CLKLOC_LOC1
#define _USART_ROUTELOC0_TXLOC_LOC0
SPI mode 0: CLKPOL=0, CLKPHA=0.
Definition: spidrv.h:71
CS controlled by SPI driver.
Definition: spidrv.h:80
#define _USART_ROUTELOC0_CSLOC_LOC1
#define _USART_ROUTELOC0_RXLOC_LOC0

Configuration data for SPI slave using USART0.

Definition at line 300 of file spidrv.h.

#define SPIDRV_SLAVE_USART1
Value:
{ \
USART1, /* USART port */ \
_USART_ROUTELOC0_TXLOC_LOC11, /* USART Tx pin location number */ \
_USART_ROUTELOC0_RXLOC_LOC11, /* USART Rx pin location number */ \
_USART_ROUTELOC0_CLKLOC_LOC11,/* USART Clk pin location number */ \
_USART_ROUTELOC0_CSLOC_LOC11, /* USART Cs pin location number */ \
0, /* Bitrate */ \
8, /* Frame length */ \
0, /* Dummy tx value for rx only funcs */ \
spidrvSlave, /* SPI mode */ \
spidrvBitOrderMsbFirst, /* Bit order on bus */ \
spidrvClockMode0, /* SPI clock/phase mode */ \
spidrvCsControlAuto, /* CS controlled by the driver */ \
spidrvSlaveStartImmediate /* Slave start transfers immediately*/ \
}
Act as SPI slave.
Definition: spidrv.h:58
#define USART1
MSB bit is transmitted first.
Definition: spidrv.h:65
#define _USART_ROUTELOC0_CLKLOC_LOC11
SPI mode 0: CLKPOL=0, CLKPHA=0.
Definition: spidrv.h:71
CS controlled by SPI driver.
Definition: spidrv.h:80
#define _USART_ROUTELOC0_RXLOC_LOC11
#define _USART_ROUTELOC0_CSLOC_LOC11
#define _USART_ROUTELOC0_TXLOC_LOC11

Configuration data for SPI slave using USART1.

Definition at line 320 of file spidrv.h.

#define SPIDRV_SLAVE_USART2
Value:
{ \
USART2, /* USART port */ \
_USART_ROUTELOC0_TXLOC_LOC0, /* USART Tx pin location number */ \
_USART_ROUTELOC0_RXLOC_LOC0, /* USART Rx pin location number */ \
_USART_ROUTELOC0_CLKLOC_LOC0, /* USART Clk pin location number */ \
_USART_ROUTELOC0_CSLOC_LOC0, /* USART Cs pin location number */ \
0, /* Bitrate */ \
8, /* Frame length */ \
0, /* Dummy tx value for rx only funcs */ \
spidrvSlave, /* SPI mode */ \
spidrvBitOrderMsbFirst, /* Bit order on bus */ \
spidrvClockMode0, /* SPI clock/phase mode */ \
spidrvCsControlAuto, /* CS controlled by the driver */ \
spidrvSlaveStartImmediate /* Slave start transfers immediately*/ \
}
#define _USART_ROUTELOC0_CSLOC_LOC0
Act as SPI slave.
Definition: spidrv.h:58
MSB bit is transmitted first.
Definition: spidrv.h:65
#define _USART_ROUTELOC0_CLKLOC_LOC0
#define USART2
#define _USART_ROUTELOC0_TXLOC_LOC0
SPI mode 0: CLKPOL=0, CLKPHA=0.
Definition: spidrv.h:71
CS controlled by SPI driver.
Definition: spidrv.h:80
#define _USART_ROUTELOC0_RXLOC_LOC0

Configuration data for SPI slave using USART2.

Definition at line 340 of file spidrv.h.

#define SPIDRV_SLAVE_USART3
Value:
{ \
USART3, /* USART port */ \
_USART_ROUTELOC0_TXLOC_LOC0, /* USART Tx pin location number */ \
_USART_ROUTELOC0_RXLOC_LOC0, /* USART Rx pin location number */ \
_USART_ROUTELOC0_CLKLOC_LOC0, /* USART Clk pin location number */ \
_USART_ROUTELOC0_CSLOC_LOC0, /* USART Cs pin location number */ \
0, /* Bitrate */ \
8, /* Frame length */ \
0, /* Dummy tx value for rx only funcs */ \
spidrvSlave, /* SPI mode */ \
spidrvBitOrderMsbFirst, /* Bit order on bus */ \
spidrvClockMode0, /* SPI clock/phase mode */ \
spidrvCsControlAuto, /* CS controlled by the driver */ \
spidrvSlaveStartImmediate /* Slave start transfers immediately*/ \
}
#define _USART_ROUTELOC0_CSLOC_LOC0
Act as SPI slave.
Definition: spidrv.h:58
MSB bit is transmitted first.
Definition: spidrv.h:65
#define _USART_ROUTELOC0_CLKLOC_LOC0
#define _USART_ROUTELOC0_TXLOC_LOC0
SPI mode 0: CLKPOL=0, CLKPHA=0.
Definition: spidrv.h:71
CS controlled by SPI driver.
Definition: spidrv.h:80
#define _USART_ROUTELOC0_RXLOC_LOC0
#define USART3

Configuration data for SPI slave using USART3.

Definition at line 360 of file spidrv.h.

Typedef Documentation

typedef void(* SPIDRV_Callback_t) (struct SPIDRV_HandleData *handle, Ecode_t transferStatus, int itemsTransferred)

SPIDRV transfer completion callback function.

The callback function is called when a transfer has completed. An application should check the transferStatus and itemsTransferred values.

Parameters
[in]handleThe SPIDRV device handle used to start the transfer.
[in]transferStatusNumber of bytes actually transferred.
[in]itemsTransferredNumber of bytes transferred.
Returns
ECODE_EMDRV_SPIDRV_OK on success, ECODE_EMDRV_SPIDRV_TIMEOUT on timeout. Timeouts are only relevant for slave mode transfers.

Definition at line 114 of file spidrv.h.

SPI driver instance handle data structure. The handle is allocated by the application using SPIDRV. There may be several concurrent driver instances in an application. The application is not supposed to neither write nor read the contents of the handle.

typedef struct SPIDRV_Init SPIDRV_Init_t

SPI driver instance initialization structure. This data structure contains a number of SPIDRV configuration options. This struct is passed to SPIDRV_Init() when initializing a SPIDRV instance. Some common initialization data sets are predefined in SPIDRV_MASTER_USART0 and friends.

Enumeration Type Documentation

SPI bus bit order.

Enumerator
spidrvBitOrderLsbFirst 

LSB bit is transmitted first.

spidrvBitOrderMsbFirst 

MSB bit is transmitted first.

Definition at line 62 of file spidrv.h.

SPI clock mode (clock polarity and phase).

Enumerator
spidrvClockMode0 

SPI mode 0: CLKPOL=0, CLKPHA=0.

spidrvClockMode1 

SPI mode 1: CLKPOL=0, CLKPHA=1.

spidrvClockMode2 

SPI mode 2: CLKPOL=1, CLKPHA=0.

spidrvClockMode3 

SPI mode 3: CLKPOL=1, CLKPHA=1.

Definition at line 69 of file spidrv.h.

SPI master chip select (CS) control scheme.

Enumerator
spidrvCsControlAuto 

CS controlled by SPI driver.

spidrvCsControlApplication 

CS controlled by application.

Definition at line 78 of file spidrv.h.

SPI slave transfer start scheme.

Enumerator
spidrvSlaveStartImmediate 

Transfer is started immediately.

spidrvSlaveStartDelayed 

Transfer is started when bus is idle (CS deasserted).

Definition at line 85 of file spidrv.h.

SPI driver instance type.

Enumerator
spidrvMaster 

Act as SPI master.

spidrvSlave 

Act as SPI slave.

Definition at line 55 of file spidrv.h.

Function Documentation

Ecode_t SPIDRV_AbortTransfer ( SPIDRV_Handle_t  handle)

Abort an ongoing SPI transfer.

Parameters
[in]handlePointer to a SPI driver handle.
Returns
ECODE_EMDRV_SPIDRV_OK on success, ECODE_EMDRV_SPIDRV_IDLE if SPI is idle. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 388 of file spidrv.c.

References CORE_DECLARE_IRQ_STATE, CORE_ENTER_ATOMIC, CORE_EXIT_ATOMIC, DMADRV_StopTransfer(), DMADRV_TransferRemainingCount(), ECODE_EMDRV_SPIDRV_ABORTED, ECODE_EMDRV_SPIDRV_IDLE, ECODE_EMDRV_SPIDRV_ILLEGAL_HANDLE, ECODE_EMDRV_SPIDRV_OK, RTCDRV_StopTimer(), and spidrvSlave.

Ecode_t SPIDRV_DeInit ( SPIDRV_Handle_t  handle)

Deinitialize a SPI driver instance.

Parameters
[in]handlePointer to a SPI driver handle.
Returns
ECODE_EMDRV_SPIDRV_OK on success. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 347 of file spidrv.c.

References CMU_ClockEnable(), DMADRV_DeInit(), DMADRV_FreeChannel(), DMADRV_StopTransfer(), ECODE_EMDRV_SPIDRV_ILLEGAL_HANDLE, ECODE_EMDRV_SPIDRV_OK, RTCDRV_FreeTimer(), RTCDRV_StopTimer(), spidrvSlave, and USART_Reset().

Ecode_t SPIDRV_GetBitrate ( SPIDRV_Handle_t  handle,
uint32_t *  bitRate 
)

Get current SPI bus bitrate.

Parameters
[in]handlePointer to a SPI driver handle.
[out]bitRateCurrent SPI bus bitrate.
Returns
ECODE_EMDRV_SPIDRV_OK on success. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 443 of file spidrv.c.

References ECODE_EMDRV_SPIDRV_ILLEGAL_HANDLE, ECODE_EMDRV_SPIDRV_OK, ECODE_EMDRV_SPIDRV_PARAM_ERROR, and USART_BaudrateGet().

Ecode_t SPIDRV_GetFramelength ( SPIDRV_Handle_t  handle,
uint32_t *  frameLength 
)

Get current SPI framelength.

Parameters
[in]handlePointer to a SPI driver handle.
[out]frameLengthCurrent SPI bus framelength.
Returns
ECODE_EMDRV_SPIDRV_OK on success. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 472 of file spidrv.c.

References ECODE_EMDRV_SPIDRV_ILLEGAL_HANDLE, ECODE_EMDRV_SPIDRV_OK, and ECODE_EMDRV_SPIDRV_PARAM_ERROR.

Ecode_t SPIDRV_GetTransferStatus ( SPIDRV_Handle_t  handle,
int *  itemsTransferred,
int *  itemsRemaining 
)

Get the status of a SPI transfer.

Returns status of an ongoing transfer. If no transfer is in progress the status of the last transfer is reported.

Parameters
[in]handlePointer to a SPI driver handle.
[out]itemsTransferredNumber of items (frames) transferred.
[out]itemsRemainingNumber of items (frames) remaining.
Returns
ECODE_EMDRV_SPIDRV_OK on success. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 507 of file spidrv.c.

References CORE_ATOMIC_SECTION, ECODE_EMDRV_SPIDRV_ILLEGAL_HANDLE, ECODE_EMDRV_SPIDRV_OK, and ECODE_EMDRV_SPIDRV_PARAM_ERROR.

Ecode_t SPIDRV_Init ( SPIDRV_Handle_t  handle,
SPIDRV_Init_t initData 
)

Initialize a SPI driver instance.

Parameters
[out]handlePointer to a SPI driver handle, refer to SPIDRV_Handle_t.
[in]initDataPointer to an initialization data structure, refer to SPIDRV_Init_t.
Returns
ECODE_EMDRV_SPIDRV_OK on success. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 101 of file spidrv.c.

References _USART_ROUTELOC0_CLKLOC_MASK, _USART_ROUTELOC0_CLKLOC_SHIFT, _USART_ROUTELOC0_CSLOC_MASK, _USART_ROUTELOC0_CSLOC_SHIFT, _USART_ROUTELOC0_RXLOC_MASK, _USART_ROUTELOC0_RXLOC_SHIFT, _USART_ROUTELOC0_TXLOC_MASK, _USART_ROUTELOC0_TXLOC_SHIFT, USART_InitSync_TypeDef::baudrate, SPIDRV_Init::bitOrder, SPIDRV_Init::bitRate, SPIDRV_Init::clockMode, USART_InitSync_TypeDef::clockMode, CMU_ClockEnable(), cmuClock_GPIO, cmuClock_HFPER, cmuClock_USART0, cmuClock_USART1, cmuClock_USART2, cmuClock_USART3, CORE_DECLARE_IRQ_STATE, CORE_ENTER_ATOMIC, CORE_EXIT_ATOMIC, SPIDRV_Init::csControl, USART_TypeDef::CTRL, DMADRV_AllocateChannel(), DMADRV_Init(), dmadrvPeripheralSignal_USART0_RXDATAV, dmadrvPeripheralSignal_USART0_TXBL, dmadrvPeripheralSignal_USART1_RXDATAV, dmadrvPeripheralSignal_USART1_TXBL, dmadrvPeripheralSignal_USART2_RXDATAV, dmadrvPeripheralSignal_USART2_TXBL, dmadrvPeripheralSignal_USART3_RXDATAV, dmadrvPeripheralSignal_USART3_TXBL, ECODE_EMDRV_DMADRV_OK, ECODE_EMDRV_RTCDRV_OK, ECODE_EMDRV_SPIDRV_DMA_ALLOC_ERROR, ECODE_EMDRV_SPIDRV_ILLEGAL_HANDLE, ECODE_EMDRV_SPIDRV_OK, ECODE_EMDRV_SPIDRV_PARAM_ERROR, ECODE_EMDRV_SPIDRV_TIMER_ALLOC_ERROR, USART_InitSync_TypeDef::master, USART_InitSync_TypeDef::msbf, SPIDRV_Init::port, SPIDRV_Init::portLocationClk, SPIDRV_Init::portLocationCs, SPIDRV_Init::portLocationRx, SPIDRV_Init::portLocationTx, USART_TypeDef::ROUTELOC0, USART_TypeDef::ROUTEPEN, RTCDRV_AllocateTimer(), RTCDRV_Init(), spidrvBitOrderMsbFirst, spidrvClockMode0, spidrvClockMode1, spidrvClockMode2, spidrvClockMode3, spidrvCsControlAuto, spidrvMaster, spidrvSlave, SPIDRV_Init::type, USART0, USART1, USART2, USART3, USART_CTRL_AUTOCS, USART_InitSync(), USART_INITSYNC_DEFAULT, USART_ROUTEPEN_CLKPEN, USART_ROUTEPEN_CSPEN, USART_ROUTEPEN_RXPEN, USART_ROUTEPEN_TXPEN, usartClockMode0, usartClockMode1, usartClockMode2, and usartClockMode3.

Referenced by ezradio_hal_SpiInit(), and KSZ8851SNL_SPI_Init().

Ecode_t SPIDRV_MReceive ( SPIDRV_Handle_t  handle,
void *  buffer,
int  count,
SPIDRV_Callback_t  callback 
)

Start a SPI master receive transfer.

Note
The MOSI wire will transmit SPIDRV_Init_t::dummyTxValue.
Parameters
[in]handlePointer to a SPI driver handle.
[out]bufferReceive data buffer.
[in]countNumber of bytes in transfer.
[in]callbackTransfer completion callback.
Returns
ECODE_EMDRV_SPIDRV_OK on success. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 559 of file spidrv.c.

References ECODE_EMDRV_SPIDRV_MODE_ERROR, ECODE_EMDRV_SPIDRV_OK, and spidrvSlave.

Ecode_t SPIDRV_MReceiveB ( SPIDRV_Handle_t  handle,
void *  buffer,
int  count 
)

Start a SPI master blocking receive transfer.

Note
The MOSI wire will transmit SPIDRV_Init_t::dummyTxValue.
This function is blocking and returns when the transfer has completed, or when SPIDRV_AbortTransfer() is called.
Parameters
[in]handlePointer to a SPI driver handle.
[out]bufferReceive data buffer.
[in]countNumber of bytes in transfer.
Returns
ECODE_EMDRV_SPIDRV_OK on success or ECODE_EMDRV_SPIDRV_ABORTED if SPIDRV_AbortTransfer() has been called. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 602 of file spidrv.c.

References ECODE_EMDRV_SPIDRV_MODE_ERROR, ECODE_EMDRV_SPIDRV_OK, and spidrvSlave.

Referenced by ezradio_hal_SpiReadByte(), ezradio_hal_SpiReadData(), and KSZ8851SNL_SPI_Receive().

Ecode_t SPIDRV_MTransfer ( SPIDRV_Handle_t  handle,
const void *  txBuffer,
void *  rxBuffer,
int  count,
SPIDRV_Callback_t  callback 
)

Start a SPI master transfer.

Parameters
[in]handlePointer to a SPI driver handle.
[in]txBufferTransmit data buffer.
[out]rxBufferReceive data buffer.
[in]countNumber of bytes in transfer.
[in]callbackTransfer completion callback.
Returns
ECODE_EMDRV_SPIDRV_OK on success. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 644 of file spidrv.c.

References ECODE_EMDRV_SPIDRV_MODE_ERROR, ECODE_EMDRV_SPIDRV_OK, ECODE_EMDRV_SPIDRV_PARAM_ERROR, and spidrvSlave.

Ecode_t SPIDRV_MTransferB ( SPIDRV_Handle_t  handle,
const void *  txBuffer,
void *  rxBuffer,
int  count 
)

Start a SPI master blocking transfer.

Note
This function is blocking and returns when the transfer has completed, or when SPIDRV_AbortTransfer() is called.
Parameters
[in]handlePointer to a SPI driver handle.
[in]txBufferTransmit data buffer.
[out]rxBufferReceive data buffer.
[in]countNumber of bytes in transfer.
Returns
ECODE_EMDRV_SPIDRV_OK on success or ECODE_EMDRV_SPIDRV_ABORTED if SPIDRV_AbortTransfer() has been called. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 694 of file spidrv.c.

References ECODE_EMDRV_SPIDRV_MODE_ERROR, ECODE_EMDRV_SPIDRV_OK, ECODE_EMDRV_SPIDRV_PARAM_ERROR, and spidrvSlave.

Referenced by ezradio_hal_SpiWriteReadData(), and KSZ8851SNL_SPI_ReadRegister().

Ecode_t SPIDRV_MTransferSingleItemB ( SPIDRV_Handle_t  handle,
uint32_t  txValue,
void *  rxValue 
)

Start a SPI master blocking single item (frame) transfer.

Note
This function is blocking and returns when the transfer has completed, or when SPIDRV_AbortTransfer() is called.
Parameters
[in]handlePointer to a SPI driver handle.
[in]txValueValue to transmit.
[out]rxValueValue received.
Returns
ECODE_EMDRV_SPIDRV_OK on success or ECODE_EMDRV_SPIDRV_ABORTED if SPIDRV_AbortTransfer() has been called. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 743 of file spidrv.c.

References CORE_DECLARE_IRQ_STATE, CORE_ENTER_ATOMIC, CORE_EXIT_ATOMIC, ECODE_EMDRV_SPIDRV_BUSY, ECODE_EMDRV_SPIDRV_ILLEGAL_HANDLE, ECODE_EMDRV_SPIDRV_MODE_ERROR, rxBuffer, and spidrvSlave.

Ecode_t SPIDRV_MTransmit ( SPIDRV_Handle_t  handle,
const void *  buffer,
int  count,
SPIDRV_Callback_t  callback 
)

Start a SPI master transmit transfer.

Note
The data received on the MISO wire is discarded.
Parameters
[in]handlePointer to a SPI driver handle.
[in]bufferTransmit data buffer.
[in]countNumber of bytes in transfer.
[in]callbackTransfer completion callback.
Returns
ECODE_EMDRV_SPIDRV_OK on success. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 801 of file spidrv.c.

References ECODE_EMDRV_SPIDRV_MODE_ERROR, ECODE_EMDRV_SPIDRV_OK, and spidrvSlave.

Ecode_t SPIDRV_MTransmitB ( SPIDRV_Handle_t  handle,
const void *  buffer,
int  count 
)

Start a SPI master blocking transmit transfer.

Note
The data received on the MISO wire is discarded.
This function is blocking and returns when the transfer is completed.
Parameters
[in]handlePointer to a SPI driver handle.
[in]bufferTransmit data buffer.
[in]countNumber of bytes in transfer.
Returns
ECODE_EMDRV_SPIDRV_OK on success or ECODE_EMDRV_SPIDRV_ABORTED if SPIDRV_AbortTransfer() has been called. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 843 of file spidrv.c.

References ECODE_EMDRV_SPIDRV_MODE_ERROR, ECODE_EMDRV_SPIDRV_OK, and spidrvSlave.

Referenced by ezradio_hal_SpiWriteByte(), ezradio_hal_SpiWriteData(), and KSZ8851SNL_SPI_Transmit().

Ecode_t SPIDRV_SetBitrate ( SPIDRV_Handle_t  handle,
uint32_t  bitRate 
)

Set SPI bus bitrate.

Parameters
[in]handlePointer to a SPI driver handle.
[in]bitRateNew SPI bus bitrate.
Returns
ECODE_EMDRV_SPIDRV_OK on success. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 879 of file spidrv.c.

References CORE_DECLARE_IRQ_STATE, CORE_ENTER_ATOMIC, CORE_EXIT_ATOMIC, ECODE_EMDRV_SPIDRV_BUSY, ECODE_EMDRV_SPIDRV_ILLEGAL_HANDLE, ECODE_EMDRV_SPIDRV_OK, and USART_BaudrateSyncSet().

Ecode_t SPIDRV_SetFramelength ( SPIDRV_Handle_t  handle,
uint32_t  frameLength 
)

Set SPI framelength.

Parameters
[in]handlePointer to a SPI driver handle.
[in]frameLengthNew SPI bus framelength.
Returns
ECODE_EMDRV_SPIDRV_OK on success. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 914 of file spidrv.c.

References _USART_FRAME_DATABITS_FOUR, _USART_FRAME_DATABITS_MASK, _USART_FRAME_DATABITS_SHIFT, _USART_FRAME_DATABITS_SIXTEEN, CORE_DECLARE_IRQ_STATE, CORE_ENTER_ATOMIC, CORE_EXIT_ATOMIC, ECODE_EMDRV_SPIDRV_BUSY, ECODE_EMDRV_SPIDRV_ILLEGAL_HANDLE, ECODE_EMDRV_SPIDRV_OK, and ECODE_EMDRV_SPIDRV_PARAM_ERROR.

Ecode_t SPIDRV_SReceive ( SPIDRV_Handle_t  handle,
void *  buffer,
int  count,
SPIDRV_Callback_t  callback,
int  timeoutMs 
)

Start a SPI slave receive transfer.

Note
The MISO wire will transmit SPIDRV_Init_t::dummyTxValue.
Parameters
[in]handlePointer to a SPI driver handle.
[out]bufferReceive data buffer.
[in]countNumber of bytes in transfer.
[in]callbackTransfer completion callback.
[in]timeoutMsTransfer timeout in milliseconds.
Returns
ECODE_EMDRV_SPIDRV_OK on success. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 969 of file spidrv.c.

References ECODE_EMDRV_SPIDRV_MODE_ERROR, ECODE_EMDRV_SPIDRV_OK, RTCDRV_StartTimer(), rtcdrvTimerTypeOneshot, spidrvMaster, and spidrvSlaveStartDelayed.

Ecode_t SPIDRV_SReceiveB ( SPIDRV_Handle_t  handle,
void *  buffer,
int  count,
int  timeoutMs 
)

Start a SPI slave blocking receive transfer.

Note
The MISO wire will transmit SPIDRV_Init_t::dummyTxValue.
This function is blocking and returns when the transfer has completed, or on timeout or when SPIDRV_AbortTransfer() is called.
Parameters
[in]handlePointer to a SPI driver handle.
[out]bufferReceive data buffer.
[in]countNumber of bytes in transfer.
[in]timeoutMsTransfer timeout in milliseconds.
Returns
ECODE_EMDRV_SPIDRV_OK on success, ECODE_EMDRV_SPIDRV_TIMEOUT on timeout or ECODE_EMDRV_SPIDRV_ABORTED if SPIDRV_AbortTransfer() has been called. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 1033 of file spidrv.c.

References ECODE_EMDRV_SPIDRV_MODE_ERROR, ECODE_EMDRV_SPIDRV_OK, RTCDRV_StartTimer(), rtcdrvTimerTypeOneshot, spidrvMaster, and spidrvSlaveStartDelayed.

Ecode_t SPIDRV_STransfer ( SPIDRV_Handle_t  handle,
const void *  txBuffer,
void *  rxBuffer,
int  count,
SPIDRV_Callback_t  callback,
int  timeoutMs 
)

Start a SPI slave transfer.

Parameters
[in]handlePointer to a SPI driver handle.
[in]txBufferTransmit data buffer.
[out]rxBufferReceive data buffer.
[in]countNumber of bytes in transfer.
[in]callbackTransfer completion callback.
[in]timeoutMsTransfer timeout in milliseconds.
Returns
ECODE_EMDRV_SPIDRV_OK on success. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 1095 of file spidrv.c.

References ECODE_EMDRV_SPIDRV_MODE_ERROR, ECODE_EMDRV_SPIDRV_OK, ECODE_EMDRV_SPIDRV_PARAM_ERROR, RTCDRV_StartTimer(), rtcdrvTimerTypeOneshot, spidrvMaster, and spidrvSlaveStartDelayed.

Ecode_t SPIDRV_STransferB ( SPIDRV_Handle_t  handle,
const void *  txBuffer,
void *  rxBuffer,
int  count,
int  timeoutMs 
)

Start a SPI slave blocking transfer.

Note

This function is blocking and returns when the transfer has completed, or on timeout or when SPIDRV_AbortTransfer() is called.
Parameters
[in]handlePointer to a SPI driver handle.
[in]txBufferTransmit data buffer.
[out]rxBufferReceive data buffer.
[in]countNumber of bytes in transfer.
[in]timeoutMsTransfer timeout in milliseconds.
Returns
ECODE_EMDRV_SPIDRV_OK on success, ECODE_EMDRV_SPIDRV_TIMEOUT on timeout or ECODE_EMDRV_SPIDRV_ABORTED if SPIDRV_AbortTransfer() has been called. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 1166 of file spidrv.c.

References ECODE_EMDRV_SPIDRV_MODE_ERROR, ECODE_EMDRV_SPIDRV_OK, ECODE_EMDRV_SPIDRV_PARAM_ERROR, RTCDRV_StartTimer(), rtcdrvTimerTypeOneshot, spidrvMaster, and spidrvSlaveStartDelayed.

Ecode_t SPIDRV_STransmit ( SPIDRV_Handle_t  handle,
const void *  buffer,
int  count,
SPIDRV_Callback_t  callback,
int  timeoutMs 
)

Start a SPI slave transmit transfer.

Note
The data received on the MOSI wire is discarded.
Parameters
[in]handlePointer to a SPI driver handle.
[in]bufferTransmit data buffer.
[in]countNumber of bytes in transfer.
[in]callbackTransfer completion callback.
[in]timeoutMsTransfer timeout in milliseconds.
Returns
ECODE_EMDRV_SPIDRV_OK on success. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 1235 of file spidrv.c.

References ECODE_EMDRV_SPIDRV_MODE_ERROR, ECODE_EMDRV_SPIDRV_OK, RTCDRV_StartTimer(), rtcdrvTimerTypeOneshot, spidrvMaster, and spidrvSlaveStartDelayed.

Ecode_t SPIDRV_STransmitB ( SPIDRV_Handle_t  handle,
const void *  buffer,
int  count,
int  timeoutMs 
)

Start a SPI slave blocking transmit transfer.

Note
The data received on the MOSI wire is discarded.
This function is blocking and returns when the transfer has completed, or on timeout or when SPIDRV_AbortTransfer() is called.
Parameters
[in]handlePointer to a SPI driver handle.
[in]bufferTransmit data buffer.
[in]countNumber of bytes in transfer.
[in]timeoutMsTransfer timeout in milliseconds.
Returns
ECODE_EMDRV_SPIDRV_OK on success, ECODE_EMDRV_SPIDRV_TIMEOUT on timeout or ECODE_EMDRV_SPIDRV_ABORTED if SPIDRV_AbortTransfer() has been called. On failure an appropriate SPIDRV Ecode_t is returned.

Definition at line 1299 of file spidrv.c.

References ECODE_EMDRV_SPIDRV_MODE_ERROR, ECODE_EMDRV_SPIDRV_OK, RTCDRV_StartTimer(), rtcdrvTimerTypeOneshot, spidrvMaster, and spidrvSlaveStartDelayed.