iLLD_TC29x  1.0
Collaboration diagram for SPI interface:

Data Structures

struct  SpiIf_Flags
 
struct  SpiIf_Job
 
struct  SpiIf_funcs
 
struct  SpiIf_
 
struct  SpiIf_Config
 
struct  Spi_ErrorChecks
 
struct  SpiIf_ChMode
 
struct  SpiIf_Ch_
 
struct  SpiIf_ChConfig_
 

Macros

#define IFXQSPI_BACONSIZE(Datasize)   ((((Datasize) % 16)== 0) ? ((uint8)((Datasize)/16)) : ((uint8)((Datasize)/16) + 1))
 
#define IFXQSPI_FIFO32BITSIZE(Datasize)   (((Datasize) % 4)== 0) ? ((uint8)((Datasize)/4)) : ((uint8)((Datasize)/4) + 1)
 
#define IFXQSPI_GETLONGMODEFIFOSIZE(Datasize)   IFXQSPI_BACONSIZE(Datasize) + IFXQSPI_FIFO32BITSIZE(Datasize)
 

Typedefs

typedef struct SpiIf_Ch_ SpiIf_Ch
 Alias to the channel structure. More...
 
typedef struct SpiIf_ChConfig_ SpiIf_ChConfig
 
typedef struct SpiIf_ SpiIf
 
typedef SpiIf_Status(* SpiIf_Exchange )(SpiIf_Ch *handle, const void *src, void *dest, Ifx_SizeT numOfData)
 
typedef SpiIf_Status(* SpiIf_GetStatus )(SpiIf_Ch *handle)
 
typedef void(* SpiIf_OnEvent )(SpiIf *handle)
 
typedef void(* SpiIf_Cbk )(void *data)
 SPI channel callback prototype. More...
 
typedef void(* TxRxHandler )(SpiIf_Ch *handle)
 

Enumerations

enum  SpiIf_Status {
  SpiIf_Status_ok,
  SpiIf_Status_busy,
  SpiIf_Status_unknown
}
 SPI Interface Status. More...
 
enum  SpiIf_SlsoTiming {
  SpiIf_SlsoTiming_0 = 0,
  SpiIf_SlsoTiming_1,
  SpiIf_SlsoTiming_2,
  SpiIf_SlsoTiming_3,
  SpiIf_SlsoTiming_4,
  SpiIf_SlsoTiming_5,
  SpiIf_SlsoTiming_6,
  SpiIf_SlsoTiming_7
}
 Slave select output timing. More...
 
enum  SpiIf_DataHeading {
  SpiIf_DataHeading_lsbFirst = 0,
  SpiIf_DataHeading_msbFirst
}
 Heading. More...
 
enum  SpiIf_ShiftClock {
  SpiIf_ShiftClock_shiftTransmitDataOnLeadingEdge = 0,
  SpiIf_ShiftClock_shiftTransmitDataOnTrailingEdge
}
 Clock phase. More...
 
enum  SpiIf_ClockPolarity {
  SpiIf_ClockPolarity_idleLow = 0,
  SpiIf_ClockPolarity_idleHigh
}
 Clock polarity. More...
 
enum  SpiIf_Mode {
  SpiIf_Mode_master,
  SpiIf_Mode_slave,
  SpiIf_Mode_undefined
}
 

Functions

IFX_INLINE void SpiIf_wait (SpiIf_Ch *handle)
 
IFX_EXTERN void SpiIf_initConfig (SpiIf_Config *config)
 
IFX_EXTERN void SpiIf_initChannelConfig (SpiIf_ChConfig *config, SpiIf *driver)
 

Virtual functions

These functions are implemented by a driver.

IFX_INLINE SpiIf_Status SpiIf_exchange (SpiIf_Ch *handle, const void *src, void *dest, Ifx_SizeT numOfData)
 
IFX_INLINE SpiIf_Status SpiIf_getStatus (SpiIf_Ch *handle)
 

Detailed Description


Data Structure Documentation

struct SpiIf_Flags

Definition at line 108 of file SpiIf.h.

Data Fields
uint32 byteAccess: 1 Channel status: 8bit / 16 bit access.
uint32 onTransfer: 1 Channel status: On transfer.
struct SpiIf_Job

Definition at line 114 of file SpiIf.h.

Data Fields
void * data
Ifx_SizeT remaining
struct SpiIf_funcs

Definition at line 132 of file SpiIf.h.

