|
void | SSIConfigSetExpClk (uint32_t ui32Base, uint32_t ui32SSIClk, uint32_t ui32Protocol, uint32_t ui32Mode, uint32_t ui32BitRate, uint32_t ui32DataWidth) |
| Configures the synchronous serial port. More...
|
|
static void | SSIEnable (uint32_t ui32Base) |
| Enables the synchronous serial port. More...
|
|
static void | SSIDisable (uint32_t ui32Base) |
| Disables the synchronous serial port. More...
|
|
void | SSIDataPut (uint32_t ui32Base, uint32_t ui32Data) |
| Puts a data element into the SSI transmit FIFO. More...
|
|
int32_t | SSIDataPutNonBlocking (uint32_t ui32Base, uint32_t ui32Data) |
| Puts a data element into the SSI transmit FIFO. More...
|
|
void | SSIDataGet (uint32_t ui32Base, uint32_t *pui32Data) |
| Gets a data element from the SSI receive FIFO. More...
|
|
int32_t | SSIDataGetNonBlocking (uint32_t ui32Base, uint32_t *pui32Data) |
| Gets a data element from the SSI receive FIFO. More...
|
|
static bool | SSIBusy (uint32_t ui32Base) |
| Determines whether the SSI transmitter is busy or not. More...
|
|
static uint32_t | SSIStatus (uint32_t ui32Base) |
| Get the status of the SSI data buffers. More...
|
|
void | SSIIntRegister (uint32_t ui32Base, void(*pfnHandler)(void)) |
| Registers an interrupt handler for the Synchronous Serial Interface in the dynamic interrupt table. More...
|
|
void | SSIIntUnregister (uint32_t ui32Base) |
| Unregisters an interrupt handler for the Synchronous Serial Interface in the dynamic interrupt table. More...
|
|
static void | SSIIntEnable (uint32_t ui32Base, uint32_t ui32IntFlags) |
| Enables individual SSI interrupt sources. More...
|
|
static void | SSIIntDisable (uint32_t ui32Base, uint32_t ui32IntFlags) |
| Disables individual SSI interrupt sources. More...
|
|
static void | SSIIntClear (uint32_t ui32Base, uint32_t ui32IntFlags) |
| Clears SSI interrupt sources. More...
|
|
static uint32_t | SSIIntStatus (uint32_t ui32Base, bool bMasked) |
| Gets the current interrupt status. More...
|
|
static void | SSIDMAEnable (uint32_t ui32Base, uint32_t ui32DMAFlags) |
| Enable SSI DMA operation. More...
|
|
static void | SSIDMADisable (uint32_t ui32Base, uint32_t ui32DMAFlags) |
| Disable SSI DMA operation. More...
|
|
void SSIConfigSetExpClk |
( |
uint32_t |
ui32Base, |
|
|
uint32_t |
ui32SSIClk, |
|
|
uint32_t |
ui32Protocol, |
|
|
uint32_t |
ui32Mode, |
|
|
uint32_t |
ui32BitRate, |
|
|
uint32_t |
ui32DataWidth |
|
) |
| |
Configures the synchronous serial port.
This function configures the synchronous serial port. It sets the SSI protocol, mode of operation, bit rate, and data width.
The ui32Protocol
parameter defines the data frame format. The Motorola frame formats imply the following polarity and phase configurations:
Polarity Phase Mode
0 0 SSI_FRF_MOTO_MODE_0
0 1 SSI_FRF_MOTO_MODE_1
1 0 SSI_FRF_MOTO_MODE_2
1 1 SSI_FRF_MOTO_MODE_3
The ui32Mode
parameter defines the operating mode of the SSI module. The SSI module can operate as a master or slave; if a slave, the SSI can be configured to disable output on its serial output line.
The ui32BitRate
parameter defines the bit rate for the SSI. This bit rate must satisfy the following clock ratio criteria:
- Master mode : FSSI >= 2 * bit rate
- Slave mode : FSSI >= 12 * bit rate
where FSSI is the frequency of the clock supplied to the SSI module.
The ui32DataWidth
parameter defines the width of the data transfers, and can be a value between 4 and 16, inclusive.
- Note
- The peripheral clock is not necessarily the same as the processor clock. The frequency of the peripheral clock is set by the system control.
- Parameters
-
ui32Base | specifies the SSI module base address. |
ui32SSIClk | is the rate of the clock supplied to the SSI module. |
ui32Protocol | specifies the data transfer protocol. The parameter can be one of the following values:
|
ui32Mode | specifies the mode of operation. The parameter can be one of the following values:
|
ui32BitRate | specifies the clock rate. |
ui32DataWidth | specifies number of bits transferred per frame. Must be a value between 4 and 16, both included. |
- Returns
- None
72 uint32_t ui32MaxBitRate;
79 ASSERT(SSIBaseValid(ui32Base));
91 ASSERT((ui32SSIClk / ui32BitRate) <= (254 * 256));
92 ASSERT((ui32DataWidth >= 4) && (ui32DataWidth <= 16));
97 HWREG(ui32Base + SSI_O_CR1) = ui32RegVal;
100 ui32MaxBitRate = ui32SSIClk / ui32BitRate;
105 ui32SCR = (ui32MaxBitRate / ui32PreDiv) - 1;
107 while(ui32SCR > 255);
108 HWREG(ui32Base + SSI_O_CPSR) = ui32PreDiv;
111 ui32SPH_SPO = (ui32Protocol & 3) << 6;
112 ui32Protocol &= SSI_CR0_FRF_M;
113 ui32RegVal = (ui32SCR << 8) | ui32SPH_SPO | ui32Protocol | (ui32DataWidth - 1);
114 HWREG(ui32Base + SSI_O_CR0) = ui32RegVal;
#define SSI_MODE_SLAVE_OD
Definition: ssi.h:128
#define SSI_FRF_MOTO_MODE_0
Definition: ssi.h:119
#define SSI_FRF_MOTO_MODE_2
Definition: ssi.h:121
#define SSI_FRF_TI
Definition: ssi.h:123
#define ASSERT(expr)
Definition: debug.h:71
#define SSI_MODE_SLAVE
Definition: ssi.h:127
#define SSI_FRF_NMW
Definition: ssi.h:124
#define SSI_FRF_MOTO_MODE_3
Definition: ssi.h:122
#define SSI_FRF_MOTO_MODE_1
Definition: ssi.h:120
#define SSI_MODE_MASTER
Definition: ssi.h:126
void SSIIntRegister |
( |
uint32_t |
ui32Base, |
|
|
void(*)(void) |
pfnHandler |
|
) |
| |
Registers an interrupt handler for the Synchronous Serial Interface in the dynamic interrupt table.
- Note
- Only use this function if you want to use the dynamic vector table (in SRAM)!
This function registers a function as the interrupt handler for a specific interrupt and enables the corresponding interrupt in the interrupt controller.
Specific SSI interrupts must be enabled via SSIIntEnable(). If necessary, it is the interrupt handler's responsibility to clear the interrupt source via SSIIntClear().
- Parameters
-
ui32Base | specifies the SSI module base address. |
pfnHandler | is a pointer to the function to be called when the synchronous serial port interrupt occurs. |
- Returns
- None
- See also
- IntRegister() for important information about registering interrupt handlers.
Referenced by SSIStatus().
218 ASSERT(SSIBaseValid(ui32Base));
221 ui32Int = (ui32Base == SSI0_BASE) ? INT_SSI0_COMB : INT_SSI1_COMB;
#define ASSERT(expr)
Definition: debug.h:71
void IntRegister(uint32_t ui32Interrupt, void(*pfnHandler)(void))
Registers a function as an interrupt handler in the dynamic vector table.
Definition: interrupt.c:151
void IntEnable(uint32_t ui32Interrupt)
Enables an interrupt or system exception.
Definition: interrupt.c:281