|
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 port. More...
|
|
void | SSIIntUnregister (uint32_t ui32Base) |
| Unregisters an interrupt handler for the synchronous serial port. 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
74 uint32_t ui32MaxBitRate;
81 ASSERT(SSIBaseValid(ui32Base));
93 ASSERT((ui32SSIClk / ui32BitRate) <= (254 * 256));
94 ASSERT((ui32DataWidth >= 4) && (ui32DataWidth <= 16));
102 ui32MaxBitRate = ui32SSIClk / ui32BitRate;
107 ui32SCR = (ui32MaxBitRate / ui32PreDiv) - 1;
109 while(ui32SCR > 255);
113 ui32SPH_SPO = (ui32Protocol & 3) << 6;
115 ui32RegVal = (ui32SCR << 8) | ui32SPH_SPO | ui32Protocol | (ui32DataWidth - 1);
116 HWREG(ui32Base +
SSI_O_CR0) = ui32RegVal;
#define SSI_MODE_SLAVE_OD
Definition: ssi.h:130
#define SSI_FRF_MOTO_MODE_0
Definition: ssi.h:121
#define SSI_FRF_MOTO_MODE_2
Definition: ssi.h:123
#define SSI_FRF_TI
Definition: ssi.h:125
#define ASSERT(expr)
Definition: debug.h:74
#define SSI_MODE_SLAVE
Definition: ssi.h:129
#define SSI_FRF_NMW
Definition: ssi.h:126
#define SSI_FRF_MOTO_MODE_3
Definition: ssi.h:124
#define SSI_FRF_MOTO_MODE_1
Definition: ssi.h:122
#define SSI_MODE_MASTER
Definition: ssi.h:128
int32_t SSIDataGetNonBlocking |
( |
uint32_t |
ui32Base, |
|
|
uint32_t * |
pui32Data |
|
) |
| |
Gets a data element from the SSI receive FIFO.
This function gets received data from the receive FIFO of the specified SSI module and places that data into the location specified by the ui32Data
parameter. If there is no data in the FIFO, then this function returns a zero.
- Note
- Only the lower N bits of the value written to
pui32Data
contain valid data, where N is the data width as configured by SSIConfigSetExpClk(). For example, if the interface is configured for 8-bit data width, only the lower 8 bits of the value written to pui32Data
contain valid data.
- Parameters
-
ui32Base | specifies the SSI module base address. |
pui32Data | is a pointer to a storage location for data that was received over the SSI interface. |
- Returns
- Returns the number of elements read from the SSI receive FIFO.
Gets a data element from the SSI receive FIFO
- Parameters
-
ui32Base | specifies the SSI module base address. |
pui32Data | is a pointer to a storage location for data that was received over the SSI interface. |
This function gets received data from the receive FIFO of the specified SSI module and places that data into the location specified by the ui32Data parameter. If there is no data in the FIFO, then this function returns a zero.
- Note
- Only the lower N bits of the value written to pui32Data contain valid data, where N is the data width as configured by
- See also
- SSIConfigSetExpClk(). For example, if the interface is configured for 8-bit data width, only the lower 8 bits of the value written to pui32Data contain valid data.
- Returns
- Returns the number of elements read from the SSI receive FIFO.
213 ASSERT(SSIBaseValid(ui32Base));
218 *pui32Data = HWREG(ui32Base +
SSI_O_DR);
#define ASSERT(expr)
Definition: debug.h:74
void SSIIntRegister |
( |
uint32_t |
ui32Base, |
|
|
void(*)(void) |
pfnHandler |
|
) |
| |
Registers an interrupt handler for the synchronous serial port.
This sets the handler to be called when an SSI interrupt occurs. This will enable the global 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.
Registers an interrupt handler for the synchronous serial port
- 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. |
This sets the handler to be called when an SSI interrupt occurs. This will enable the global 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().
- See also
- IntRegister() for important information about registering interrupt handlers.
- Returns
- None
253 ASSERT(SSIBaseValid(ui32Base));
256 ui32Int = (ui32Base ==
SSI0_BASE) ? INT_SSI0_COMB : INT_SSI1_COMB;
#define ASSERT(expr)
Definition: debug.h:74
void IntRegister(uint32_t ui32Interrupt, void(*pfnHandler)(void))
Registers a function to be called when an interrupt occurs.
Definition: interrupt.c:152
void IntEnable(uint32_t ui32Interrupt)
Enables an interrupt.
Definition: interrupt.c:282
void SSIIntUnregister |
( |
uint32_t |
ui32Base | ) |
|
Unregisters an interrupt handler for the synchronous serial port.
This function will clear the handler to be called when a SSI interrupt occurs. This will also mask off the interrupt in the interrupt controller so that the interrupt handler no longer is called.
- Parameters
-
ui32Base | specifies the SSI module base address. |
- Returns
- None
- See also
- IntRegister() for important information about registering interrupt handlers.
Unregisters an interrupt handler for the synchronous serial port
- Parameters
-
ui32Base | specifies the SSI module base address. |
This function will clear the handler to be called when a SSI interrupt occurs. This will also mask off the interrupt in the interrupt controller so that the interrupt handler no longer is called.
- See also
- IntRegister() for important information about registering interrupt handlers.
- Returns
- None
287 ASSERT(SSIBaseValid(ui32Base));
290 ui32Int = (ui32Base ==
SSI0_BASE) ? INT_SSI0_COMB : INT_SSI1_COMB;
#define ASSERT(expr)
Definition: debug.h:74
void IntUnregister(uint32_t ui32Interrupt)
Unregisters the function to be called when an interrupt occurs.
Definition: interrupt.c:188
void IntDisable(uint32_t ui32Interrupt)
Disables an interrupt.
Definition: interrupt.c:326