PAN1080 Peripheral API
Data Structures | Macros | Typedefs | Enumerations | Functions
pan_spi.h File Reference

Panchip series spi driver header file. More...

Go to the source code of this file.

Data Structures

struct  SPI_InitTypeDef
 SPI Init Structure definition. More...
 

Macros

#define SPI_BAUD_RATE_DIV(x)   ((x)?(x):(256))
 

Typedefs

typedef enum SPI_Irq SPI_IrqDef
 
typedef enum SPI_Role SPI_RoleDef
 
typedef enum SPI_DataFrameSize SPI_DataFrameSizeDef
 
typedef enum SPI_BaudRateDiv SPI_BaudRateDivDef
 
typedef enum SPI_ClockPol SPI_ClockPolDef
 
typedef enum SPI_ClockPhase SPI_ClockPhaseDef
 
typedef enum SPI_FrameFormat SPI_FrameFormatDef
 

Enumerations

enum  SPI_Irq {
  SPI_IRQ_TX_HALF_EMPTY = 0x08 , SPI_IRQ_RX_HALF_FULL = 0x04 , SPI_IRQ_RX_TIMEOUT = 0x02 , SPI_IRQ_RX_OVERRUN = 0x01 ,
  SPI_IRQ_ALL = 0x0f
}
 
enum  SPI_Role { SPI_RoleMaster = 0x0 , SPI_RoleSlave = 0x1 }
 
enum  SPI_DataFrameSize {
  SPI_DataFrame_4b = 0x03 , SPI_DataFrame_5b = 0x04 , SPI_DataFrame_6b = 0x05 , SPI_DataFrame_7b = 0x06 ,
  SPI_DataFrame_8b = 0x07 , SPI_DataFrame_9b = 0x08 , SPI_DataFrame_10b = 0x09 , SPI_DataFrame_11b = 0x0a ,
  SPI_DataFrame_12b = 0x0b , SPI_DataFrame_13b = 0x0c , SPI_DataFrame_14b = 0x0d , SPI_DataFrame_15b = 0x0e ,
  SPI_DataFrame_16b = 0x0f
}
 
enum  SPI_BaudRateDiv {
  SPI_BaudRateDiv_2 = 0x02 , SPI_BaudRateDiv_4 = 0x04 , SPI_BaudRateDiv_6 = 0x06 , SPI_BaudRateDiv_8 = 0x08 ,
  SPI_BaudRateDiv_16 = 0x10 , SPI_BaudRateDiv_32 = 0x20 , SPI_BaudRateDiv_48 = 0x30 , SPI_BaudRateDiv_64 = 0x40 ,
  SPI_BaudRateDiv_96 = 0x60 , SPI_BaudRateDiv_128 = 0x80 , SPI_BaudRateDiv_160 = 0xA0 , SPI_BaudRateDiv_192 = 0xC0 ,
  SPI_BaudRateDiv_224 = 0xE0 , SPI_BaudRateDiv_240 = 0xF0 , SPI_BaudRateDiv_250 = 0xFA
}
 
enum  SPI_ClockPol { SPI_ClockPolarityLow = 0x0 , SPI_ClockPolarityHigh = 0x1 }
 
enum  SPI_ClockPhase { SPI_ClockPhaseFirstEdge = 0x0 , SPI_ClockPhaseSecondEdge = 0x1 }
 
enum  SPI_FrameFormat { SPI_FormatMotorola = 0x00 , SPI_FormatTi = 0x01 , SPI_FormatMicrowire = 0x02 }
 

Functions

__STATIC_INLINE void SPI_EnableSpi (SPI_T *SPIx)
 Synchronous serial port enable. More...
 
__STATIC_INLINE void SPI_DisableSpi (SPI_T *SPIx)
 Synchronous serial port disable. More...
 
__STATIC_INLINE bool SPI_IsSpiEnabled (SPI_T *SPIx)
 get synchronous serial port status More...
 
__STATIC_INLINE void SPI_EnableDmaTx (SPI_T *SPIx)
 DMA for the transmit FIFO is enabled. More...
 
__STATIC_INLINE void SPI_DisableDmaTx (SPI_T *SPIx)
 DMA for the transmit FIFO is disabled. More...
 
__STATIC_INLINE bool SPI_IsDmaTxEnabled (SPI_T *SPIx)
 get DMA for the transmit FIFO status More...
 
__STATIC_INLINE void SPI_EnableDmaRx (SPI_T *SPIx)
 DMA for the receive FIFO is enabled. More...
 
__STATIC_INLINE void SPI_DisableDmaRx (SPI_T *SPIx)
 DMA for the receive FIFO is disabled. More...
 
__STATIC_INLINE bool SPI_IsDmaRxEnabled (SPI_T *SPIx)
 get DMA for the receive FIFO status More...
 
__STATIC_INLINE void SPI_SendData (SPI_T *SPIx, uint32_t Data)
 Send data,DR is the data register and is 16-bits wide. More...
 
__STATIC_INLINE uint32_t SPI_ReceiveData (SPI_T *SPIx)
 Receive data,DR is the data register and is 16-bits wide. More...
 