Collaboration diagram for SpiIf_funcs:
Data Fields
SpiIf_Exchange exchange
SpiIf_GetStatus getStatus
SpiIf_OnEvent onError
SpiIf_OnEvent onRx
SpiIf_OnEvent onTx
struct SpiIf_

Definition at line 141 of file SpiIf.h.

Collaboration diagram for SpiIf_:
Data Fields
SpiIf_Ch * activeChannel Channel actually transmitting / receiving.
pvoid driver Spi specific driver.
SpiIf_funcs functions
uint32 rxCount
uint32 sending
uint32 txCount
struct SpiIf_Config

Definition at line 151 of file SpiIf.h.

Data Fields
void * buffer Specifies the buffer location.The buffer parameter must point on a free memory location where the buffer object will be initialised. The Size of this area must be at least equals to "Size + sizeof(Ifx_Fifo) + 8", with "Size=config->bufferSize * Ifx_AlignOn32(sizeof(Spi_Ch*))". Not tacking this in account may result in unpredictable behaviour.
Ifx_SizeT bufferSize Specifies the number of channels that can be buffered. If 0, buffering is disabled.
Ifx_Priority erPriority Specifies the priority of the error interrupt.
IfxSrc_Tos isrProvider Specifies the handler of the interrupts.
float32 maximumBaudrate Maximum baudrate used by the channels, this value is used to optimise the SPI internal clock.
SpiIf_Mode mode Specifies the interface operation mode.
Ifx_Priority rxPriority Specifies the priority of the receive interrupt.
Ifx_Priority txPriority Specifies the priority of the transmit interrupt.
struct Spi_ErrorChecks

Definition at line 167 of file SpiIf.h.

Data Fields
uint32 baudrate: 1 TRUE = checked, FALSE = ignored.
uint32 phase: 1 TRUE = checked, FALSE = ignored.
uint32 receive: 1 TRUE = checked, FALSE = ignored.
uint32 reserved: 28
uint32 transmit: 1 TRUE = checked, FALSE = ignored.
struct SpiIf_ChMode

Channel operation mode

Definition at line 177 of file SpiIf.h.

