![]() |
S32 SDK
|
Low Power Serial Peripheral Interface Hardware Abstraction Layer.
Data Structures | |
struct | lpspi_tx_cmd_config_t |
LPSPI Transmit Command Register configuration structure. More... | |
struct | lpspi_init_config_t |
LPSPI initialization configuration structure. More... | |
Enumerations | |
enum | lpspi_prescaler_t { LPSPI_DIV_1 = 0U, LPSPI_DIV_2 = 1U, LPSPI_DIV_4 = 2U, LPSPI_DIV_8 = 3U, LPSPI_DIV_16 = 4U, LPSPI_DIV_32 = 5U, LPSPI_DIV_64 = 6U, LPSPI_DIV_128 = 7U } |
Prescaler values for LPSPI clock source. Implements : lpspi_prescaler_t_Class. More... | |
enum | lpspi_status_flag_t { LPSPI_TX_DATA_FLAG = LPSPI_SR_TDF_SHIFT, LPSPI_RX_DATA_FLAG = LPSPI_SR_RDF_SHIFT, LPSPI_WORD_COMPLETE = LPSPI_SR_WCF_SHIFT, LPSPI_FRAME_COMPLETE = LPSPI_SR_FCF_SHIFT, LPSPI_TRANSFER_COMPLETE = LPSPI_SR_TCF_SHIFT, LPSPI_TRANSMIT_ERROR = LPSPI_SR_TEF_SHIFT, LPSPI_RECEIVE_ERROR = LPSPI_SR_REF_SHIFT, LPSPI_DATA_MATCH = LPSPI_SR_DMF_SHIFT, LPSPI_MODULE_BUSY = LPSPI_SR_MBF_SHIFT, LPSPI_ALL_STATUS = 0x00003F00U } |
LPSPI status flags. Implements : lpspi_status_flag_t_Class. More... | |
enum | lpspi_sck_polarity_t { LPSPI_SCK_ACTIVE_HIGH = 0U, LPSPI_SCK_ACTIVE_LOW = 1U } |
LPSPI Clock Signal (SCK) Polarity configuration. Implements : lpspi_sck_polarity_t_Class. More... | |
enum | lpspi_signal_polarity_t { LPSPI_ACTIVE_HIGH = 1U, LPSPI_ACTIVE_LOW = 0U } |
LPSPI Signal (PCS and Host Request) Polarity configuration. Implements : lpspi_signal_polarity_t_Class. More... | |
enum | lpspi_host_request_select_t { LPSPI_HOST_REQ_EXT_PIN = 0U, LPSPI_HOST_REQ_INTERNAL_TRIGGER = 1U } |
LPSPI Host Request select configuration. Implements : lpspi_host_request_select_t_Class. More... | |
enum | lpspi_master_slave_mode_t { LPSPI_MASTER = 1U, LPSPI_SLAVE = 0U } |
LPSPI master or slave configuration. Implements : lpspi_master_slave_mode_t_Class. More... | |
enum | lpspi_which_pcs_t { LPSPI_PCS0 = 0U, LPSPI_PCS1 = 1U, LPSPI_PCS2 = 2U, LPSPI_PCS3 = 3U } |
LPSPI Peripheral Chip Select (PCS) configuration (which PCS to configure). Implements : lpspi_which_pcs_t_Class. More... | |
enum | lpspi_match_config_t { LPSPI_MATCH_DISABLED = 0x0U, LPSPI_1ST_WRD_EQUALS_M0_OR_M1 = 0x2U, LPSPI_ANY_WRD_EQUALS_M0_OR_M1 = 0x3U, LPSPI_1ST_WRD_EQUALS_M0_AND_2ND_WRD_EQUALS_M1 = 0x4U, LPSPI_ANY_WRD_EQUALS_M0_AND_NXT_WRD_EQUALS_M1 = 0x5U, LPSPI_1ST_WRD_AND_M1_EQUALS_M0_AND_M1 = 0x6U, LPSPI_ANY_WRD_AND_M1_EQUALS_M0_AND_M1 = 0x7U } |
LPSPI Match configuration options. Implements : lpspi_match_config_t_Class. More... | |
enum | lpspi_pin_config_t { LPSPI_SDI_IN_SDO_OUT = 0U, LPSPI_SDI_IN_OUT = 1U, LPSPI_SDO_IN_OUT = 2U, LPSPI_SDI_OUT_SDO_IN = 3U } |
LPSPI pin (SDO and SDI) configuration. Implements : lpspi_pin_config_t_Class. More... | |
enum | lpspi_clock_phase_t { LPSPI_CLOCK_PHASE_1ST_EDGE = 0U, LPSPI_CLOCK_PHASE_2ND_EDGE = 1U } |
LPSPI clock phase configuration. Implements : lpspi_clock_phase_t_Class. More... | |
enum | lpspi_data_out_config_t { LPSPI_DATA_OUT_RETAINED = 0U, LPSPI_DATA_OUT_TRISTATE = 1U } |
LPSPI data output configuration. Implements : lpspi_data_out_config_t_Class. More... | |
enum | lpspi_transfer_width_t { LPSPI_SINGLE_BIT_XFER = 0U, LPSPI_TWO_BIT_XFER = 1U, LPSPI_FOUR_BIT_XFER = 2U } |
LPSPI transfer width configuration. Implements : lpspi_transfer_width_t_Class. More... | |
enum | lpspi_delay_type_t { LPSPI_SCK_TO_PCS = LPSPI_CCR_SCKPCS_SHIFT, LPSPI_PCS_TO_SCK = LPSPI_CCR_PCSSCK_SHIFT, LPSPI_BETWEEN_TRANSFER = LPSPI_CCR_DBT_SHIFT } |
LPSPI delay type selection Implements : lpspi_delay_type_t_Class. More... | |
Variables | |
static const uint32_t | s_baudratePrescaler [] = { 1, 2, 4, 8, 16, 32, 64, 128 } |
Configuration | |
void | LPSPI_HAL_Init (LPSPI_Type *base) |
Resets the LPSPI internal logic and registers to their default settings. More... | |
status_t | LPSPI_HAL_Config (LPSPI_Type *base, const lpspi_init_config_t *config, lpspi_tx_cmd_config_t *txCmdCfgSet, uint32_t *actualBaudRate) |
Configures the LPSPI registers to a user defined configuration. More... | |
void | LPSPI_HAL_GetVersionId (const LPSPI_Type *base, uint32_t *major, uint32_t *minor, uint32_t *feature) |
Gets the Major, Minor and Feature ID of the LPSPI module. More... | |
static void | LPSPI_HAL_Enable (LPSPI_Type *base) |
Enables the LPSPI module. More... | |
static bool | LPSPI_HAL_IsModuleEnabled (const LPSPI_Type *base) |
Check if LPSPI module is enabled. More... | |
status_t | LPSPI_HAL_Disable (LPSPI_Type *base) |
Disables the LPSPI module. More... | |
status_t | LPSPI_HAL_SetMasterSlaveMode (LPSPI_Type *base, lpspi_master_slave_mode_t mode) |
Configures the LPSPI for master or slave. More... | |
static bool | LPSPI_HAL_IsMaster (const LPSPI_Type *base) |
Returns whether the LPSPI module is in master mode. More... | |
void | LPSPI_HAL_GetFifoSizes (const LPSPI_Type *base, uint8_t *txFifoSize, uint8_t *rxFifoSize) |
Gets the TX and RX FIFO sizes of the LPSPI module. More... | |
void | LPSPI_HAL_SetFlushFifoCmd (LPSPI_Type *base, bool flushTxFifo, bool flushRxFifo) |
Flushes the LPSPI FIFOs. More... | |
static void | LPSPI_HAL_SetRxWatermarks (LPSPI_Type *base, uint32_t rxWater) |
Sets the RX FIFO watermark values. More... | |
static void | LPSPI_HAL_SetTxWatermarks (LPSPI_Type *base, uint32_t txWater) |
Sets the TX FIFO watermark values. More... | |
Status flags and Interrupt configuration | |
static bool | LPSPI_HAL_GetStatusFlag (const LPSPI_Type *base, lpspi_status_flag_t statusFlag) |
Gets the LPSPI status flag state. More... | |
status_t | LPSPI_HAL_ClearStatusFlag (LPSPI_Type *base, lpspi_status_flag_t statusFlag) |
Clears the LPSPI status flag. More... | |
static void | LPSPI_HAL_SetIntMode (LPSPI_Type *base, lpspi_status_flag_t interruptSrc, bool enable) |
Configures the LPSPI interrupts. More... | |
static bool | LPSPI_HAL_GetIntMode (const LPSPI_Type *base, lpspi_status_flag_t interruptSrc) |
Returns if the LPSPI interrupt request is enabled or disabled. More... | |
DMA configuration | |
static void | LPSPI_HAL_SetTxDmaCmd (LPSPI_Type *base, bool enable) |
Sets the LPSPI Transmit Data DMA configuration (enable or disable). More... | |
static void | LPSPI_HAL_SetRxDmaCmd (LPSPI_Type *base, bool enable) |
Sets the LPSPI Receive Data DMA configuration (enable or disable). More... | |
SPI Bus Configuration | |
void | LPSPI_HAL_SetHostRequestMode (LPSPI_Type *base, lpspi_host_request_select_t hostReqInput, lpspi_signal_polarity_t hostReqPol, bool enable) |
Configures the LPSPI Host Request input. More... | |
status_t | LPSPI_HAL_SetPcsPolarityMode (LPSPI_Type *base, lpspi_which_pcs_t whichPcs, lpspi_signal_polarity_t pcsPolarity) |
Configures the desired LPSPI PCS polarity. More... | |
status_t | LPSPI_HAL_SetMatchConfigMode (LPSPI_Type *base, lpspi_match_config_t matchCondition, bool rxDataMatchOnly, uint32_t match0, uint32_t match1) |
Configures the LPSPI data match configuration mode. More... | |
status_t | LPSPI_HAL_SetPinConfigMode (LPSPI_Type *base, lpspi_pin_config_t pinCfg, lpspi_data_out_config_t dataOutConfig, bool pcs3and2Enable) |
Configures the LPSPI SDO/SDI pin configuration mode. More... | |
uint32_t | LPSPI_HAL_SetBaudRate (LPSPI_Type *base, uint32_t bitsPerSec, uint32_t sourceClockInHz, uint32_t *tcrPrescaleValue) |
Sets the LPSPI baud rate in bits per second. More... | |
status_t | LPSPI_HAL_SetBaudRateDivisor (LPSPI_Type *base, uint32_t divisor) |
Configures the baud rate divisor manually (only the LPSPI_CCR[SCKDIV]). More... | |
status_t | LPSPI_HAL_SetDelay (LPSPI_Type *base, lpspi_delay_type_t whichDelay, uint32_t delay) |
Manually configures a specific LPSPI delay parameter (module must be disabled to change the delay values). More... | |
Data transfer | |
void | LPSPI_HAL_SetTxCommandReg (LPSPI_Type *base, const lpspi_tx_cmd_config_t *txCmdCfgSet) |
Sets the Transmit Command Register (TCR) parameters. More... | |
static void | LPSPI_HAL_WriteData (LPSPI_Type *base, uint32_t data) |
Writes data into the TX data buffer. More... | |
void | LPSPI_HAL_WriteDataBlocking (LPSPI_Type *base, uint32_t data) |
Writes a data into the TX data buffer and waits till complete to return. More... | |
static uint32_t | LPSPI_HAL_ReadData (const LPSPI_Type *base) |
Reads data from the data buffer. More... | |
uint32_t | LPSPI_HAL_ReadDataBlocking (const LPSPI_Type *base) |
Reads data from the data buffer but first waits till data is ready. More... | |
static uint32_t | LPSPI_HAL_ReadTxCount (const LPSPI_Type *base) |
Reads TX COUNT form the FIFO Status Register. More... | |
static uint32_t | LPSPI_HAL_ReadRxCount (const LPSPI_Type *base) |
Reads RX COUNT form the FIFO Status Register. More... | |
static void | LPSPI_HAL_ClearContCBit (LPSPI_Type *base) |
Clear CONTC bit form TCR Register. More... | |
static void | LPSPI_HAL_SetContCBit (LPSPI_Type *base) |
Set CONTC bit form TCR Register. More... | |
static void | LPSPI_HAL_SetClockPrescaler (LPSPI_Type *base, lpspi_prescaler_t prescaler) |
Configures the clock prescaler used for all LPSPI master logic. More... | |
static lpspi_prescaler_t | LPSPI_HAL_GetClockPrescaler (const LPSPI_Type *base) |
Get the clock prescaler used for all LPSPI master logic. More... | |
enum lpspi_clock_phase_t |
LPSPI clock phase configuration. Implements : lpspi_clock_phase_t_Class.
Enumerator | |
---|---|
LPSPI_CLOCK_PHASE_1ST_EDGE |
Data captured on SCK 1st edge, changed on 2nd. |
LPSPI_CLOCK_PHASE_2ND_EDGE |
Data changed on SCK 1st edge, captured on 2nd. |
Definition at line 182 of file lpspi_hal.h.
LPSPI data output configuration. Implements : lpspi_data_out_config_t_Class.
Enumerator | |
---|---|
LPSPI_DATA_OUT_RETAINED |
Data out retains last value when chip select de-asserted |
LPSPI_DATA_OUT_TRISTATE |
Data out is tri-stated when chip select de-asserted |
Definition at line 191 of file lpspi_hal.h.
enum lpspi_delay_type_t |
LPSPI delay type selection Implements : lpspi_delay_type_t_Class.
Enumerator | |
---|---|
LPSPI_SCK_TO_PCS |
SCK to PCS Delay |
LPSPI_PCS_TO_SCK |
PCS to SCK Delay |
LPSPI_BETWEEN_TRANSFER |
Delay between transfers |
Definition at line 261 of file lpspi_hal.h.
LPSPI Host Request select configuration. Implements : lpspi_host_request_select_t_Class.
Enumerator | |
---|---|
LPSPI_HOST_REQ_EXT_PIN |
Host Request is an ext pin. |
LPSPI_HOST_REQ_INTERNAL_TRIGGER |
Host Request is an internal trigger. |
Definition at line 125 of file lpspi_hal.h.
LPSPI master or slave configuration. Implements : lpspi_master_slave_mode_t_Class.
Enumerator | |
---|---|
LPSPI_MASTER |
LPSPI peripheral operates in master mode. |
LPSPI_SLAVE |
LPSPI peripheral operates in slave mode. |
Definition at line 134 of file lpspi_hal.h.
enum lpspi_match_config_t |
LPSPI Match configuration options. Implements : lpspi_match_config_t_Class.
Definition at line 154 of file lpspi_hal.h.
enum lpspi_pin_config_t |
LPSPI pin (SDO and SDI) configuration. Implements : lpspi_pin_config_t_Class.
Definition at line 171 of file lpspi_hal.h.
enum lpspi_prescaler_t |
Prescaler values for LPSPI clock source. Implements : lpspi_prescaler_t_Class.
Enumerator | |
---|---|
LPSPI_DIV_1 | |
LPSPI_DIV_2 | |
LPSPI_DIV_4 | |
LPSPI_DIV_8 | |
LPSPI_DIV_16 | |
LPSPI_DIV_32 | |
LPSPI_DIV_64 | |
LPSPI_DIV_128 |
Definition at line 75 of file lpspi_hal.h.
enum lpspi_sck_polarity_t |
LPSPI Clock Signal (SCK) Polarity configuration. Implements : lpspi_sck_polarity_t_Class.
Enumerator | |
---|---|
LPSPI_SCK_ACTIVE_HIGH |
Signal is Active High (idles low). |
LPSPI_SCK_ACTIVE_LOW |
Signal is Active Low (idles high). |
Definition at line 107 of file lpspi_hal.h.
LPSPI Signal (PCS and Host Request) Polarity configuration. Implements : lpspi_signal_polarity_t_Class.
Enumerator | |
---|---|
LPSPI_ACTIVE_HIGH |
Signal is Active High (idles low). |
LPSPI_ACTIVE_LOW |
Signal is Active Low (idles high). |
Definition at line 116 of file lpspi_hal.h.
enum lpspi_status_flag_t |
LPSPI status flags. Implements : lpspi_status_flag_t_Class.
Definition at line 90 of file lpspi_hal.h.
LPSPI transfer width configuration. Implements : lpspi_transfer_width_t_Class.
Definition at line 200 of file lpspi_hal.h.
enum lpspi_which_pcs_t |
LPSPI Peripheral Chip Select (PCS) configuration (which PCS to configure). Implements : lpspi_which_pcs_t_Class.
Enumerator | |
---|---|
LPSPI_PCS0 |
PCS[0] |
LPSPI_PCS1 |
PCS[1] |
LPSPI_PCS2 |
PCS[2] |
LPSPI_PCS3 |
PCS[3] |
Definition at line 143 of file lpspi_hal.h.
|
inlinestatic |
Clear CONTC bit form TCR Register.
This function clears the CONTC bit from the Transmit Command Register (TCR).
base | Module base pointer of type LPSPI_Type. Implements : LPSPI_HAL_ClearContCBit_Activity |
Definition at line 841 of file lpspi_hal.h.
status_t LPSPI_HAL_ClearStatusFlag | ( | LPSPI_Type * | base, |
lpspi_status_flag_t | statusFlag | ||
) |
Clears the LPSPI status flag.
This function clears the state of one of the LPSPI status flags as requested by the user. Note, the flag must be w1c capable, if not the function returns an error. w1c capable flags are: LPSPI_WORD_COMPLETE LPSPI_FRAME_COMPLETE LPSPI_TRANSFER_COMPLETE LPSPI_TRANSMIT_ERROR LPSPI_RECEIVE_ERROR LPSPI_DATA_MATCH
base | Module base pointer of type LPSPI_Type. |
statusFlag | The status flag, of type lpspi_status_flag_t |
Definition at line 278 of file lpspi_hal.c.
status_t LPSPI_HAL_Config | ( | LPSPI_Type * | base, |
const lpspi_init_config_t * | config, | ||
lpspi_tx_cmd_config_t * | txCmdCfgSet, | ||
uint32_t * | actualBaudRate | ||
) |
Configures the LPSPI registers to a user defined configuration.
Note, the LPSPI module must first be disabled prior to calling this function. It is recommended to first call the LPSPI_HAL_Init function prior to calling this function. This function configures the LPSPI based on the configuration passed in by the user for normal SPI mode operation. Recommend single bit transfer: txCmd.width = LPSPI_SINGLE_BIT_XFER, otherwise you will have to call function LPSPI_HAL_SetPinConfigMode to change the pin config. This function sets the TX and RX FIFO watermarks to 0 such that the write blocking and read blocking functions can be used following the init.
base | Module base pointer of type LPSPI_Type. |
config | User configuration of type lpspi_init_config_t. Members of this struct are not modifiable by the function. |
actualBaudRate | The actual, calculated baud rate passed back to the user |
txCmdCfgSet | Structure that contains the Transmit Command Register (TCR) settings of type lpspi_tx_cmd_config_t. There is a member of this struct that is modifiable by the function. |
Definition at line 107 of file lpspi_hal.c.
status_t LPSPI_HAL_Disable | ( | LPSPI_Type * | base | ) |
Disables the LPSPI module.
base | Module base pointer of type LPSPI_Type. |
Definition at line 183 of file lpspi_hal.c.
|
inlinestatic |
Enables the LPSPI module.
base | Module base pointer of type LPSPI_Type. Implements : LPSPI_HAL_Enable_Activity |
Definition at line 340 of file lpspi_hal.h.
|
inlinestatic |
Get the clock prescaler used for all LPSPI master logic.
base | Module base pointer of type LPSPI_Type. |
Definition at line 881 of file lpspi_hal.h.
void LPSPI_HAL_GetFifoSizes | ( | const LPSPI_Type * | base, |
uint8_t * | txFifoSize, | ||
uint8_t * | rxFifoSize | ||
) |
Gets the TX and RX FIFO sizes of the LPSPI module.
@ param base Module base pointer of type LPSPI_Type. @ param txFifoSize The TX FIFO size passed back to the user @ param rxFifoSize The RX FIFO size passed back to the user
Definition at line 230 of file lpspi_hal.c.
|
inlinestatic |
Returns if the LPSPI interrupt request is enabled or disabled.
base | Module base pointer of type LPSPI_Type. |
interruptSrc | The interrupt source, of type lpspi_status_flag_t |
Definition at line 513 of file lpspi_hal.h.
|
inlinestatic |
Gets the LPSPI status flag state.
This function returns the state of one of the LPSPI status flags as requested by the user.
base | Module base pointer of type LPSPI_Type. |
statusFlag | The status flag, of type lpspi_status_flag_t |
Definition at line 459 of file lpspi_hal.h.
void LPSPI_HAL_GetVersionId | ( | const LPSPI_Type * | base, |
uint32_t * | major, | ||
uint32_t * | minor, | ||
uint32_t * | feature | ||
) |
Gets the Major, Minor and Feature ID of the LPSPI module.
@ param base Module base pointer of type LPSPI_Type. @ param major The Major version number passed back to the user @ param minor The Minor version number passed back to the user @ param feature The Feature set number passed back to the user
Definition at line 165 of file lpspi_hal.c.
void LPSPI_HAL_Init | ( | LPSPI_Type * | base | ) |
Resets the LPSPI internal logic and registers to their default settings.
This function first performs a software reset of the LPSPI module which resets the internal LPSPI logic and most registers, then proceeds to manually reset all of the LPSPI registers to their default setting to ensuring these registers at programmed to their default value which includes disabling the module.
Module | base pointer of type LPSPI_Type. |
Definition at line 84 of file lpspi_hal.c.
|
inlinestatic |
Returns whether the LPSPI module is in master mode.
base | Module base pointer of type LPSPI_Type. |
Definition at line 384 of file lpspi_hal.h.
|
inlinestatic |
Check if LPSPI module is enabled.
Module | base pointer of type LPSPI_Type. Implements : LPSPI_HAL_IsModuleEnabled_Activity |
Definition at line 351 of file lpspi_hal.h.
|
inlinestatic |
Reads data from the data buffer.
This function reads the data from the Receive Data Register (RDR). This function can be used for either master or slave mode.
base | Module base pointer of type LPSPI_Type. |
Definition at line 785 of file lpspi_hal.h.
uint32_t LPSPI_HAL_ReadDataBlocking | ( | const LPSPI_Type * | base | ) |
Reads data from the data buffer but first waits till data is ready.
This function reads the data from the Receive Data Register (RDR). However, before reading the data, it first waits till the read data ready status indicates the data is ready to be read. This function can be used for either master or slave mode. Note that it is required that the RX FIFO watermark be set to 0.
base | Module base pointer of type LPSPI_Type. |
Definition at line 717 of file lpspi_hal.c.
|
inlinestatic |
Reads RX COUNT form the FIFO Status Register.
This function reads the RX COUNT field from the FIFO Status Register (FSR).
base | Module base pointer of type LPSPI_Type. |
Definition at line 828 of file lpspi_hal.h.
|
inlinestatic |
Reads TX COUNT form the FIFO Status Register.
This function reads the TX COUNT field from the FIFO Status Register (FSR).
base | Module base pointer of type LPSPI_Type. |
Definition at line 814 of file lpspi_hal.h.
uint32_t LPSPI_HAL_SetBaudRate | ( | LPSPI_Type * | base, |
uint32_t | bitsPerSec, | ||
uint32_t | sourceClockInHz, | ||
uint32_t * | tcrPrescaleValue | ||
) |
Sets the LPSPI baud rate in bits per second.
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). Also note that the baud rate does not take into affect until the Transmit Control Register (TCR) is programmed with the PRESCALE value. Hence, this function returns the PRESCALE tcrPrescaleValue parameter for later programming in the TCR. It is up to the higher level peripheral driver to alert the user of an out of range baud rate input.
Note that the LPSPI module must first be disabled before configuring this. Note that the LPSPI module must be configure for master mode before configuring this.
base | Module base pointer of type LPSPI_Type. |
bitsPerSec | The desired baud rate in bits per second |
sourceClockInHz | Module source input clock in Hertz |
tcrPrescaleValue | The TCR PRESCALE value, needed by user to program the TCR |
Definition at line 472 of file lpspi_hal.c.
status_t LPSPI_HAL_SetBaudRateDivisor | ( | LPSPI_Type * | base, |
uint32_t | divisor | ||
) |
Configures the baud rate divisor manually (only the LPSPI_CCR[SCKDIV]).
This function allows the caller to manually set the baud rate divisor in the event that this divider is known and the caller does not wish to call the LPSPI_HAL_SetBaudRate function. Note that this only affects the LPSPI_CCR[SCKDIV]). The Transmit Control Register (TCR) is programmed separately with the PRESCALE value. The valid range is 0x00 to 0xFF, if the user inputs outside of this range, an error is returned.
Note that the LPSPI module must first be disabled before configuring this. Note that the LPSPI module must be configure for master mode before configuring this.
base | Module base pointer of type LPSPI_Type. |
divisor | Desired baud rate divisor setting (0x00 to 0xFF) |
Definition at line 571 of file lpspi_hal.c.
|
inlinestatic |
Configures the clock prescaler used for all LPSPI master logic.
base | Module base pointer of type LPSPI_Type. |
prescaler | Prescaler value for master logic. Implements : LPSPI_HAL_SetClockPrescaler_Activity |
Definition at line 866 of file lpspi_hal.h.
|
inlinestatic |
Set CONTC bit form TCR Register.
This function set the CONTC bit from the Transmit Command Register (TCR).
base | Module base pointer of type LPSPI_Type. Implements : LPSPI_HAL_SetContCBit_Activity |
Definition at line 854 of file lpspi_hal.h.
status_t LPSPI_HAL_SetDelay | ( | LPSPI_Type * | base, |
lpspi_delay_type_t | whichDelay, | ||
uint32_t | delay | ||
) |
Manually configures a specific LPSPI delay parameter (module must be disabled to change the delay values).
This function configures the: SCK to PCS delay, or PCS to SCK delay, or Between transfer delay.
These delay names are available in type lpspi_delay_type_t.
The user passes which delay they want to configure along with the delay value. This allows the user to directly set the delay values if they have pre-calculated them or if they simply wish to manually increment the value.
Note that the LPSPI module must first be disabled before configuring this. Note that the LPSPI module must be configure for master mode before configuring this.
base | Module base pointer of type LPSPI_Type. |
whichDelay | The desired delay to configure, must be of type lpspi_delay_type_t |
delay | The 8-bit delay value 0x00 to 0xFF (255). The delay is equal to: -delay + 1 cycles of the LPSPI baud rate clock (SCK to PCS and PCS to SCK) -delay + 2 cycles of the LPSPI baud rate clock (Between transfer delay) |
Definition at line 620 of file lpspi_hal.c.
void LPSPI_HAL_SetFlushFifoCmd | ( | LPSPI_Type * | base, |
bool | flushTxFifo, | ||
bool | flushRxFifo | ||
) |
Flushes the LPSPI FIFOs.
base | Module base pointer of type LPSPI_Type. |
flushTxFifo | Flushes (true) the Tx FIFO, else do not flush (false) the Tx FIFO |
flushRxFifo | Flushes (true) the Rx FIFO, else do not flush (false) the Rx FIFO |
Definition at line 250 of file lpspi_hal.c.
void LPSPI_HAL_SetHostRequestMode | ( | LPSPI_Type * | base, |
lpspi_host_request_select_t | hostReqInput, | ||
lpspi_signal_polarity_t | hostReqPol, | ||
bool | enable | ||
) |
Configures the LPSPI Host Request input.
This function allows the user to configure the host request input pin as follows: Enable or disable the host request functionality. Select the polarity of the host request signal. Select the source of the host request (external signal or internal trigger).
base | Module base pointer of type LPSPI_Type. |
hostReqInput | Host request input source of type lpspi_host_request_select_t |
hostReqPol | Host request polarity of type lpspi_signal_polarity_t |
enable | Enable (true) or disable (false) the Host request feature |
Definition at line 313 of file lpspi_hal.c.
|
inlinestatic |
Configures the LPSPI interrupts.
base | Module base pointer of type LPSPI_Type. |
interruptSrc | The interrupt source, of type lpspi_status_flag_t |
enable | Enable (true) or disable (false) the interrupt source Implements : LPSPI_HAL_SetIntMode_Activity |
Definition at line 492 of file lpspi_hal.h.
status_t LPSPI_HAL_SetMasterSlaveMode | ( | LPSPI_Type * | base, |
lpspi_master_slave_mode_t | mode | ||
) |
Configures the LPSPI for master or slave.
Note that the LPSPI module must first be disabled before configuring this.
base | Module base pointer of type LPSPI_Type. |
mode | Mode setting (master or slave) of type lpspi_master_slave_mode_t |
Definition at line 208 of file lpspi_hal.c.
status_t LPSPI_HAL_SetMatchConfigMode | ( | LPSPI_Type * | base, |
lpspi_match_config_t | matchCondition, | ||
bool | rxDataMatchOnly, | ||
uint32_t | match0, | ||
uint32_t | match1 | ||
) |
Configures the LPSPI data match configuration mode.
When enabled and configured to the desired condition of type lpspi_match_config_t, the LPSPI will assert the DMF status flag if the data match condition is met. Note that the LPSPI module must first be disabled before configuring this.
base | Module base pointer of type LPSPI_Type. |
matchCondition | Select condition for the data match (see lpspi_match_config_t) |
rxDataMatchOnly | When enabled, all received data that does not cause RMF to set is discarded. |
match0 | Setting for Match0 value |
match1 | Setting for Match1 value |
Definition at line 375 of file lpspi_hal.c.
status_t LPSPI_HAL_SetPcsPolarityMode | ( | LPSPI_Type * | base, |
lpspi_which_pcs_t | whichPcs, | ||
lpspi_signal_polarity_t | pcsPolarity | ||
) |
Configures the desired LPSPI PCS polarity.
This function allows the user to configure the polarity of a particular PCS signal. Note that the LPSPI module must first be disabled before configuring this.
base | Module base pointer of type LPSPI_Type. |
whichPcs | Select which PCS to program, of type lpspi_which_pcs_t |
pcsPolarity | Set PCS as active high or low, of type lpspi_signal_polarity_t |
Definition at line 340 of file lpspi_hal.c.
status_t LPSPI_HAL_SetPinConfigMode | ( | LPSPI_Type * | base, |
lpspi_pin_config_t | pinCfg, | ||
lpspi_data_out_config_t | dataOutConfig, | ||
bool | pcs3and2Enable | ||
) |
Configures the LPSPI SDO/SDI pin configuration mode.
This function configures the pin mode of the LPSPI. For the SDI and SDO pins, the user can configure these pins as follows: SDI is used for input data and SDO for output data. SDO is used for input data and SDO for output data. SDI is used for input data and SDI for output data. SDO is used for input data and SDI for output data.
The user has the option to configure the output data as: Output data retains last value when chip select is de-asserted (default setting). Output data is tristated when chip select is de-asserted.
Finally, the user has the option to configure the PCS[3:2] pins as: Enabled for PCS operation (default setting). Disabled - this is need if the user wishes to configure the LPSPI mode for 4-bit transfers where these pins will be used as I/O data pins.
Note that the LPSPI module must first be disabled before configuring this.
base | Module base pointer of type LPSPI_Type. |
pinCfg | Select configuration for the SDO/SDI pins (see lpspi_pin_config_t) |
dataOutConfig | Select data output config after chip select de-assertion |
pcs3and2Enable | Enable or disable PCS[3:2] |
Definition at line 426 of file lpspi_hal.c.
|
inlinestatic |
Sets the LPSPI Receive Data DMA configuration (enable or disable).
base | Module base pointer of type LPSPI_Type. |
enable | Enable (true) or disable (false) the RX DMA request Implements : LPSPI_HAL_SetRxDmaCmd_Activity |
Definition at line 545 of file lpspi_hal.h.
|
inlinestatic |
Sets the RX FIFO watermark values.
This function allows the user to set the RX FIFO watermarks.
base | Module base pointer of type LPSPI_Type. |
rxWater | The RX FIFO watermark value Implements : LPSPI_HAL_SetRxWatermarks_Activity |
Definition at line 416 of file lpspi_hal.h.
void LPSPI_HAL_SetTxCommandReg | ( | LPSPI_Type * | base, |
const lpspi_tx_cmd_config_t * | txCmdCfgSet | ||
) |
Sets the Transmit Command Register (TCR) parameters.
The Transmit Command Register (TCR) contains multiple parameters that affect the transmission of data, such as clock phase and polarity, which PCS to use, whether or not the PCS remains asserted at the completion of a frame, etc. Any writes to this register results in an immediate push of the entire register and its contents to the TX FIFO. Hence, writes to this register should include all of the desired parameters written to the register at once. Hence, the user should fill in the members of the lpspi_tx_cmd_config_t data structure and pass this to the function.
base | Module base pointer of type LPSPI_Type. |
txCmdCfgSet | Structure that contains the Transmit Command Register (TCR) settings of type lpspi_tx_cmd_config_t |
Definition at line 663 of file lpspi_hal.c.
|
inlinestatic |
Sets the LPSPI Transmit Data DMA configuration (enable or disable).
base | Module base pointer of type LPSPI_Type. |
enable | Enable (true) or disable (false) the TX DMA request Implements : LPSPI_HAL_SetTxDmaCmd_Activity |
Definition at line 533 of file lpspi_hal.h.
|
inlinestatic |
Sets the TX FIFO watermark values.
This function allows the user to set the TX FIFO watermarks.
base | Module base pointer of type LPSPI_Type. |
txWater | The TX FIFO watermark value Implements : LPSPI_HAL_SetTxWatermarks_Activity |
Definition at line 433 of file lpspi_hal.h.
|
inlinestatic |
Writes data into the TX data buffer.
This function writes data passed in by the user to the Transmit Data Register (TDR). The user can pass up to 32-bits of data to load into the TDR. If the frame size exceeds 32-bits, the user will have to manage sending the data one 32-bit word at a time. Any writes to the TDR will result in an immediate push to the TX FIFO. This function can be used for either master or slave mode.
base | Module base pointer of type LPSPI_Type. |
data | The data word to be sent Implements : LPSPI_HAL_WriteData_Activity |
Definition at line 756 of file lpspi_hal.h.
void LPSPI_HAL_WriteDataBlocking | ( | LPSPI_Type * | base, |
uint32_t | data | ||
) |
Writes a data into the TX data buffer and waits till complete to return.
This function writes the data to the Transmit Data Register (TDR) and waits for completion before returning. If the frame size exceeds 32-bits, the user will have to manage sending the data one 32-bit word at a time. This function can be used for either master or slave mode. Note that it is required that the TX FIFO watermark be set to 0.
Module | base pointer of type LPSPI_Type. |
data | The data word to be sent |
Definition at line 692 of file lpspi_hal.c.
|
static |
Definition at line 272 of file lpspi_hal.h.