__STATIC_INLINE void SPI_EnableIrq (SPI_T *SPIx, SPI_IrqDef irq)
 Interruput mask Enable. More...
 
__STATIC_INLINE void SPI_DisableIrq (SPI_T *SPIx, SPI_IrqDef irq)
 Interruput mask Disable. More...
 
__STATIC_INLINE bool SPI_IsIrqEnabled (SPI_T *SPIx, SPI_IrqDef irq)
 Get Interruput mask status. More...
 
__STATIC_INLINE SPI_IrqDef SPI_GetMskedActiveIrq (SPI_T *SPIx)
 Get Masked Interruput status. More...
 
__STATIC_INLINE bool SPI_IsIrqActive (SPI_T *SPIx, SPI_IrqDef irq)
 Get Masked Interruput status. More...
 
__STATIC_INLINE bool SPI_IsRawIrqActive (SPI_T *SPIx, SPI_IrqDef irq)
 Get raw Interruput status. More...
 
__STATIC_INLINE void SPI_ClearIrq (SPI_T *SPIx, SPI_IrqDef irq)
 clear Interruput status More...
 
__STATIC_INLINE SPI_IrqDef SPI_GetRawActiveIrq (SPI_T *SPIx)
 Get Raw Interruput status. More...
 
__STATIC_INLINE bool SPI_IsTxFifoEmpty (SPI_T *SPIx)
 Get Tx FIFO empty status. More...
 
__STATIC_INLINE bool SPI_IsTxFifoFull (SPI_T *SPIx)
 Get Tx FIFO full status. More...
 
__STATIC_INLINE bool SPI_IsRxFifoEmpty (SPI_T *SPIx)
 Get Tx FIFO empty status. More...
 
__STATIC_INLINE bool SPI_IsRxFifoFull (SPI_T *SPIx)
 Get Tx FIFO full status. More...
 
__STATIC_INLINE bool SPI_IsBusy (SPI_T *SPIx)
 Get Synchronous serial port busy status. More...
 
__STATIC_INLINE void SPI_TxLsbEnable (SPI_T *SPIx, bool enable)
 Tx Lsb Send function control. More...
 
__STATIC_INLINE void SPI_RxLsbEnable (SPI_T *SPIx, bool enable)
 Rx Lsb Send function control. More...
 
void SPI_Init (SPI_T *SPIx, SPI_InitTypeDef *SPI_InitStruct)
 Initializes the SPIx peripheral according to the specified parameters in the SPI_InitStruct . More...
 

Detailed Description

Panchip series spi driver header file.

Version
V1.00
Revision
3
Date
21/11/12 18:33

Function Documentation

◆ SPI_ClearIrq()

__STATIC_INLINE void SPI_ClearIrq ( SPI_T *  SPIx,
SPI_IrqDef  irq 
)

clear Interruput status

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
irqcan be SPI_IRQ_RX_TIMEOUT SPI_IRQ_RX_OVERRUN
Returns
None

◆ SPI_DisableDmaRx()

__STATIC_INLINE void SPI_DisableDmaRx ( SPI_T *  SPIx)

DMA for the receive FIFO is disabled.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
None

◆ SPI_DisableDmaTx()

__STATIC_INLINE void SPI_DisableDmaTx ( SPI_T *  SPIx)

DMA for the transmit FIFO is disabled.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
None

◆ SPI_DisableIrq()

__STATIC_INLINE void SPI_DisableIrq ( SPI_T *  SPIx,
SPI_IrqDef  irq 
)

Interruput mask Disable.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
irqwhere x can be SPI_IRQ_TX_HALF_EMPTY SPI_IRQ_RX_HALF_FULL SPI_IRQ_RX_TIMEOUT SPI_IRQ_RX_OVERRUN SPI_IRQ_ALL
Returns
None

◆ SPI_DisableSpi()

__STATIC_INLINE void SPI_DisableSpi ( SPI_T *  SPIx)

Synchronous serial port disable.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
None

◆ SPI_EnableDmaRx()

__STATIC_INLINE void SPI_EnableDmaRx ( SPI_T *  SPIx)

DMA for the receive FIFO is enabled.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
None

◆ SPI_EnableDmaTx()

__STATIC_INLINE void SPI_EnableDmaTx ( SPI_T *  SPIx)

DMA for the transmit FIFO is enabled.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
None

◆ SPI_EnableIrq()

__STATIC_INLINE void SPI_EnableIrq ( SPI_T *  SPIx,
SPI_IrqDef  irq 
)

Interruput mask Enable.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
irqwhere x can be SPI_IRQ_TX_HALF_EMPTY SPI_IRQ_RX_HALF_FULL SPI_IRQ_RX_TIMEOUT SPI_IRQ_RX_OVERRUN SPI_IRQ_ALL
Returns
None

◆ SPI_EnableSpi()

__STATIC_INLINE void SPI_EnableSpi ( SPI_T *  SPIx)

Synchronous serial port enable.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
None

◆ SPI_GetMskedActiveIrq()

__STATIC_INLINE SPI_IrqDef SPI_GetMskedActiveIrq ( SPI_T *  SPIx)

