Kamcho Library 02.00.03  lib.kamcho.02.00.03.287
Data Structures | Macros | Functions
spi_sfrs.h File Reference

Go to the source code of this file.

Data Structures

struct  SPI_SFRS_t
 A structure to represent Special Function Registers for SPI. More...
 

Macros

#define SPI_SFRS   ((__IO SPI_SFRS_t *) (SDIO_BASE + 0x1C))
 The starting address of SPI SFRS. More...
 
#define E_SPI_CLOCK_DIV2   0
 
#define E_SPI_CLOCK_DIV4   1
 
#define E_SPI_CLOCK_DIV8   0
 
#define E_SPI_CLOCK_DIV16   2
 
#define E_SPI_CLOCK_DIV32   3
 
#define E_SPI_CLOCK_DIV64   1
 
#define E_SPI_CLOCK_DIV128   2
 
#define E_SPI_CLOCK_DIV256   3
 
#define E_SPI_CLOCK_DIV512   0
 
#define E_SPI_CLOCK_DIV1024   1
 
#define E_SPI_CLOCK_DIV2048   2
 
#define E_SPI_CLOCK_DIV4096   3
 
#define E_SPI_CLOCK_EXT_DIV2   0
 
#define E_SPI_CLOCK_EXT_DIV4   0
 
#define E_SPI_CLOCK_EXT_DIV8   1
 
#define E_SPI_CLOCK_EXT_DIV16   0
 
#define E_SPI_CLOCK_EXT_DIV32   0
 
#define E_SPI_CLOCK_EXT_DIV64   1
 
#define E_SPI_CLOCK_EXT_DIV128   1
 
#define E_SPI_CLOCK_EXT_DIV256   1
 
#define E_SPI_CLOCK_EXT_DIV512   2
 
#define E_SPI_CLOCK_EXT_DIV1024   2
 
#define E_SPI_CLOCK_EXT_DIV2048   2
 
#define E_SPI_CLOCK_EXT_DIV4096   2
 
#define E_SPI_CLOCK_PHASE0   0
 
#define E_SPI_CLOCK_PHASE1   1
 
#define E_SPI_CLOCK_POLARITY0   0
 
#define E_SPI_CLOCK_POLARITY1   1
 
#define E_SPI_STATUS_INTERRUPT   ()uint8_t) (1<<7))
 
#define E_SPI_STATUS_WRITE_COLLISIION   ((uint8_t) (1<<6))
 
#define E_SPI_STATUS_TX_FIFO_FULL   ((uint8_t) (1<<3))
 
#define E_SPI_STATUS_TX_FIFO_EMPTY   ((uint8_t) (1<<2))
 
#define E_SPI_STATUS_RX_FIFO_FULL   ((uint8_t) (1<<1))
 
#define E_SPI_STATUS_RX_FIFO_EMPTY   ((uint8_t) (1<<0))
 
#define E_SPI_INT_DELAY_COUNT0   0
 
#define E_SPI_INT_DELAY_COUNT1   1
 
#define E_SPI_INT_DELAY_COUNT2   2
 
#define E_SPI_INT_DELAY_COUNT3   3
 

Functions

static __INLINE void f_SPI_ClockDiv (uint8_t div, uint8_t ext_div)
 Set SPI clock divider. More...
 
static __INLINE void f_SPI_SetPhase (uint8_t phase)
 Set SPI phase. More...
 
static __INLINE void f_SPI_SetPolarity (uint8_t Polarity)
 Set SPI Polarity. More...
 
static __INLINE void f_SPI_SetMode (uint8_t mode)
 Set SPI mode. More...
 
static __INLINE void f_SPI_IRQDelay (uint8_t cnt)
 Set SPI interrupt delay cycles. More...
 
static __INLINE void f_SPI_Enable (void)
 Enable SPI hardware module. More...
 
static __INLINE void f_SPI_Disable (void)
 Disable SPI hardware module. More...
 
static __INLINE void f_SPI_IRQEnable (void)
 Enable SPI interrupt. More...
 
static __INLINE void f_SPI_IRQDisable (void)
 Disable SPI interrupt. More...
 
static __INLINE uint8_t f_SPI_ReadData (void)
 Read a byte from SPI data register. More...
 
static __INLINE void f_SPI_WriteData (uint8_t data)
 Write a byte to SPI data register. More...
 
static __INLINE uint8_t f_SPI_GetStatus (void)
 Get SPI status. More...
 
static __INLINE void f_SPI_ClearIRQ (void)
 Clear SPI interrupt flag. More...
 
static __INLINE uint8_t f_SPI_TxFIFOFull (void)
 Check if transnmitter FIFO buffer full. More...
 
static __INLINE uint8_t f_SPI_TxFIFOEmpty (void)
 Check if transnmitter FIFO buffer empty. More...
 
static __INLINE uint8_t f_SPI_RxFIFOFull (void)
 Check if receiver FIFO buffer full. More...
 
static __INLINE uint8_t f_SPI_RxFIFOEmpty (void)
 Check if receiver FIFO buffer empty. More...
 

