Kinetis SDK v.1.3 API Reference Manual
Rev. 0
Freescale Semiconductor, Inc.
|
This section describes the programming interface of the DSPI HAL driver.
Files | |
file | fsl_dspi_hal.h |
Data Structures | |
struct | dspi_data_format_config_t |
DSPI data format settings configuration structure. More... | |
struct | dspi_baud_rate_divisors_t |
DSPI baud rate divisors settings configuration structure. More... | |
struct | dspi_command_config_t |
DSPI command and data configuration structure. More... | |
Configuration | |
void | DSPI_HAL_Init (SPI_Type *base) |
Restores the DSPI to reset the configuration. More... | |
static void | DSPI_HAL_Enable (SPI_Type *base) |
Enables the DSPI peripheral and sets the MCR MDIS to 0. More... | |
static void | DSPI_HAL_Disable (SPI_Type *base) |
Disables the DSPI peripheral, sets MCR MDIS to 1. More... | |
uint32_t | DSPI_HAL_SetBaudRate (SPI_Type *base, dspi_ctar_selection_t whichCtar, uint32_t bitsPerSec, uint32_t sourceClockInHz) |
Sets the DSPI baud rate in bits per second. More... | |
void | DSPI_HAL_SetBaudDivisors (SPI_Type *base, dspi_ctar_selection_t whichCtar, const dspi_baud_rate_divisors_t *divisors) |
Configures the baud rate divisors manually. More... | |
static void | DSPI_HAL_SetMasterSlaveMode (SPI_Type *base, dspi_master_slave_mode_t mode) |
Configures the DSPI for master or slave. More... | |
static bool | DSPI_HAL_IsMaster (SPI_Type *base) |
Returns whether the DSPI module is in master mode. More... | |
static void | DSPI_HAL_SetContinuousSckCmd (SPI_Type *base, bool enable) |
Configures the DSPI for the continuous SCK operation. More... | |
static void | DSPI_HAL_SetRxFifoOverwriteCmd (SPI_Type *base, bool enable) |
Configures the DSPI received FIFO overflow overwrite enable. More... | |
void | DSPI_HAL_SetPcsPolarityMode (SPI_Type *base, dspi_which_pcs_config_t pcs, dspi_pcs_polarity_config_t activeLowOrHigh) |
Configures the DSPI peripheral chip select polarity. More... | |
void | DSPI_HAL_SetFifoCmd (SPI_Type *base, bool enableTxFifo, bool enableRxFifo) |
Enables (or disables) the DSPI FIFOs. More... | |
void | DSPI_HAL_SetFlushFifoCmd (SPI_Type *base, bool enableFlushTxFifo, bool enableFlushRxFifo) |
Flushes the DSPI FIFOs. More... | |
static void | DSPI_HAL_SetDatainSamplepointMode (SPI_Type *base, dspi_master_sample_point_t samplePnt) |
Configures the time when the DSPI master samples SIN in the Modified Transfer Format. More... | |
static void | DSPI_HAL_StartTransfer (SPI_Type *base) |
Starts the DSPI transfers, clears HALT bit in MCR. More... | |
static void | DSPI_HAL_StopTransfer (SPI_Type *base) |
Stops (halts) DSPI transfers, sets HALT bit in MCR. More... | |
dspi_status_t | DSPI_HAL_SetDataFormat (SPI_Type *base, dspi_ctar_selection_t whichCtar, const dspi_data_format_config_t *config) |
Configures the data format for a particular CTAR. More... | |
void | DSPI_HAL_SetDelay (SPI_Type *base, dspi_ctar_selection_t whichCtar, uint32_t prescaler, uint32_t scaler, dspi_delay_type_t whichDelay) |
Manually configures the delay prescaler and scaler for a particular CTAR. More... | |
uint32_t | DSPI_HAL_CalculateDelay (SPI_Type *base, dspi_ctar_selection_t whichCtar, dspi_delay_type_t whichDelay, uint32_t sourceClockInHz, uint32_t delayInNanoSec) |
Calculates the delay prescaler and scaler based on the desired delay input in nanoseconds. More... | |
static uint32_t | DSPI_HAL_GetMasterPushrRegAddr (SPI_Type *base) |
Gets the DSPI master PUSHR data register address for DMA operation. More... | |
static uint32_t | DSPI_HAL_GetSlavePushrRegAddr (SPI_Type *base) |
Gets the DSPI slave PUSHR data register address for DMA operation. More... | |
static uint32_t | DSPI_HAL_GetPoprRegAddr (SPI_Type *base) |
Gets the DSPI POPR data register address for DMA operation. More... | |
Interrupts | |
void | DSPI_HAL_SetTxFifoFillDmaIntMode (SPI_Type *base, dspi_dma_or_int_mode_t mode, bool enable) |
Configures the DSPI Tx FIFO fill request to generate DMA or interrupt requests. More... | |
void | DSPI_HAL_SetRxFifoDrainDmaIntMode (SPI_Type *base, dspi_dma_or_int_mode_t mode, bool enable) |
Configures the DSPI Rx FIFO Drain request to generate DMA or interrupt requests. More... | |
void | DSPI_HAL_SetIntMode (SPI_Type *base, dspi_status_and_interrupt_request_t interruptSrc, bool enable) |
Configures the DSPI interrupts. More... | |
static bool | DSPI_HAL_GetIntMode (SPI_Type *base, dspi_status_and_interrupt_request_t interruptSrc) |
Gets DSPI interrupt configuration, returns if interrupt request is enabled or disabled. More... | |
Status | |
static bool | DSPI_HAL_GetStatusFlag (SPI_Type *base, dspi_status_and_interrupt_request_t statusFlag) |
Gets the DSPI status flag state. More... | |
static void | DSPI_HAL_ClearStatusFlag (SPI_Type *base, dspi_status_and_interrupt_request_t statusFlag) |
Clears the DSPI status flag. More... | |
Data transfer | |
static uint32_t | DSPI_HAL_ReadData (SPI_Type *base) |
Reads data from the data buffer. More... | |
static void | DSPI_HAL_WriteDataSlavemode (SPI_Type *base, uint32_t data) |
Writes data into the data buffer, slave mode. More... | |
void | DSPI_HAL_WriteDataSlavemodeBlocking (SPI_Type *base, uint32_t data) |
Writes data into the data buffer, slave mode and waits till data was transmitted and return. More... | |
void | DSPI_HAL_WriteDataMastermode (SPI_Type *base, dspi_command_config_t *command, uint16_t data) |
Writes data into the data buffer, master mode. More... | |
void | DSPI_HAL_WriteDataMastermodeBlocking (SPI_Type *base, dspi_command_config_t *command, uint16_t data) |
Writes data into the data buffer, master mode and waits till complete to return. More... | |
static void | DSPI_HAL_WriteCmdDataMastermode (SPI_Type *base, uint32_t data) |
Writes a 32-bit data word (16-bit command appended with 16-bit data) into the data buffer, master mode. More... | |
void | DSPI_HAL_WriteCmdDataMastermodeBlocking (SPI_Type *base, uint32_t data) |
Writes a 32-bit data word (16-bit command appended with 16-bit data) into the data buffer, master mode and waits till complete to return. More... | |
static uint32_t | DSPI_HAL_GetTransferCount (SPI_Type *base) |
Gets the transfer count. More... | |
static void | DSPI_HAL_PresetTransferCount (SPI_Type *base, uint16_t presetValue) |
Pre-sets the transfer count. More... | |
uint32_t | DSPI_HAL_GetFormattedCommand (SPI_Type *base, dspi_command_config_t *command) |
Returns the DSPI command word formatted to the PUSHR data register bit field. More... | |
struct dspi_data_format_config_t |
This structure contains the data format settings. These settings apply to a specific CTARn register, which the user must provide in this structure.
Data Fields | |
uint32_t | bitsPerFrame |
Bits per frame, minimum 4, maximum 16. | |
dspi_clock_polarity_t | clkPolarity |
Active high or low clock polarity. | |
dspi_clock_phase_t | clkPhase |
Clock phase setting to change and capture data. | |
dspi_shift_direction_t | direction |
MSB or LSB data shift direction This setting relevant only in master mode and can be ignored in slave mode. | |
struct dspi_baud_rate_divisors_t |
Note: These settings are relevant only in master mode. This structure contains the baud rate divisor settings, which provides the user with the option to explicitly set these baud rate divisors. In addition, the user must also set the CTARn register with the divisor settings.
Data Fields | |
bool | doubleBaudRate |
Double Baud rate parameter setting. | |
uint32_t | prescaleDivisor |
Baud Rate Pre-scalar parameter setting. | |
uint32_t | baudRateDivisor |
Baud Rate scaler parameter setting. | |
struct dspi_command_config_t |
Note: This structure is used with the PUSHR register, which provides the means to write to the Tx FIFO. Data written to this register is transferred to the Tx FIFO. Eight or sixteen-bit write accesses to the PUSHR transfer all 32 register bits to the Tx FIFO. The register structure is different in master and slave modes. In master mode, the register provides 16-bit command and 16-bit data to the Tx FIFO. In slave mode only 16-bit data may be written (this may be contrary to some older documentation which erroneously states that a 32-bit value may be written).
Data Fields | |
bool | isChipSelectContinuous |
Option to enable the continuous assertion of chip select between transfers. | |
dspi_ctar_selection_t | whichCtar |
The desired Clock and Transfer Attributes Register (CTAR) to use for CTAS. | |
dspi_which_pcs_config_t | whichPcs |
The desired PCS signal to use for the data transfer. | |
bool | isEndOfQueue |
Signals that the current transfer is the last in the queue. | |
bool | clearTransferCount |
Clears SPI_TCNT field; cleared before transmission starts. | |
enum dspi_status_t |
enum dspi_clock_phase_t |
enum dspi_delay_type_t |
void DSPI_HAL_Init | ( | SPI_Type * | base | ) |
This function basically resets all of the DSPI registers to their default setting including disabling the module.
base | Module base pointer of type SPI_Type. |
|
inlinestatic |
base | Module base pointer of type SPI_Type. |
|
inlinestatic |
base | Module base pointer of type SPI_Type. |
uint32_t DSPI_HAL_SetBaudRate | ( | SPI_Type * | base, |
dspi_ctar_selection_t | whichCtar, | ||
uint32_t | bitsPerSec, | ||
uint32_t | sourceClockInHz | ||
) |
This function takes in the desired bitsPerSec (baud rate) and calculates the nearest possible baud rate without exceeding the desired baud rate, and returns the calculated baud rate in bits-per-second. It requires that the caller also provide the frequency of the module source clock (in Hertz).
base | Module base pointer of type SPI_Type. |
whichCtar | The desired Clock and Transfer Attributes Register (CTAR) of the type dspi_ctar_selection_t |
bitsPerSec | The desired baud rate in bits per second |
sourceClockInHz | Module source input clock in Hertz |
void DSPI_HAL_SetBaudDivisors | ( | SPI_Type * | base, |
dspi_ctar_selection_t | whichCtar, | ||
const dspi_baud_rate_divisors_t * | divisors | ||
) |
This function allows the caller to manually set the baud rate divisors in the event that these dividers are known and the caller does not wish to call the DSPI_HAL_SetBaudRate function.
base | Module base pointer of type SPI_Type. |
whichCtar | The desired Clock and Transfer Attributes Register (CTAR) of type dspi_ctar_selection_t |
divisors | Pointer to a structure containing the user defined baud rate divisor settings |
|
inlinestatic |
base | Module base pointer of type SPI_Type. |
mode | Mode setting (master or slave) of type dspi_master_slave_mode_t |
|
inlinestatic |
base | Module base pointer of type SPI_Type. |
|
inlinestatic |
base | Module base pointer of type SPI_Type. |
enable | Enables (true) or disables(false) continuous SCK operation. |
|
inlinestatic |
When enabled, this function allows incoming receive data to overwrite the existing data in the receive shift register when the Rx FIFO is full. Otherwise when disabled, the incoming data is ignored when the RX FIFO is full.
base | Module base pointer of type SPI_Type. |
enable | If enabled (true), allows incoming data to overwrite Rx FIFO contents when full, else incoming data is ignored. |
void DSPI_HAL_SetPcsPolarityMode | ( | SPI_Type * | base, |
dspi_which_pcs_config_t | pcs, | ||
dspi_pcs_polarity_config_t | activeLowOrHigh | ||
) |
This function takes in the desired peripheral chip select (PCS) and it's corresponding desired polarity and configures the PCS signal to operate with the desired characteristic.
base | Module base pointer of type SPI_Type. |
pcs | The particular peripheral chip select (parameter value is of type dspi_which_pcs_config_t) for which we wish to apply the active high or active low characteristic. |
activeLowOrHigh | The setting for either "active high, inactive low (0)" or "active low, inactive high(1)" of type dspi_pcs_polarity_config_t. |
void DSPI_HAL_SetFifoCmd | ( | SPI_Type * | base, |
bool | enableTxFifo, | ||
bool | enableRxFifo | ||
) |
This function allows the caller to disable/enable the Tx and Rx FIFOs (independently). Note that to disable, the caller must pass in a logic 0 (false) for the particular FIFO configuration. To enable, the caller must pass in a logic 1 (true).
base | Module base pointer of type SPI_Type. |
enableTxFifo | Disables (false) the TX FIFO, else enables (true) the TX FIFO |
enableRxFifo | Disables (false) the RX FIFO, else enables (true) the RX FIFO |
void DSPI_HAL_SetFlushFifoCmd | ( | SPI_Type * | base, |
bool | enableFlushTxFifo, | ||
bool | enableFlushRxFifo | ||
) |
base | Module base pointer of type SPI_Type. |
enableFlushTxFifo | Flushes (true) the Tx FIFO, else do not flush (false) the Tx FIFO |
enableFlushRxFifo | Flushes (true) the Rx FIFO, else do not flush (false) the Rx FIFO |
|
inlinestatic |
This function controls when the DSPI master samples SIN (data in) in the Modified Transfer Format. Note that this is valid only when the CPHA bit in the CTAR register is 0.
base | Module base pointer of type SPI_Type. |
samplePnt | selects when the data in (SIN) is sampled, of type dspi_master_sample_point_t. This value selects either 0, 1, or 2 system clocks between the SCK edge and the SIN (data in) sample. |
|
inlinestatic |
This function call called whenever the module is ready to begin data transfers in either master or slave mode.
base | Module base pointer of type SPI_Type. |
|
inlinestatic |
This function call stops data transfers in either master or slave mode.
base | Module base pointer of type SPI_Type. |
dspi_status_t DSPI_HAL_SetDataFormat | ( | SPI_Type * | base, |
dspi_ctar_selection_t | whichCtar, | ||
const dspi_data_format_config_t * | config | ||
) |
This function configures the bits-per-frame, polarity, phase, and shift direction for a particular CTAR. An example use case is as follows:
base | Module base pointer of type SPI_Type. |
whichCtar | The desired Clock and Transfer Attributes Register (CTAR) of type dspi_ctar_selection_t. |
config | Pointer to structure containing user defined data format configuration settings. |
void DSPI_HAL_SetDelay | ( | SPI_Type * | base, |
dspi_ctar_selection_t | whichCtar, | ||
uint32_t | prescaler, | ||
uint32_t | scaler, | ||
dspi_delay_type_t | whichDelay | ||
) |
This function configures the PCS to SCK delay pre-scalar (PCSSCK) and scalar (CSSCK), after SCK delay pre-scalar (PASC) and scalar (ASC), and the delay after transfer pre-scalar (PDT)and scalar (DT).
These delay names are available in type dspi_delay_type_t.
The user passes which delay they want to configure along with the prescaler and scaler value. This allows the user to directly set the prescaler/scaler values if they have pre-calculated them or if they simply wish to manually increment either value.
base | Module base pointer of type SPI_Type. |
whichCtar | The desired Clock and Transfer Attributes Register (CTAR) of type dspi_ctar_selection_t. |
prescaler | The prescaler delay value (can be an integer 0, 1, 2, or 3). |
scaler | The scaler delay value (can be any integer between 0 to 15). |
whichDelay | The desired delay to configure, must be of type dspi_delay_type_t |
uint32_t DSPI_HAL_CalculateDelay | ( | SPI_Type * | base, |
dspi_ctar_selection_t | whichCtar, | ||
dspi_delay_type_t | whichDelay, | ||
uint32_t | sourceClockInHz, | ||
uint32_t | delayInNanoSec | ||
) |
This function calculates the values for: PCS to SCK delay pre-scalar (PCSSCK) and scalar (CSSCK), or After SCK delay pre-scalar (PASC) and scalar (ASC), or Delay after transfer pre-scalar (PDT)and scalar (DT).
These delay names are available in type dspi_delay_type_t.
The user passes which delay they want to configure along with the desired delay value in nanoseconds. The function calculates the values needed for the prescaler and scaler and returning the actual calculated delay as an exact delay match may not be possible. In this case, the closest match is calculated without going below the desired delay value input. It is possible to input a very large delay value that exceeds the capability of the part, in which case the maximum supported delay is returned. It is to the higher level peripheral driver to alert the user of an out of range delay input.
base | Module base pointer of type SPI_Type. |
whichCtar | The desired Clock and Transfer Attributes Register (CTAR) of type dspi_ctar_selection_t. |
whichDelay | The desired delay to configure, must be of type dspi_delay_type_t |
sourceClockInHz | Module source input clock in Hertz |
delayInNanoSec | The desired delay value in nanoseconds. |
|
inlinestatic |
This function gets the DSPI master PUSHR data register address as this value is needed for DMA operation.
base | Module base pointer of type SPI_Type. |
|
inlinestatic |
This function gets the DSPI slave PUSHR data register address as this value is needed for DMA operation.
base | Module base pointer of type SPI_Type. |
|
inlinestatic |
This function gets the DSPI POPR data register address as this value is needed for DMA operation.
base | Module base pointer of type SPI_Type. |
void DSPI_HAL_SetTxFifoFillDmaIntMode | ( | SPI_Type * | base, |
dspi_dma_or_int_mode_t | mode, | ||
bool | enable | ||
) |
This function configures the DSPI Tx FIFO Fill flag to generate either an interrupt or DMA request. The user passes in which request they'd like to generate of type dspi_dma_or_int_mode_t and whether or not they wish to enable this request. Note, when disabling the request, the request type is don't care.
base | Module base pointer of type SPI_Type. |
mode | Configures the DSPI Tx FIFO Fill to generate an interrupt or DMA request |
enable | Enable (true) or disable (false) the DSPI Tx FIFO Fill flag to generate requests |
void DSPI_HAL_SetRxFifoDrainDmaIntMode | ( | SPI_Type * | base, |
dspi_dma_or_int_mode_t | mode, | ||
bool | enable | ||
) |
This function configures the DSPI Rx FIFO Drain flag to generate either an interrupt or a DMA request. The user passes in which request they'd like to generate of type dspi_dma_or_int_mode_t and whether or not they wish to enable this request. Note, when disabling the request, the request type is don't care.
base | Module base pointer of type SPI_Type. |
mode | Configures the Rx FIFO Drain to generate an interrupt or DMA request |
enable | Enable (true) or disable (false) the Rx FIFO Drain flag to generate requests |
void DSPI_HAL_SetIntMode | ( | SPI_Type * | base, |
dspi_status_and_interrupt_request_t | interruptSrc, | ||
bool | enable | ||
) |
This function configures the various interrupt sources of the DSPI. The parameters are base, interrupt source, and enable/disable setting. The interrupt source is a typedef enumeration whose value is the bit position of the interrupt source setting within the RSER register. In the DSPI, all interrupt configuration settings are in one register. The typedef enum equates each interrupt source to the bit position defined in the device header file. The function uses these bit positions in its algorithm to enable/disable the interrupt source, where interrupt source is the dspi_status_and_interrupt_request_t type. Note, for Tx FIFO Fill and Rx FIFO Drain requests, use the functions: DSPI_HAL_SetTxFifoFillDmaIntMode and DSPI_HAL_SetRxFifoDrainDmaIntMode respectively as these requests can generate either an interrupt or DMA request.
base | Module base pointer of type SPI_Type. |
interruptSrc | The interrupt source, of type dspi_status_and_interrupt_request_t |
enable | Enable (true) or disable (false) the interrupt source to generate requests |
|
inlinestatic |
This function returns the requested interrupt source setting (enabled or disabled, of type bool). The parameters to pass in are base and interrupt source. It utilizes the same enumeration definitions for the interrupt sources as described in the interrupt config function. The function uses these bit positions in its algorithm to obtain the desired interrupt source setting. Note, for Tx FIFO Fill and Rx FIFO Drain requests, this returns whether or not their requests are enabled.
base | Module base pointer of type SPI_Type. |
interruptSrc | The interrupt source, of type dspi_status_and_interrupt_request_t |
|
inlinestatic |
The status flag is defined in the same enumeration as the interrupt source enable because the bit position of the interrupt source and corresponding status flag are the same in the RSER and SR registers. The function uses these bit positions in its algorithm to obtain the desired flag state, similar to the dspi_get_interrupt_config function.
base | Module base pointer of type SPI_Type. |
statusFlag | The status flag, of type dspi_status_and_interrupt_request_t |
|
inlinestatic |
This function clears the desired status bit by using a write-1-to-clear. The user passes in the base and the desired status bit to clear. The list of status bits is defined in the dspi_status_and_interrupt_request_t. The function uses these bit positions in its algorithm to clear the desired flag state. Example usage:
base | Module base pointer of type SPI_Type. |
statusFlag | The status flag, of type dspi_status_and_interrupt_request_t |
|
inlinestatic |
base | Module base pointer of type SPI_Type. |
|
inlinestatic |
In slave mode, up to 16-bit words may be written.
base | Module base pointer of type SPI_Type. |
data | The data to send |
void DSPI_HAL_WriteDataSlavemodeBlocking | ( | SPI_Type * | base, |
uint32_t | data | ||
) |
In slave mode, up to 16-bit words may be written. The function first clears transmit complete flag then writes data into data register, and finally wait tills the data is transmitted.
base | Module base pointer of type SPI_Type. |
data | The data to send |
void DSPI_HAL_WriteDataMastermode | ( | SPI_Type * | base, |
dspi_command_config_t * | command, | ||
uint16_t | data | ||
) |
In master mode, the 16-bit data is appended to the 16-bit command info. The command portion provides characteristics of the data such as: optional continuous chip select operation between transfers, the desired Clock and Transfer Attributes register to use for the associated SPI frame, the desired PCS signal to use for the data transfer, whether the current transfer is the last in the queue, and whether to clear the transfer count (normally needed when sending the first frame of a data packet). This is an example:
base | Module base pointer of type SPI_Type. |
command | Pointer to command structure |
data | The data word to be sent |
void DSPI_HAL_WriteDataMastermodeBlocking | ( | SPI_Type * | base, |
dspi_command_config_t * | command, | ||
uint16_t | data | ||
) |
In master mode, the 16-bit data is appended to the 16-bit command info. The command portion provides characteristics of the data such as: optional continuous chip select operation between transfers, the desired Clock and Transfer Attributes register to use for the associated SPI frame, the desired PCS signal to use for the data transfer, whether the current transfer is the last in the queue, and whether to clear the transfer count (normally needed when sending the first frame of a data packet). This is an example:
Note that this function does not return until after the transmit is complete. Also note that the DSPI must be enabled and running in order to transmit data (MCR[MDIS] & [HALT] = 0). Since the SPI is a synchronous protocol, receive data is available when transmit completes.
base | Module base pointer of type SPI_Type. |
command | Pointer to command structure |
data | The data word to be sent |
|
inlinestatic |
In this function, the user must append the 16-bit data to the 16-bit command info then provide the total 32-bit word as the data to send. The command portion provides characteristics of the data such as: optional continuous chip select operation between transfers, the desired Clock and Transfer Attributes register to use for the associated SPI frame, the desired PCS signal to use for the data transfer, whether the current transfer is the last in the queue, and whether to clear the transfer count (normally needed when sending the first frame of a data packet). The user is responsible for appending this command with the data to send. This is an example:
base | Module base pointer of type SPI_Type. |
data | The data word (command and data combined) to be sent |
void DSPI_HAL_WriteCmdDataMastermodeBlocking | ( | SPI_Type * | base, |
uint32_t | data | ||
) |
In this function, the user must append the 16-bit data to the 16-bit command info then provide the total 32-bit word as the data to send. The command portion provides characteristics of the data such as: optional continuous chip select operation between transfers, the desired Clock and Transfer Attributes register to use for the associated SPI frame, the desired PCS signal to use for the data transfer, whether the current transfer is the last in the queue, and whether to clear the transfer count (normally needed when sending the first frame of a data packet). The user is responsible for appending this command with the data to send. This is an example:
Note that this function does not return until after the transmit is complete. Also note that the DSPI must be enabled and running in order to transmit data (MCR[MDIS] & [HALT] = 0). Since the SPI is a synchronous protocol, receive data is available when transmit completes.
base | Module base pointer of type SPI_Type. |
data | The data word (command and data combined) to be sent |
|
inlinestatic |
This function returns the current value of the DSPI Transfer Count Register.
base | Module base pointer of type SPI_Type. |
|
inlinestatic |
This function allows the caller to pre-set the DSI Transfer Count Register to a desired value up to 65535; Incrementing past this resets the counter back to 0.
base | Module base pointer of type SPI_Type. |
presetValue | The desired pre-set value for the transfer counter |
uint32_t DSPI_HAL_GetFormattedCommand | ( | SPI_Type * | base, |
dspi_command_config_t * | command | ||
) |
This function allows the caller to pass in the data command structure and returns the command word formatted according to the DSPI PUSHR register bit field placement. The user can then "OR" the returned command word with the desired data to send and use the function DSPI_HAL_WriteCmdDataMastermode or DSPI_HAL_WriteCmdDataMastermodeBlocking to write the entire 32-bit command data word to the PUSHR. This helps improve performance in cases where the command structure is constant. For example, the user calls this function before starting a transfer to generate the command word. When they are ready to transmit the data, they would OR this formatted command word with the desired data to transmit. This process increases transmit performance when compared to calling send functions such as DSPI_HAL_WriteDataMastermode which format the command word each time a data word is to be sent.
base | Module base pointer of type SPI_Type. |
command | Pointer to command structure |