Data Fields
uint32 autoCS: 1 1 = chip select is controlled by the hardware module or, 0 = by software.
uint32 clockPolarity: 1 SpiIf_ClockPolarity
uint32 csActiveLevel: 1 Ifx_ActiveState
uint32 csInactiveDelay: 3 SpiIf_SlsoTiming
uint32 csLeadDelay: 3 SpiIf_SlsoTiming
uint32 csTrailDelay: 3 SpiIf_SlsoTiming
uint32 dataHeading: 1 SpiIf_DataHeading
uint32 dataWidth: 6 range 2 .. 32 bits (note 2 = 2-bits, 3 = 3-bits ...
uint32 enabled: 1 1 = channel enabled, 0 = channel disabled
uint32 loopback: 1 0 = normal mode, 1 = loopback mode
uint32 parityCheck: 1 0 = disabled, 1 = enabled
uint32 parityMode: 1 Ifx_ParityMode
uint32 shiftClock: 1 SpiIf_ShiftClock
struct SpiIf_Ch_

Definition at line 199 of file SpiIf.h.

Collaboration diagram for SpiIf_Ch_:
Data Fields
sint32 baudrate Real baudrate.
void * callbackData Specifies pointer to the user specific data on transmit end.
SpiIf * driver Pointer to the SPI interface driver.
Spi_ErrorChecks errorChecks Error checks.
SpiIf_Flags flags
SpiIf_Cbk onExchangeEnd Specifies the callback function on end of exchange.
SpiIf_Job rx
TxRxHandler rxHandler
SpiIf_Job tx
TxRxHandler txHandler
struct SpiIf_ChConfig_

Definition at line 213 of file SpiIf.h.

Collaboration diagram for SpiIf_ChConfig_:
Data Fields
float32 baudrate Specifies the SPI baudrate.
SpiIf * driver Pointer to an implementation of SPI interface driver, e.g. IfxQspi_SpiMaster_ChannelConfig.
Spi_ErrorChecks errorChecks
SpiIf_ChMode mode

Macro Definition Documentation

#define IFXQSPI_BACONSIZE (   Datasize)    ((((Datasize) % 16)== 0) ? ((uint8)((Datasize)/16)) : ((uint8)((Datasize)/16) + 1))

Definition at line 47 of file SpiIf.h.

#define IFXQSPI_FIFO32BITSIZE (   Datasize)    (((Datasize) % 4)== 0) ? ((uint8)((Datasize)/4)) : ((uint8)((Datasize)/4) + 1)

Definition at line 50 of file SpiIf.h.

#define IFXQSPI_GETLONGMODEFIFOSIZE (   Datasize)    IFXQSPI_BACONSIZE(Datasize) + IFXQSPI_FIFO32BITSIZE(Datasize)

Definition at line 53 of file SpiIf.h.

Typedef Documentation

typedef struct SpiIf_ SpiIf

Definition at line 106 of file SpiIf.h.

typedef void(* SpiIf_Cbk)(void *data)

SPI channel callback prototype.

Definition at line 196 of file SpiIf.h.

typedef struct SpiIf_Ch_ SpiIf_Ch

Alias to the channel structure.

Definition at line 104 of file SpiIf.h.

Definition at line 105 of file SpiIf.h.

typedef SpiIf_Status(* SpiIf_Exchange)(SpiIf_Ch *handle, const void *src, void *dest, Ifx_SizeT numOfData)

Definition at line 128 of file SpiIf.h.

typedef SpiIf_Status(* SpiIf_GetStatus)(SpiIf_Ch *handle)

Definition at line 129 of file SpiIf.h.

typedef void(* SpiIf_OnEvent)(SpiIf *handle)

Definition at line 130 of file SpiIf.h.

typedef void(* TxRxHandler)(SpiIf_Ch *handle)

Definition at line 197 of file SpiIf.h.

Enumeration Type Documentation

Clock polarity.

Enumerator
SpiIf_ClockPolarity_idleLow 

Idle clock line is low

SpiIf_ClockPolarity_idleHigh 

Idle clock line is high

Definition at line 94 of file SpiIf.h.

Heading.

Enumerator
SpiIf_DataHeading_lsbFirst 

LSB first

SpiIf_DataHeading_msbFirst 

MSB first

Definition at line 80 of file SpiIf.h.

enum SpiIf_Mode

SPI operation modes

Enumerator
SpiIf_Mode_master 

Master mode.

SpiIf_Mode_slave 

Slave mode.

SpiIf_Mode_undefined 

Undefined mode.

Definition at line 121 of file SpiIf.h.

Clock phase.

Enumerator
SpiIf_ShiftClock_shiftTransmitDataOnLeadingEdge 

Shift Tx data on leading edge

SpiIf_ShiftClock_shiftTransmitDataOnTrailingEdge 

Shift Tx data on training edge

Definition at line 87 of file SpiIf.h.

Slave select output timing.

Enumerator
SpiIf_SlsoTiming_0 

zero delay clock

SpiIf_SlsoTiming_1 

1 half-clock delay

SpiIf_SlsoTiming_2 

2 half-clock delay

SpiIf_SlsoTiming_3 

3 half-clock delay

SpiIf_SlsoTiming_4 

4 half-clock delay

SpiIf_SlsoTiming_5 

5 half-clock delay

SpiIf_SlsoTiming_6 

6 half-clock delay

SpiIf_SlsoTiming_7 

7 half-clock delay

Definition at line 67 of file SpiIf.h.

SPI Interface Status.

Enumerator
SpiIf_Status_ok 
SpiIf_Status_busy 
SpiIf_Status_unknown 

Definition at line 59 of file SpiIf.h.

Function Documentation

IFX_INLINE SpiIf_Status SpiIf_exchange ( SpiIf_Ch handle,
const void *  src,
void *  dest,
Ifx_SizeT  numOfData 
)

Perform the SPI exchange operation.

Parameters
handlePointer to an implementation of SPI interface driver
srcPointer to the start of data buffer for data to transmit
destPointer to the start of data buffer for received data
numOfDataspecifies number of byte/bit to transfer
Returns
STATUS of SPI
Note
the src and dest may be the same data location.

Definition at line 259 of file SpiIf.h.

IFX_INLINE SpiIf_Status SpiIf_getStatus ( SpiIf_Ch handle)

get the SPI status

  • Parameters
    handlePointer to an implementation of SPI interface driver
    Returns
    STATUS of SPI

Definition at line 269 of file SpiIf.h.

IFX_EXTERN void SpiIf_initChannelConfig ( SpiIf_ChConfig config,
SpiIf driver 
)

Definition at line 40 of file SpiIf.c.

Referenced by IfxQspi_SpiMaster_initChannelConfig(), and IfxQspi_SpiSlave_initModule().

IFX_EXTERN void SpiIf_initConfig ( SpiIf_Config config)
IFX_INLINE void SpiIf_wait ( SpiIf_Ch handle)

Wait as long as the transmission is on-going

Note
This function blocks CPU for some-time

Definition at line 244 of file SpiIf.h.