Get Masked Interruput status.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
SPI_IrqDef: where return value can be SPI_IRQ_TX_HALF_EMPTY SPI_IRQ_RX_HALF_FULL SPI_IRQ_RX_TIMEOUT SPI_IRQ_RX_OVERRUN SPI_IRQ_ALL

◆ SPI_GetRawActiveIrq()

__STATIC_INLINE SPI_IrqDef SPI_GetRawActiveIrq ( SPI_T *  SPIx)

Get Raw Interruput status.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
SPI_IrqDef: where return value can be SPI_IRQ_TX_HALF_EMPTY SPI_IRQ_RX_HALF_FULL SPI_IRQ_RX_TIMEOUT SPI_IRQ_RX_OVERRUN SPI_IRQ_ALL

◆ SPI_Init()

void SPI_Init ( SPI_T *  SPIx,
SPI_InitTypeDef SPI_InitStruct 
)

Initializes the SPIx peripheral according to the specified parameters in the SPI_InitStruct .

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
SPI_InitStructpointer to a SPI_InitTypeDef structure that contains the configuration information for the specified SPI peripheral.
Returns
None

◆ SPI_IsBusy()

__STATIC_INLINE bool SPI_IsBusy ( SPI_T *  SPIx)

Get Synchronous serial port busy status.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
true/false

◆ SPI_IsDmaRxEnabled()

__STATIC_INLINE bool SPI_IsDmaRxEnabled ( SPI_T *  SPIx)

get DMA for the receive FIFO status

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
true/false

◆ SPI_IsDmaTxEnabled()

__STATIC_INLINE bool SPI_IsDmaTxEnabled ( SPI_T *  SPIx)

get DMA for the transmit FIFO status

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
true/false

◆ SPI_IsIrqActive()

__STATIC_INLINE bool SPI_IsIrqActive ( SPI_T *  SPIx,
SPI_IrqDef  irq 
)

Get Masked Interruput status.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
irqwhere x can be SPI_IRQ_TX_HALF_EMPTY SPI_IRQ_RX_HALF_FULL SPI_IRQ_RX_TIMEOUT SPI_IRQ_RX_OVERRUN SPI_IRQ_ALL
Returns
true/false

◆ SPI_IsIrqEnabled()

__STATIC_INLINE bool SPI_IsIrqEnabled ( SPI_T *  SPIx,
SPI_IrqDef  irq 
)

Get Interruput mask status.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
irqwhere x can be SPI_IRQ_TX_HALF_EMPTY SPI_IRQ_RX_HALF_FULL SPI_IRQ_RX_TIMEOUT SPI_IRQ_RX_OVERRUN SPI_IRQ_ALL
Returns
None

◆ SPI_IsRawIrqActive()

__STATIC_INLINE bool SPI_IsRawIrqActive ( SPI_T *  SPIx,
SPI_IrqDef  irq 
)

Get raw Interruput status.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
irqwhere x can be SPI_IRQ_TX_HALF_EMPTY SPI_IRQ_RX_HALF_FULL SPI_IRQ_RX_TIMEOUT SPI_IRQ_RX_OVERRUN SPI_IRQ_ALL
Returns
true/false

◆ SPI_IsRxFifoEmpty()

__STATIC_INLINE bool SPI_IsRxFifoEmpty ( SPI_T *  SPIx)

Get Tx FIFO empty status.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
true/false

◆ SPI_IsRxFifoFull()

__STATIC_INLINE bool SPI_IsRxFifoFull ( SPI_T *  SPIx)

Get Tx FIFO full status.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
true/false

◆ SPI_IsSpiEnabled()

__STATIC_INLINE bool SPI_IsSpiEnabled ( SPI_T *  SPIx)

get synchronous serial port status

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
true/false

◆ SPI_IsTxFifoEmpty()

__STATIC_INLINE bool SPI_IsTxFifoEmpty ( SPI_T *  SPIx)

Get Tx FIFO empty status.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
true/false

◆ SPI_IsTxFifoFull()

__STATIC_INLINE bool SPI_IsTxFifoFull ( SPI_T *  SPIx)

Get Tx FIFO full status.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
true/false

◆ SPI_ReceiveData()

__STATIC_INLINE uint32_t SPI_ReceiveData ( SPI_T *  SPIx)

Receive data,DR is the data register and is 16-bits wide.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
None

◆ SPI_RxLsbEnable()

__STATIC_INLINE void SPI_RxLsbEnable ( SPI_T *  SPIx,
bool  enable 
)

Rx Lsb Send function control.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Return values
none

◆ SPI_SendData()

__STATIC_INLINE void SPI_SendData ( SPI_T *  SPIx,
uint32_t  Data 
)

Send data,DR is the data register and is 16-bits wide.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Returns
None

◆ SPI_TxLsbEnable()

__STATIC_INLINE void SPI_TxLsbEnable ( SPI_T *  SPIx,
bool  enable 
)

Tx Lsb Send function control.

Parameters
SPIxwhere x can be 1, 2 to select the SPI peripheral.
Return values
none