CC3200 Peripheral Driver Library User's Guide
1.2.0
|
Functions | |
void | SPIEnable (unsigned long ulBase) |
void | SPIDisable (unsigned long ulBase) |
void | SPIDmaEnable (unsigned long ulBase, unsigned long ulFlags) |
void | SPIDmaDisable (unsigned long ulBase, unsigned long ulFlags) |
void | SPIReset (unsigned long ulBase) |
void | SPIConfigSetExpClk (unsigned long ulBase, unsigned long ulSPIClk, unsigned long ulBitRate, unsigned long ulMode, unsigned long ulSubMode, unsigned long ulConfig) |
long | SPIDataGetNonBlocking (unsigned long ulBase, unsigned long *pulData) |
void | SPIDataGet (unsigned long ulBase, unsigned long *pulData) |
long | SPIDataPutNonBlocking (unsigned long ulBase, unsigned long ulData) |
void | SPIDataPut (unsigned long ulBase, unsigned long ulData) |
void | SPIFIFOEnable (unsigned long ulBase, unsigned long ulFlags) |
void | SPIFIFODisable (unsigned long ulBase, unsigned long ulFlags) |
void | SPIFIFOLevelSet (unsigned long ulBase, unsigned long ulTxLevel, unsigned long ulRxLevel) |
void | SPIFIFOLevelGet (unsigned long ulBase, unsigned long *pulTxLevel, unsigned long *pulRxLevel) |
void | SPIWordCountSet (unsigned long ulBase, unsigned long ulWordCount) |
void | SPIIntRegister (unsigned long ulBase, void(*pfnHandler)(void)) |
void | SPIIntUnregister (unsigned long ulBase) |
void | SPIIntEnable (unsigned long ulBase, unsigned long ulIntFlags) |
void | SPIIntDisable (unsigned long ulBase, unsigned long ulIntFlags) |
unsigned long | SPIIntStatus (unsigned long ulBase, tBoolean bMasked) |
void | SPIIntClear (unsigned long ulBase, unsigned long ulIntFlags) |
void | SPICSEnable (unsigned long ulBase) |
void | SPICSDisable (unsigned long ulBase) |
long | SPITransfer (unsigned long ulBase, unsigned char *ucDout, unsigned char *ucDin, unsigned long ulCount, unsigned long ulFlags) |
void SPIConfigSetExpClk | ( | unsigned long | ulBase, |
unsigned long | ulSPIClk, | ||
unsigned long | ulBitRate, | ||
unsigned long | ulMode, | ||
unsigned long | ulSubMode, | ||
unsigned long | ulConfig | ||
) |
Sets the configuration of a SPI module
ulBase | is the base address of the SPI module |
ulSPIClk | is the rate of clock supplied to the SPI module. |
ulBitRate | is the desired bit rate.(master mode) |
ulMode | is the mode of operation. |
ulSubMode | is one of the valid sub-modes. |
ulConfig | is logical OR of configuration paramaters. |
This function configures SPI port for operation in specified sub-mode and required bit rated as specified by ulMode and ulBitRate parameters respectively.
The SPI module can operate in either master or slave mode. The parameter ulMode can be one of the following -SPI_MODE_MASTER -SPI_MODE_SLAVE
The SPI module supports 4 sub modes based on SPI clock polarity and phase.
Polarity Phase Sub-Mode 0 0 0 0 1 1 1 0 2 1 1 3
Required sub mode can be select by setting ulSubMode parameter to one of the following
The parameter ulConfig is logical OR of five values: the word length, active level for chip select, software or hardware controled chip select, 3 or 4 pin mode and turbo mode. mode.
SPI support 8, 16 and 32 bit word lengths defined by:-
Active state of Chip[ Selece can be defined by:-
SPI chip select can be configured to be controlled either by hardware or software:-
The module can work in 3 or 4 pin mode defined by:-
Turbo mode can be set on or turned off using:-
void SPICSDisable | ( | unsigned long | ulBase | ) |
Disables the chip select in software controlled mode
ulBase | is the base address of the SPI module. |
This function disables the Chip select in software controlled mode. The active state of CS will depend on the configuration done via sa SPIConfigSetExpClk().
void SPICSEnable | ( | unsigned long | ulBase | ) |
Enables the chip select in software controlled mode
ulBase | is the base address of the SPI module. |
This function enables the Chip select in software controlled mode. The active state of CS will depend on the configuration done via
void SPIDataGet | ( | unsigned long | ulBase, |
unsigned long * | pulData | ||
) |
Waits for the word to be received on the specified port.
ulBase | is the base address of the SPI module. |
pulData | is pointer to receive data variable. |
This function gets a SPI word from the receive FIFO for the specified port. If there is no word available, this function waits until a word is received before returning.
long SPIDataGetNonBlocking | ( | unsigned long | ulBase, |
unsigned long * | pulData | ||
) |
Receives a word from the specified port.
ulBase | is the base address of the SPI module. |
pulData | is pointer to receive data variable. |
This function gets a SPI word from the receive FIFO for the specified port.
void SPIDataPut | ( | unsigned long | ulBase, |
unsigned long | ulData | ||
) |
Waits until the word is transmitted on the specified port.
ulBase | is the base address of the SPI module |
ulData | is data to be transmitted. |
This function transmits a SPI word on the transmit FIFO for the specified port. This function waits until the space is available on transmit FIFO
long SPIDataPutNonBlocking | ( | unsigned long | ulBase, |
unsigned long | ulData | ||
) |
Transmits a word on the specified port.
ulBase | is the base address of the SPI module |
ulData | is data to be transmitted. |
This function transmits a SPI word on the transmit FIFO for the specified port.
void SPIDisable | ( | unsigned long | ulBase | ) |
Disables the transmitting and receiving.
ulBase | is the base address of the SPI module |
This function disables the SPI channel for transmitting and receiving.
void SPIDmaDisable | ( | unsigned long | ulBase, |
unsigned long | ulFlags | ||
) |
Disables the SPI DMA operation for transmitting and/or receving.
ulBase | is the base address of the SPI module |
ulFlags | selectes the DMA signal for transmit and/or receive. |
This function disables transmit and/or receive DMA request based on the ulFlags parameter.
The parameter ulFlags is the logical OR of one or more of the following :
void SPIDmaEnable | ( | unsigned long | ulBase, |
unsigned long | ulFlags | ||
) |
Enables the SPI DMA operation for transmitting and/or receving.
ulBase | is the base address of the SPI module |
ulFlags | selectes the DMA signal for transmit and/or receive. |
This function enables transmit and/or receive DMA request based on the ulFlags parameter.
The parameter ulFlags is the logical OR of one or more of the following :
void SPIEnable | ( | unsigned long | ulBase | ) |
Enables transmitting and receiving.
ulBase | is the base address of the SPI module |
This function enables the SPI channel for transmitting and receiving.
void SPIFIFODisable | ( | unsigned long | ulBase, |
unsigned long | ulFlags | ||
) |
Disables the transmit and/or receive FIFOs.
ulBase | is the base address of the SPI module |
ulFlags | selects the FIFO(s) to be enabled |
This function disables transmit and/or receive FIFOs. as specified by ulFlags. The parameter ulFlags shoulde be logical OR of one or more of the following:
void SPIFIFOEnable | ( | unsigned long | ulBase, |
unsigned long | ulFlags | ||
) |
Enables the transmit and/or receive FIFOs.
ulBase | is the base address of the SPI module |
ulFlags | selects the FIFO(s) to be enabled |
This function enables the transmit and/or receive FIFOs as specified by ulFlags. The parameter ulFlags shoulde be logical OR of one or more of the following:
void SPIFIFOLevelGet | ( | unsigned long | ulBase, |
unsigned long * | pulTxLevel, | ||
unsigned long * | pulRxLevel | ||
) |
Gets the FIFO level at which DMA requests or interrupts are generated.
ulBase | is the base address of the SPI module |
pulTxLevel | is a pointer to storage for the transmit FIFO level |
pulRxLevel | is a pointer to storage for the receive FIFO level |
This function gets the FIFO level at which DMA requests or interrupts are generated.
void SPIFIFOLevelSet | ( | unsigned long | ulBase, |
unsigned long | ulTxLevel, | ||
unsigned long | ulRxLevel | ||
) |
Sets the FIFO level at which DMA requests or interrupts are generated.
ulBase | is the base address of the SPI module |
ulTxLevel | is the Almost Empty Level for transmit FIFO. |
ulRxLevel | is the Almost Full Level for the receive FIFO. |
This function Sets the FIFO level at which DMA requests or interrupts are generated.
void SPIIntClear | ( | unsigned long | ulBase, |
unsigned long | ulIntFlags | ||
) |
Clears SPI interrupt sources.
ulBase | is the base address of the SPI module |
ulIntFlags | is a bit mask of the interrupt sources to be cleared. |
The specified SPI interrupt sources are cleared, so that they no longer assert. This function must be called in the interrupt handler to keep the interrupt from being recognized again immediately upon exit.
The ulIntFlags parameter has the same definition as the ulIntFlags parameter to SPIIntEnable().
void SPIIntDisable | ( | unsigned long | ulBase, |
unsigned long | ulIntFlags | ||
) |
Disables individual SPI interrupt sources.
ulBase | is the base address of the SPI module |
ulIntFlags | is the bit mask of the interrupt sources to be disabled. |
This function disables the indicated SPI interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.
The ulIntFlags parameter has the same definition as the ulIntFlags parameter to SPIIntEnable().
void SPIIntEnable | ( | unsigned long | ulBase, |
unsigned long | ulIntFlags | ||
) |
Enables individual SPI interrupt sources.
ulBase | is the base address of the SPI module |
ulIntFlags | is the bit mask of the interrupt sources to be enabled. |
This function enables the indicated SPI interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.
The ulIntFlags parameter is the logical OR of any of the following:
void SPIIntRegister | ( | unsigned long | ulBase, |
void(*)(void) | pfnHandler | ||
) |
Registers an interrupt handler for a SPI interrupt.
ulBase | is the base address of the SPI module |
pfnHandler | is a pointer to the function to be called when the SPI interrupt occurs. |
This function does the actual registering of the interrupt handler. This function enables the global interrupt in the interrupt controller; specific SPI interrupts must be enabled via SPIIntEnable(). It is the interrupt handler's responsibility to clear the interrupt source.
unsigned long SPIIntStatus | ( | unsigned long | ulBase, |
tBoolean | bMasked | ||
) |
Gets the current interrupt status.
ulBase | is the base address of the SPI module |
bMasked | is false if the raw interrupt status is required and true if the masked interrupt status is required. |
This function returns the interrupt status for the specified SPI. The status of interrupts that are allowed to reflect to the processor can be returned.
void SPIIntUnregister | ( | unsigned long | ulBase | ) |
Unregisters an interrupt handler for a SPI interrupt.
ulBase | is the base address of the SPI module |
This function does the actual unregistering of the interrupt handler. It clears the handler to be called when a SPI interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler no longer is called.
void SPIReset | ( | unsigned long | ulBase | ) |
Performs a software reset of the specified SPI module
ulBase | is the base address of the SPI module |
This function performs a software reset of the specified SPI module
long SPITransfer | ( | unsigned long | ulBase, |
unsigned char * | ucDout, | ||
unsigned char * | ucDin, | ||
unsigned long | ulCount, | ||
unsigned long | ulFlags | ||
) |
Send/Receive data buffer over SPI channel
ulBase | is the base address of SPI module |
ucDout | is the pointer to Tx data buffer or 0. |
ucDin | is pointer to Rx data buffer or 0 |
ulCount | is the size of data in bytes. |
ulFlags | controlls chip select toggling. |
This function transfers ulCount bytes of data over SPI channel. Since the API sends a SPI word at a time ulCount should be a multiple of word length set using SPIConfigSetExpClk().
If the ucDout parameter is set to 0, the function will send 0xFF over the SPI MOSI line.
If the ucDin parameter is set to 0, the function will ignore data on SPI MISO line.
The parameter ulFlags is logical OR of one or more of the following
This function will not return until data has been transmitted
void SPIWordCountSet | ( | unsigned long | ulBase, |
unsigned long | ulWordCount | ||
) |
Sets the word count.
ulBase | is the base address of the SPI module |
ulWordCount | is number of SPI words to be transmitted. |
This function sets the word count, which is the number of SPI word to be transferred on channel when using the FIFO buffer.