Detailed Description

This file is proprietary to Indie Semiconductor. All rights reserved. Reproduction or distribution, in whole or in part, is forbidden except by express written permission of Indie Semiconductor.

Macro Definition Documentation

#define E_SPI_CLOCK_DIV1024   1
#define E_SPI_CLOCK_DIV128   2
#define E_SPI_CLOCK_DIV16   2
#define E_SPI_CLOCK_DIV2   0
#define E_SPI_CLOCK_DIV2048   2
#define E_SPI_CLOCK_DIV256   3
#define E_SPI_CLOCK_DIV32   3
#define E_SPI_CLOCK_DIV4   1
#define E_SPI_CLOCK_DIV4096   3
#define E_SPI_CLOCK_DIV512   0
#define E_SPI_CLOCK_DIV64   1
#define E_SPI_CLOCK_DIV8   0
#define E_SPI_CLOCK_EXT_DIV1024   2
#define E_SPI_CLOCK_EXT_DIV128   1
#define E_SPI_CLOCK_EXT_DIV16   0
#define E_SPI_CLOCK_EXT_DIV2   0
#define E_SPI_CLOCK_EXT_DIV2048   2
#define E_SPI_CLOCK_EXT_DIV256   1
#define E_SPI_CLOCK_EXT_DIV32   0
#define E_SPI_CLOCK_EXT_DIV4   0
#define E_SPI_CLOCK_EXT_DIV4096   2
#define E_SPI_CLOCK_EXT_DIV512   2
#define E_SPI_CLOCK_EXT_DIV64   1
#define E_SPI_CLOCK_EXT_DIV8   1
#define E_SPI_CLOCK_PHASE0   0
#define E_SPI_CLOCK_PHASE1   1
#define E_SPI_CLOCK_POLARITY0   0
#define E_SPI_CLOCK_POLARITY1   1
#define E_SPI_INT_DELAY_COUNT0   0
#define E_SPI_INT_DELAY_COUNT1   1
#define E_SPI_INT_DELAY_COUNT2   2
#define E_SPI_INT_DELAY_COUNT3   3
#define E_SPI_STATUS_INTERRUPT   ()uint8_t) (1<<7))
#define E_SPI_STATUS_RX_FIFO_EMPTY   ((uint8_t) (1<<0))
#define E_SPI_STATUS_RX_FIFO_FULL   ((uint8_t) (1<<1))
#define E_SPI_STATUS_TX_FIFO_EMPTY   ((uint8_t) (1<<2))
#define E_SPI_STATUS_TX_FIFO_FULL   ((uint8_t) (1<<3))
#define E_SPI_STATUS_WRITE_COLLISIION   ((uint8_t) (1<<6))
#define SPI_SFRS   ((__IO SPI_SFRS_t *) (SDIO_BASE + 0x1C))

The starting address of SPI SFRS.

Function Documentation

static __INLINE void f_SPI_ClearIRQ ( void  )
static

Clear SPI interrupt flag.

static __INLINE void f_SPI_ClockDiv ( uint8_t  div,
uint8_t  ext_div 
)
static

Set SPI clock divider.

Parameters
divThe setting for standard divider bits
ext_divThe setting for extended divider bits
static __INLINE void f_SPI_Disable ( void  )
static

Disable SPI hardware module.

static __INLINE void f_SPI_Enable ( void  )
static

Enable SPI hardware module.

static __INLINE uint8_t f_SPI_GetStatus ( void  )
static

Get SPI status.

static __INLINE void f_SPI_IRQDelay ( uint8_t  cnt)
static

Set SPI interrupt delay cycles.

static __INLINE void f_SPI_IRQDisable ( void  )
static

Disable SPI interrupt.

static __INLINE void f_SPI_IRQEnable ( void  )
static

Enable SPI interrupt.

static __INLINE uint8_t f_SPI_ReadData ( void  )
static

Read a byte from SPI data register.

static __INLINE uint8_t f_SPI_RxFIFOEmpty ( void  )
static

Check if receiver FIFO buffer empty.

Returns
The status bit for receiver FIFO buffer empty.
static __INLINE uint8_t f_SPI_RxFIFOFull ( void  )
static

Check if receiver FIFO buffer full.

Returns
The status bit for receiver FIFO buffer full.
static __INLINE void f_SPI_SetMode ( uint8_t  mode)
static

Set SPI mode.

static __INLINE void f_SPI_SetPhase ( uint8_t  phase)
static

Set SPI phase.

static __INLINE void f_SPI_SetPolarity ( uint8_t  Polarity)
static

Set SPI Polarity.

static __INLINE uint8_t f_SPI_TxFIFOEmpty ( void  )
static

Check if transnmitter FIFO buffer empty.

Returns
The status bit for transnmitter FIFO buffer empty.
static __INLINE uint8_t f_SPI_TxFIFOFull ( void  )
static

Check if transnmitter FIFO buffer full.

Returns
The status bit for transnmitter FIFO buffer full.
static __INLINE void f_SPI_WriteData ( uint8_t  data)
static

Write a byte to SPI data register.