50 #include "sw/modules/types/src/types.h"
71 #define SPIA_BASE_ADDR (0x00007040)
75 #define SPIB_BASE_ADDR (0x00007740)
79 #define SPI_SPICCR_CHAR_LENGTH_BITS (15 << 0)
83 #define SPI_SPICCR_SPILBK_BITS ( 1 << 4)
87 #define SPI_SPICCR_CLKPOL_BITS ( 1 << 6)
91 #define SPI_SPICCR_RESET_BITS ( 1 << 7)
95 #define SPI_SPIST_INTFLAG_BITS ( 1 << 6)
99 #define SPI_SPIST_TXBUF_BITS (1 << 5)
103 #define SPI_SPICTL_INT_ENA_BITS (1 << 0)
107 #define SPI_SPICTL_TALK_BITS (1 << 1)
111 #define SPI_SPICTL_MODE_BITS (1 << 2)
115 #define SPI_SPICTL_CLK_PHASE_BITS (1 << 3)
119 #define SPI_SPICTL_OVRRUN_INT_ENA_BITS (1 << 4)
124 #define SPI_SPIFFRX_IL_BITS (31 << 0)
128 #define SPI_SPIFFRX_IENA_BITS ( 1 << 5)
132 #define SPI_SPIFFRX_INTCLR_BITS ( 1 << 6)
136 #define SPI_SPIFFRX_INT_BITS ( 1 << 7)
140 #define SPI_SPIFFRX_FIFO_ST_BITS (31 << 8)
144 #define SPI_SPIFFRX_FIFO_RESET_BITS ( 1 << 13)
148 #define SPI_SPIFFRX_FIFO_OVFCLR_BITS ( 1 << 14)
152 #define SPI_SPIFFRX_FIFO_OVF_BITS ( 1 << 15)
157 #define SPI_SPIFFTX_IL_BITS (31 << 0)
161 #define SPI_SPIFFTX_IENA_BITS ( 1 << 5)
165 #define SPI_SPIFFTX_INTCLR_BITS ( 1 << 6)
169 #define SPI_SPIFFTX_INT_BITS ( 1 << 7)
173 #define SPI_SPIFFTX_FIFO_ST_BITS (31 << 8)
177 #define SPI_SPIFFTX_FIFO_RESET_BITS ( 1 << 13)
181 #define SPI_SPIFFTX_FIFO_ENA_BITS ( 1 << 14)
185 #define SPI_SPIFFTX_CHAN_RESET_BITS ( 1 << 15)
190 #define SPI_SPIPRI_SUSP_BITS ( 3 << 4)
194 #define SPI_SPIPRI_STE_INV_BITS ( 1 << 1)
198 #define SPI_SPIPRI_TRIWIRE ( 1 << 0)
511 extern SPI_Handle
SPI_init(
void *pMemory,
const size_t numBytes);
517 static inline uint16_t
SPI_read(SPI_Handle spiHandle)
538 uint16_t data = spi->
SPIEMU;
546 extern void SPI_reset(SPI_Handle spiHandle);
627 extern void SPI_setTxDelay(SPI_Handle spiHandle,
const uint_least8_t delay);
639 static inline void SPI_write(SPI_Handle spiHandle,
const uint16_t data)
654 static inline void SPI_write8(SPI_Handle spiHandle,
const uint16_t data)
670 #endif // end of _SPI_H_ definition
void SPI_setBaudRate(SPI_Handle spiHandle, const SPI_BaudRate_e baudRate)
Sets the serial peripheral interface (SPI) baud rate.
void SPI_disableInt(SPI_Handle spiHandle)
Disables the serial peripheral interface (SPI) interrupt.
Defines the serial peripheral interface (SPI) object.
Denotes transmission or reception completed.
void SPI_clearTxFifoInt(SPI_Handle spiHandle)
Clears the Tx FIFO interrupt flag.
SPI_TxBufferStatus_e
Enumeration to define the serial peripheral interface (SPI) Tx Buffer Status.
void SPI_enableRxFifoInt(SPI_Handle spiHandle)
Enables the serial peripheral interface (SPI) receive FIFO interrupt.
void SPI_enableTxFifoEnh(SPI_Handle spiHandle)
Enables the serial peripheral interface (SPI) transmit FIFO enhancements.
void SPI_enableChannels(SPI_Handle spiHandle)
Enables the serial peripheral interface (SPI) transmit and receive channels.
Denotes the fifo contains 4 words.
static uint16_t SPI_read(SPI_Handle spiHandle)
Reads data from the serial peripheral interface (SPI)
Emulation Suspend option 2.
Denotes a character length of 16 bits.
Denotes transmission or reception in progress.
void SPI_resetChannels(SPI_Handle spiHandle)
Resets the serial peripheral interface (SPI) transmit and receive channels.
void SPI_disableTxFifoInt(SPI_Handle spiHandle)
Disables the serial peripheral interface (SPI) transmit FIFO interrupt.
Denotes a character length of 13 bits.
Denotes the fifo contains 3 words.
void SPI_disableRxFifoInt(SPI_Handle spiHandle)
Disables the serial peripheral interface (SPI) receive FIFO interrupt.
SPI_TriWire_e
Enumeration to define the tri-wire status.
Denotes that the SPICLK signal is delayed by one half-cycle.
void SPI_clearRxFifoOvf(SPI_Handle spiHandle)
Clears the Rx FIFO overflow flag.
SPI_CharLength_e
Enumeration to define the serial peripheral interface (SPI) character lengths.
Denotes the fifo contains 1 word.
void SPI_enableInt(SPI_Handle spiHandle)
Enables the serial peripheral interface (SPI) interrupt.
volatile uint16_t SPITXBUF
SPI Serial Output Buffer Register.
Denotes the fifo contains 2 words.
SPI_FifoStatus_e SPI_getRxFifoStatus(SPI_Handle spiHandle)
Gets the serial peripheral interface (SPI) receive FIFO status.
volatile uint16_t SPICTL
SPI Operation Control Register.
volatile uint16_t rsvd_3[2]
Reserved.
void SPI_setClkPolarity(SPI_Handle spiHandle, const SPI_ClkPolarity_e polarity)
Sets the serial peripheral interface (SPI) clock polarity.
volatile uint16_t SPIDAT
SPI Serial Data Register.
SPI_FifoStatus_e SPI_getTxFifoStatus(SPI_Handle spiHandle)
Gets the serial peripheral interface (SPI) transmit FIFO status.
volatile uint16_t SPIRXBUF
SPI Serial Input Buffer Register.
SPI_Mode_e
Enumeration to define the serial peripheral interface (SPI) network mode control. ...
void SPI_disableLoopBack(SPI_Handle spiHandle)
Disables the serial peripheral interface (SPI) loop back mode.
Denotes active low STE pin.
Stops immediately after EMU halt.
Denotes a character length of 6 bits.
Denotes a character length of 14 bits.
void SPI_enableTxFifo(SPI_Handle spiHandle)
Re-enables the serial peripheral interface (SPI) transmit FIFO.
void SPI_enableLoopBack(SPI_Handle spiHandle)
Enables the serial peripheral interface (SPI) loop back mode.
Denotes a character length of 1 bit.
Doesn't stop after EMU halt.
volatile uint16_t SPIST
SPI Status Register.
Denotes a character length of 10 bits.
void SPI_setSuspend(SPI_Handle spiHandle, const SPI_EmulationSuspend_e emuSuspend)
Sets the serial peripheral interface (SPI) emulation suspend bits.
Denotes the fifo contains 4 words.
Denotes a character length of 15 bits.
Denotes that the tx data is output on the falling edge, the rx data is latched on the rising edge...
void SPI_enableTxFifoInt(SPI_Handle spiHandle)
Enables the serial peripheral interface (SPI) transmit FIFO interrupt.
Denotes a character length of 7 bits.
struct _SPI_Obj_ SPI_Obj
Defines the serial peripheral interface (SPI) object.
SPI_EmulationSuspend_e
Enumeration to define the serial peripheral interface (SPI) Enumeration suspend bits.
void SPI_setTriWire(SPI_Handle spiHandle, const SPI_TriWire_e triwire)
Sets SPI port operating mode.
void SPI_disableOverRunInt(SPI_Handle spiHandle)
Disables the serial peripheral interface (SPI) over-run interrupt.
Stops after EMU halt and next rx/rx sequence.
Denotes a character length of 9 bits.
void SPI_setRxFifoIntLevel(SPI_Handle spiHandle, const SPI_FifoLevel_e fifoLevel)
Sets the serial peripheral interface (SPI) receive FIFO level for generating an interrupt.
volatile uint16_t SPIEMU
SPI Emulation Buffer Register.
void SPI_resetTxFifo(SPI_Handle spiHandle)
Resets the serial peripheral interface (SPI) transmit FIFO.
SPI_Handle SPI_init(void *pMemory, const size_t numBytes)
Initializes the serial peripheral interface (SPI) object handle.
Denotes that the Tx buffer is empty.
Emulation Suspend option 1.
void SPI_reset(SPI_Handle spiHandle)
Resets the serial peripheral interface (SPI)
Denotes the fifo contains 1 word.
Denotes a character length of 8 bits.
Denotes that the tx data is output on the rising edge, the rx data is latched on the falling edge...
static uint16_t SPI_readEmu(SPI_Handle spiHandle)
Reads data from the serial peripheral interface (SPI) during emulation.
void SPI_disableTxFifoEnh(SPI_Handle spiHandle)
Disables the serial peripheral interface (SPI) transmit FIFO enhancements.
SPI_IntFlagStatus_e
Enumeration to define the serial peripheral interface (SPI) Interrupt Flag Status.
struct _SPI_Obj_ * SPI_Handle
Defines the serial peripheral interface (SPI) handle.
Contains public interface to various functions related to the central processing unit (CPU) object...
void SPI_enable(SPI_Handle spiHandle)
Enables the serial peripheral interface (SPI)
SPI_FifoLevel_e
Enumeration to define the serial peripheral interface (SPI) FIFO level.
volatile uint16_t SPIFFRX
SPI FIFO Receive Register.
Denotes the fifo contains 2 words.
void SPI_enableRxFifo(SPI_Handle spiHandle)
Enables the serial peripheral interface (SPI) receive FIFO.
Denotes a character length of 5 bits.
volatile uint16_t rsvd_1
Reserved.
Denotes a character length of 11 bits.
volatile uint16_t SPICCR
SPI Configuration Control Register.
volatile uint16_t rsvd_2
Reserved.
static void SPI_write(SPI_Handle spiHandle, const uint16_t data)
Writes data to the serial peripheral interface (SPI)
void SPI_setTxDelay(SPI_Handle spiHandle, const uint_least8_t delay)
Sets the serial peripheral interface (SPI) transmit delay.
SPI_SteInv_e
Enumeration to define the the serial peripheral interface (SPI) STE pin status.
void SPI_clearRxFifoInt(SPI_Handle spiHandle)
Clears the Rx FIFO interrupt flag.
void SPI_enableOverRunInt(SPI_Handle spiHandle)
Enables the serial peripheral interface (SPI) over-run interrupt.
void SPI_disableTx(SPI_Handle spiHandle)
Disables the serial peripheral interface (SPI) master/slave transmit mode.
SPI_ClkPolarity_e
Enumeration to define the serial peripheral interface (SPI) clock polarity for the input and output d...
void SPI_enableTx(SPI_Handle spiHandle)
Enables the serial peripheral interface (SPI) masater/slave transmit mode.
Denotes that the Tx buffer is full.
void SPI_setSteInv(SPI_Handle spiHandle, const SPI_SteInv_e steinv)
Controls pin inversion of STE pin.
SPI_FifoStatus_e
Enumeration to define the serial peripheral interface (SPI) FIFO status.
volatile uint16_t SPIBRR
SPI Baud Rate Register.
Denotes a normal clock scheme.
SPI_BaudRate_e
Enumeration to define the serial peripheral interface (SPI) baud rates.
Denotes a character length of 3 bits.
SPI_ClkPhase_e
Enumeration to define the serial peripheral interface (SPI) clock phase.
volatile uint16_t SPIPRI
SPI Priority Register.
void SPI_setClkPhase(SPI_Handle spiHandle, const SPI_ClkPhase_e clkPhase)
Sets the serial peripheral interface (SPI) clock phase.
SPI_Priority_e
Enumeration to define the the serial peripheral interface (SPI) priority.
Denotes the fifo contains 3 words.
Denotes active high STE pin.
volatile uint16_t SPIFFCT
SPI FIFO Control Register.
void SPI_resetRxFifo(SPI_Handle spiHandle)
Resets the serial peripheral interface (SPI) receive FIFO.
Denotes the fifo is empty.
static void SPI_write8(SPI_Handle spiHandle, const uint16_t data)
Writes a byte of data to the serial peripheral interface (SPI)
void SPI_setCharLength(SPI_Handle spiHandle, const SPI_CharLength_e length)
Sets the serial peripheral interface (SPI) character length.
Denotes a character length of 4 bits.
void SPI_setMode(SPI_Handle spiHandle, const SPI_Mode_e mode)
Sets the serial peripheral interface (SPI) network mode.
volatile uint16_t SPIFFTX
SPI FIFO Transmit Register.
Denotes a character length of 12 bits.
Denotes a character length of 2 bits.
SPI_TxBufferStatus_e SPI_getTxBufferStatus(SPI_Handle spiHandle)
Gets the serial peripheral interface (SPI) Tx Buffer status.
void SPI_setPriority(SPI_Handle spiHandle, const SPI_Priority_e priority)
Sets the priority of the SPI port vis-a-vis the EMU.
Denotes the fifo is empty.
SPI_IntFlagStatus_e SPI_getIntFlagStatus(SPI_Handle spiHandle)
Gets the serial peripheral interface (SPI) Interrupt Flag status.
void SPI_setTxFifoIntLevel(SPI_Handle spiHandle, const SPI_FifoLevel_e fifoLevel)
Sets the serial peripheral interface (SPI) transmit FIFO level for generating an interrupt.