RTEMS 6.1-rc2
|
Data Structures | |
struct | _lpspi_master_config |
LPSPI master configuration structure. More... | |
struct | _lpspi_slave_config |
LPSPI slave configuration structure. More... | |
struct | _lpspi_transfer |
LPSPI master/slave transfer structure. More... | |
struct | _lpspi_master_handle |
LPSPI master transfer handle structure used for transactional API. More... | |
struct | _lpspi_slave_handle |
LPSPI slave transfer handle structure used for transactional API. More... | |
Driver version | |
enum | { kStatus_LPSPI_Busy = MAKE_STATUS(kStatusGroup_LPSPI, 0) , kStatus_LPSPI_Error = MAKE_STATUS(kStatusGroup_LPSPI, 1) , kStatus_LPSPI_Idle = MAKE_STATUS(kStatusGroup_LPSPI, 2) , kStatus_LPSPI_OutOfRange = MAKE_STATUS(kStatusGroup_LPSPI, 3) , kStatus_LPSPI_Timeout = MAKE_STATUS(kStatusGroup_LPSPI, 4) } |
Status for the LPSPI driver. More... | |
enum | _lpspi_flags { kLPSPI_TxDataRequestFlag = LPSPI_SR_TDF_MASK , kLPSPI_RxDataReadyFlag = LPSPI_SR_RDF_MASK , kLPSPI_WordCompleteFlag = LPSPI_SR_WCF_MASK , kLPSPI_FrameCompleteFlag = LPSPI_SR_FCF_MASK , kLPSPI_TransferCompleteFlag = LPSPI_SR_TCF_MASK , kLPSPI_TransmitErrorFlag = LPSPI_SR_TEF_MASK , kLPSPI_ReceiveErrorFlag = LPSPI_SR_REF_MASK , kLPSPI_DataMatchFlag = LPSPI_SR_DMF_MASK , kLPSPI_ModuleBusyFlag = LPSPI_SR_MBF_MASK , kLPSPI_AllStatusFlag } |
LPSPI status flags in SPIx_SR register. More... | |
enum | _lpspi_interrupt_enable { kLPSPI_TxInterruptEnable = LPSPI_IER_TDIE_MASK , kLPSPI_RxInterruptEnable = LPSPI_IER_RDIE_MASK , kLPSPI_WordCompleteInterruptEnable = LPSPI_IER_WCIE_MASK , kLPSPI_FrameCompleteInterruptEnable = LPSPI_IER_FCIE_MASK , kLPSPI_TransferCompleteInterruptEnable = LPSPI_IER_TCIE_MASK , kLPSPI_TransmitErrorInterruptEnable = LPSPI_IER_TEIE_MASK , kLPSPI_ReceiveErrorInterruptEnable = LPSPI_IER_REIE_MASK , kLPSPI_DataMatchInterruptEnable = LPSPI_IER_DMIE_MASK , kLPSPI_AllInterruptEnable } |
LPSPI interrupt source. More... | |
enum | _lpspi_dma_enable { kLPSPI_TxDmaEnable = LPSPI_DER_TDDE_MASK , kLPSPI_RxDmaEnable = LPSPI_DER_RDDE_MASK } |
LPSPI DMA source. More... | |
enum | _lpspi_master_slave_mode { kLPSPI_Master = 1U , kLPSPI_Slave = 0U } |
LPSPI master or slave mode configuration. More... | |
enum | _lpspi_which_pcs_config { kLPSPI_Pcs0 = 0U , kLPSPI_Pcs1 = 1U , kLPSPI_Pcs2 = 2U , kLPSPI_Pcs3 = 3U } |
LPSPI Peripheral Chip Select (PCS) configuration (which PCS to configure). More... | |
enum | _lpspi_pcs_polarity_config { kLPSPI_PcsActiveHigh = 1U , kLPSPI_PcsActiveLow = 0U } |
LPSPI Peripheral Chip Select (PCS) Polarity configuration. More... | |
enum | _lpspi_pcs_polarity { kLPSPI_Pcs0ActiveLow = 1U << 0 , kLPSPI_Pcs1ActiveLow = 1U << 1 , kLPSPI_Pcs2ActiveLow = 1U << 2 , kLPSPI_Pcs3ActiveLow = 1U << 3 , kLPSPI_PcsAllActiveLow = 0xFU } |
LPSPI Peripheral Chip Select (PCS) Polarity. More... | |
enum | _lpspi_clock_polarity { kLPSPI_ClockPolarityActiveHigh = 0U , kLPSPI_ClockPolarityActiveLow = 1U } |
LPSPI clock polarity configuration. More... | |
enum | _lpspi_clock_phase { kLPSPI_ClockPhaseFirstEdge = 0U , kLPSPI_ClockPhaseSecondEdge = 1U } |
LPSPI clock phase configuration. More... | |
enum | _lpspi_shift_direction { kLPSPI_MsbFirst = 0U , kLPSPI_LsbFirst = 1U } |
LPSPI data shifter direction options. More... | |
enum | _lpspi_host_request_select { kLPSPI_HostReqExtPin = 0U , kLPSPI_HostReqInternalTrigger = 1U } |
LPSPI Host Request select configuration. More... | |
enum | _lpspi_match_config { kLPSI_MatchDisabled = 0x0U , kLPSI_1stWordEqualsM0orM1 = 0x2U , kLPSI_AnyWordEqualsM0orM1 = 0x3U , kLPSI_1stWordEqualsM0and2ndWordEqualsM1 = 0x4U , kLPSI_AnyWordEqualsM0andNxtWordEqualsM1 = 0x5U , kLPSI_1stWordAndM1EqualsM0andM1 = 0x6U , kLPSI_AnyWordAndM1EqualsM0andM1 = 0x7U } |
LPSPI Match configuration options. More... | |
enum | _lpspi_pin_config { kLPSPI_SdiInSdoOut = 0U , kLPSPI_SdiInSdiOut = 1U , kLPSPI_SdoInSdoOut = 2U , kLPSPI_SdoInSdiOut = 3U } |
LPSPI pin (SDO and SDI) configuration. More... | |
enum | _lpspi_data_out_config { kLpspiDataOutRetained = 0U , kLpspiDataOutTristate = 1U } |
LPSPI data output configuration. More... | |
enum | _lpspi_transfer_width { kLPSPI_SingleBitXfer = 0U , kLPSPI_TwoBitXfer = 1U , kLPSPI_FourBitXfer = 2U } |
LPSPI transfer width configuration. More... | |
enum | _lpspi_delay_type { kLPSPI_PcsToSck = 1U , kLPSPI_LastSckToPcs , kLPSPI_BetweenTransfer } |
LPSPI delay type selection. More... | |
enum | _lpspi_transfer_config_flag_for_master { kLPSPI_MasterPcs0 = 0U << LPSPI_MASTER_PCS_SHIFT , kLPSPI_MasterPcs1 = 1U << LPSPI_MASTER_PCS_SHIFT , kLPSPI_MasterPcs2 = 2U << LPSPI_MASTER_PCS_SHIFT , kLPSPI_MasterPcs3 = 3U << LPSPI_MASTER_PCS_SHIFT , kLPSPI_MasterPcsContinuous = 1U << 20 , kLPSPI_MasterByteSwap } |
Use this enumeration for LPSPI master transfer configFlags. More... | |
enum | _lpspi_transfer_config_flag_for_slave { kLPSPI_SlavePcs0 = 0U << LPSPI_SLAVE_PCS_SHIFT , kLPSPI_SlavePcs1 = 1U << LPSPI_SLAVE_PCS_SHIFT , kLPSPI_SlavePcs2 = 2U << LPSPI_SLAVE_PCS_SHIFT , kLPSPI_SlavePcs3 = 3U << LPSPI_SLAVE_PCS_SHIFT , kLPSPI_SlaveByteSwap } |
Use this enumeration for LPSPI slave transfer configFlags. More... | |
enum | _lpspi_transfer_state { kLPSPI_Idle = 0x0U , kLPSPI_Busy , kLPSPI_Error } |
LPSPI transfer state, which is used for LPSPI transactional API state machine. More... | |
typedef enum _lpspi_master_slave_mode | lpspi_master_slave_mode_t |
LPSPI master or slave mode configuration. | |
typedef enum _lpspi_which_pcs_config | lpspi_which_pcs_t |
LPSPI Peripheral Chip Select (PCS) configuration (which PCS to configure). | |
typedef enum _lpspi_pcs_polarity_config | lpspi_pcs_polarity_config_t |
LPSPI Peripheral Chip Select (PCS) Polarity configuration. | |
typedef enum _lpspi_clock_polarity | lpspi_clock_polarity_t |
LPSPI clock polarity configuration. | |
typedef enum _lpspi_clock_phase | lpspi_clock_phase_t |
LPSPI clock phase configuration. | |
typedef enum _lpspi_shift_direction | lpspi_shift_direction_t |
LPSPI data shifter direction options. | |
typedef enum _lpspi_host_request_select | lpspi_host_request_select_t |
LPSPI Host Request select configuration. | |
typedef enum _lpspi_match_config | lpspi_match_config_t |
LPSPI Match configuration options. | |
typedef enum _lpspi_pin_config | lpspi_pin_config_t |
LPSPI pin (SDO and SDI) configuration. | |
typedef enum _lpspi_data_out_config | lpspi_data_out_config_t |
LPSPI data output configuration. | |
typedef enum _lpspi_transfer_width | lpspi_transfer_width_t |
LPSPI transfer width configuration. | |
typedef enum _lpspi_delay_type | lpspi_delay_type_t |
LPSPI delay type selection. | |
typedef struct _lpspi_master_config | lpspi_master_config_t |
LPSPI master configuration structure. | |
typedef struct _lpspi_slave_config | lpspi_slave_config_t |
LPSPI slave configuration structure. | |
typedef struct _lpspi_master_handle | lpspi_master_handle_t |
Forward declaration of the _lpspi_master_handle typedefs. | |
typedef struct _lpspi_slave_handle | lpspi_slave_handle_t |
Forward declaration of the _lpspi_slave_handle typedefs. | |
typedef void(* | lpspi_master_transfer_callback_t) (LPSPI_Type *base, lpspi_master_handle_t *handle, status_t status, void *userData) |
Master completion callback function pointer type. | |
typedef void(* | lpspi_slave_transfer_callback_t) (LPSPI_Type *base, lpspi_slave_handle_t *handle, status_t status, void *userData) |
Slave completion callback function pointer type. | |
typedef struct _lpspi_transfer | lpspi_transfer_t |
LPSPI master/slave transfer structure. | |
volatile uint8_t | g_lpspiDummyData [] |
Global variable for dummy data value setting. | |
#define | FSL_LPSPI_DRIVER_VERSION (MAKE_VERSION(2, 4, 0)) |
LPSPI driver version. | |
#define | LPSPI_DUMMY_DATA (0x00U) |
LPSPI dummy data if no Tx data. | |
#define | SPI_RETRY_TIMES 0U /* Define to zero means keep waiting until the flag is assert/deassert. */ |
Retry times for waiting flag. | |
#define | LPSPI_MASTER_PCS_SHIFT (4U) |
#define | LPSPI_MASTER_PCS_MASK (0xF0U) |
#define | LPSPI_SLAVE_PCS_SHIFT (4U) |
#define | LPSPI_SLAVE_PCS_MASK (0xF0U) |
Initialization and deinitialization | |
void | LPSPI_MasterInit (LPSPI_Type *base, const lpspi_master_config_t *masterConfig, uint32_t srcClock_Hz) |
Initializes the LPSPI master. | |
void | LPSPI_MasterGetDefaultConfig (lpspi_master_config_t *masterConfig) |
Sets the lpspi_master_config_t structure to default values. | |
void | LPSPI_SlaveInit (LPSPI_Type *base, const lpspi_slave_config_t *slaveConfig) |
LPSPI slave configuration. | |
void | LPSPI_SlaveGetDefaultConfig (lpspi_slave_config_t *slaveConfig) |
Sets the lpspi_slave_config_t structure to default values. | |
void | LPSPI_Deinit (LPSPI_Type *base) |
De-initializes the LPSPI peripheral. Call this API to disable the LPSPI clock. | |
void | LPSPI_Reset (LPSPI_Type *base) |
Restores the LPSPI peripheral to reset state. Note that this function sets all registers to reset state. As a result, the LPSPI module can't work after calling this API. | |
uint32_t | LPSPI_GetInstance (LPSPI_Type *base) |
Get the LPSPI instance from peripheral base address. | |
Bus Operations | |
bool | LPSPI_CheckTransferArgument (LPSPI_Type *base, lpspi_transfer_t *transfer, bool isEdma) |
Check the argument for transfer . | |
uint32_t | LPSPI_MasterSetBaudRate (LPSPI_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz, uint32_t *tcrPrescaleValue) |
Sets the LPSPI baud rate in bits per second. | |
void | LPSPI_MasterSetDelayScaler (LPSPI_Type *base, uint32_t scaler, lpspi_delay_type_t whichDelay) |
Manually configures a specific LPSPI delay parameter (module must be disabled to change the delay values). | |
uint32_t | LPSPI_MasterSetDelayTimes (LPSPI_Type *base, uint32_t delayTimeInNanoSec, lpspi_delay_type_t whichDelay, uint32_t srcClock_Hz) |
Calculates the delay based on the desired delay input in nanoseconds (module must be disabled to change the delay values). | |
void | LPSPI_SetDummyData (LPSPI_Type *base, uint8_t dummyData) |
Set up the dummy data. | |
Transactional | |
void | LPSPI_MasterTransferCreateHandle (LPSPI_Type *base, lpspi_master_handle_t *handle, lpspi_master_transfer_callback_t callback, void *userData) |
Initializes the LPSPI master handle. | |
status_t | LPSPI_MasterTransferBlocking (LPSPI_Type *base, lpspi_transfer_t *transfer) |
LPSPI master transfer data using a polling method. | |
status_t | LPSPI_MasterTransferNonBlocking (LPSPI_Type *base, lpspi_master_handle_t *handle, lpspi_transfer_t *transfer) |
LPSPI master transfer data using an interrupt method. | |
status_t | LPSPI_MasterTransferGetCount (LPSPI_Type *base, lpspi_master_handle_t *handle, size_t *count) |
Gets the master transfer remaining bytes. | |
void | LPSPI_MasterTransferAbort (LPSPI_Type *base, lpspi_master_handle_t *handle) |
LPSPI master abort transfer which uses an interrupt method. | |
void | LPSPI_MasterTransferHandleIRQ (LPSPI_Type *base, lpspi_master_handle_t *handle) |
LPSPI Master IRQ handler function. | |
void | LPSPI_SlaveTransferCreateHandle (LPSPI_Type *base, lpspi_slave_handle_t *handle, lpspi_slave_transfer_callback_t callback, void *userData) |
Initializes the LPSPI slave handle. | |
status_t | LPSPI_SlaveTransferNonBlocking (LPSPI_Type *base, lpspi_slave_handle_t *handle, lpspi_transfer_t *transfer) |
LPSPI slave transfer data using an interrupt method. | |
status_t | LPSPI_SlaveTransferGetCount (LPSPI_Type *base, lpspi_slave_handle_t *handle, size_t *count) |
Gets the slave transfer remaining bytes. | |
void | LPSPI_SlaveTransferAbort (LPSPI_Type *base, lpspi_slave_handle_t *handle) |
LPSPI slave aborts a transfer which uses an interrupt method. | |
void | LPSPI_SlaveTransferHandleIRQ (LPSPI_Type *base, lpspi_slave_handle_t *handle) |
LPSPI Slave IRQ handler function. | |
#define LPSPI_DUMMY_DATA (0x00U) |
LPSPI dummy data if no Tx data.
Dummy data used for tx if there is not txData.
#define LPSPI_MASTER_PCS_MASK (0xF0U) |
LPSPI master PCS shift macro , internal used.
#define LPSPI_MASTER_PCS_SHIFT (4U) |
LPSPI master PCS shift macro , internal used.
#define LPSPI_SLAVE_PCS_MASK (0xF0U) |
LPSPI slave PCS shift macro , internal used.
#define LPSPI_SLAVE_PCS_SHIFT (4U) |
LPSPI slave PCS shift macro , internal used.
typedef void(* lpspi_master_transfer_callback_t) (LPSPI_Type *base, lpspi_master_handle_t *handle, status_t status, void *userData) |
Master completion callback function pointer type.
base | LPSPI peripheral address. |
handle | Pointer to the handle for the LPSPI master. |
status | Success or error code describing whether the transfer is completed. |
userData | Arbitrary pointer-dataSized value passed from the application. |
typedef void(* lpspi_slave_transfer_callback_t) (LPSPI_Type *base, lpspi_slave_handle_t *handle, status_t status, void *userData) |
Slave completion callback function pointer type.
base | LPSPI peripheral address. |
handle | Pointer to the handle for the LPSPI slave. |
status | Success or error code describing whether the transfer is completed. |
userData | Arbitrary pointer-dataSized value passed from the application. |
anonymous enum |
enum _lpspi_clock_phase |
enum _lpspi_delay_type |
enum _lpspi_dma_enable |
enum _lpspi_flags |
LPSPI status flags in SPIx_SR register.
LPSPI interrupt source.
enum _lpspi_match_config |
LPSPI Match configuration options.
enum _lpspi_pcs_polarity |
LPSPI Peripheral Chip Select (PCS) Polarity.
enum _lpspi_pin_config |
Use this enumeration for LPSPI master transfer configFlags.
Use this enumeration for LPSPI slave transfer configFlags.
bool LPSPI_CheckTransferArgument | ( | LPSPI_Type * | base, |
lpspi_transfer_t * | transfer, | ||
bool | isEdma | ||
) |
Check the argument for transfer .
base | LPSPI peripheral address. |
transfer | the transfer struct to be used. |
isEdma | True to check for EDMA transfer, false to check interrupt non-blocking transfer |
brief Check the argument for transfer .
param base LPSPI peripheral address. param transfer the transfer struct to be used. param isEdma True to check for EDMA transfer, false to check interrupt non-blocking transfer return Return true for right and false for wrong.
void LPSPI_Deinit | ( | LPSPI_Type * | base | ) |
De-initializes the LPSPI peripheral. Call this API to disable the LPSPI clock.
base | LPSPI peripheral address. |
brief De-initializes the LPSPI peripheral. Call this API to disable the LPSPI clock. param base LPSPI peripheral address.
uint32_t LPSPI_GetInstance | ( | LPSPI_Type * | base | ) |
Get the LPSPI instance from peripheral base address.
base | LPSPI peripheral base address. |
brief Get the LPSPI instance from peripheral base address.
param base LPSPI peripheral base address. return LPSPI instance.
void LPSPI_MasterGetDefaultConfig | ( | lpspi_master_config_t * | masterConfig | ) |
Sets the lpspi_master_config_t structure to default values.
This API initializes the configuration structure for LPSPI_MasterInit(). The initialized structure can remain unchanged in LPSPI_MasterInit(), or can be modified before calling the LPSPI_MasterInit(). Example:
masterConfig | pointer to lpspi_master_config_t structure |
brief Sets the lpspi_master_config_t structure to default values.
This API initializes the configuration structure for LPSPI_MasterInit(). The initialized structure can remain unchanged in LPSPI_MasterInit(), or can be modified before calling the LPSPI_MasterInit(). Example: code lpspi_master_config_t masterConfig; LPSPI_MasterGetDefaultConfig(&masterConfig); endcode param masterConfig pointer to lpspi_master_config_t structure
void LPSPI_MasterInit | ( | LPSPI_Type * | base, |
const lpspi_master_config_t * | masterConfig, | ||
uint32_t | srcClock_Hz | ||
) |
Initializes the LPSPI master.
base | LPSPI peripheral address. |
masterConfig | Pointer to structure lpspi_master_config_t. |
srcClock_Hz | Module source input clock in Hertz |
brief Initializes the LPSPI master.
param base LPSPI peripheral address. param masterConfig Pointer to structure lpspi_master_config_t. param srcClock_Hz Module source input clock in Hertz
uint32_t LPSPI_MasterSetBaudRate | ( | LPSPI_Type * | base, |
uint32_t | baudRate_Bps, | ||
uint32_t | srcClock_Hz, | ||
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 the caller to provide the frequency of the module source clock (in Hertz). Note that the baud rate does not go into effect 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. The higher level peripheral driver should 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 configured for master mode before configuring this.
base | LPSPI peripheral address. |
baudRate_Bps | The desired baud rate in bits per second. |
srcClock_Hz | Module source input clock in Hertz. |
tcrPrescaleValue | The TCR prescale value needed to program the TCR. |
brief 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 the caller to provide the frequency of the module source clock (in Hertz). Note that the baud rate does not go into effect 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. The higher level peripheral driver should 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 configured for master mode before configuring this.
param base LPSPI peripheral address. param baudRate_Bps The desired baud rate in bits per second. param srcClock_Hz Module source input clock in Hertz. param tcrPrescaleValue The TCR prescale value needed to program the TCR. return The actual calculated baud rate. This function may also return a "0" if the LPSPI is not configured for master mode or if the LPSPI module is not disabled.
void LPSPI_MasterSetDelayScaler | ( | LPSPI_Type * | base, |
uint32_t | scaler, | ||
lpspi_delay_type_t | whichDelay | ||
) |
Manually configures a specific LPSPI delay parameter (module must be disabled to change the delay values).
This function configures the following: SCK to PCS delay, or PCS to SCK delay, or The configurations must occur between the transfer delay.
The delay names are available in type lpspi_delay_type_t.
The user passes the desired delay 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 configured for master mode before configuring this.
base | LPSPI peripheral address. |
scaler | The 8-bit delay value 0x00 to 0xFF (255). |
whichDelay | The desired delay to configure, must be of type lpspi_delay_type_t. |
brief Manually configures a specific LPSPI delay parameter (module must be disabled to change the delay values).
This function configures the following: SCK to PCS delay, or PCS to SCK delay, or The configurations must occur between the transfer delay.
The delay names are available in type lpspi_delay_type_t.
The user passes the desired delay 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 configured for master mode before configuring this.
param base LPSPI peripheral address. param scaler The 8-bit delay value 0x00 to 0xFF (255). param whichDelay The desired delay to configure, must be of type lpspi_delay_type_t.
uint32_t LPSPI_MasterSetDelayTimes | ( | LPSPI_Type * | base, |
uint32_t | delayTimeInNanoSec, | ||
lpspi_delay_type_t | whichDelay, | ||
uint32_t | srcClock_Hz | ||
) |
Calculates the delay based on the desired delay input in nanoseconds (module must be disabled to change the delay values).
This function calculates the values for the following: SCK to PCS delay, or PCS to SCK delay, or The configurations must occur between the transfer delay.
The delay names are available in type lpspi_delay_type_t.
The user passes the desired delay and the desired delay value in nano-seconds. The function calculates the value needed for the desired delay parameter and returns the actual calculated delay because 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 up to the higher level peripheral driver to alert the user of an out of range delay input.
Note that the LPSPI module must be configured for master mode before configuring this. And note that the delayTime = LPSPI_clockSource / (PRESCALE * Delay_scaler).
base | LPSPI peripheral address. |
delayTimeInNanoSec | The desired delay value in nano-seconds. |
whichDelay | The desired delay to configuration, which must be of type lpspi_delay_type_t. |
srcClock_Hz | Module source input clock in Hertz. |
brief Calculates the delay based on the desired delay input in nanoseconds (module must be disabled to change the delay values).
This function calculates the values for the following: SCK to PCS delay, or PCS to SCK delay, or The configurations must occur between the transfer delay.
The delay names are available in type lpspi_delay_type_t.
The user passes the desired delay and the desired delay value in nano-seconds. The function calculates the value needed for the desired delay parameter and returns the actual calculated delay because 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 up to the higher level peripheral driver to alert the user of an out of range delay input.
Note that the LPSPI module must be configured for master mode before configuring this. And note that the delayTime = LPSPI_clockSource / (PRESCALE * Delay_scaler).
param base LPSPI peripheral address. param delayTimeInNanoSec The desired delay value in nano-seconds. param whichDelay The desired delay to configuration, which must be of type lpspi_delay_type_t. param srcClock_Hz Module source input clock in Hertz. return actual Calculated delay value in nano-seconds.
void LPSPI_MasterTransferAbort | ( | LPSPI_Type * | base, |
lpspi_master_handle_t * | handle | ||
) |
LPSPI master abort transfer which uses an interrupt method.
This function aborts a transfer which uses an interrupt method.
base | LPSPI peripheral address. |
handle | pointer to lpspi_master_handle_t structure which stores the transfer state. |
brief LPSPI master abort transfer which uses an interrupt method.
This function aborts a transfer which uses an interrupt method.
param base LPSPI peripheral address. param handle pointer to lpspi_master_handle_t structure which stores the transfer state.
status_t LPSPI_MasterTransferBlocking | ( | LPSPI_Type * | base, |
lpspi_transfer_t * | transfer | ||
) |
LPSPI master transfer data using a polling method.
This function transfers data using a polling method. This is a blocking function, which does not return until all transfers have been completed.
Note: The transfer data size should be integer multiples of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not integer multiples of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.
base | LPSPI peripheral address. |
transfer | pointer to lpspi_transfer_t structure. |
brief LPSPI master transfer data using a polling method.
This function transfers data using a polling method. This is a blocking function, which does not return until all transfers have been completed.
Note: The transfer data size should be integer multiples of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not integer multiples of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.
param base LPSPI peripheral address. param transfer pointer to lpspi_transfer_t structure. return status of status_t.
void LPSPI_MasterTransferCreateHandle | ( | LPSPI_Type * | base, |
lpspi_master_handle_t * | handle, | ||
lpspi_master_transfer_callback_t | callback, | ||
void * | userData | ||
) |
Initializes the LPSPI master handle.
This function initializes the LPSPI handle, which can be used for other LPSPI transactional APIs. Usually, for a specified LPSPI instance, call this API once to get the initialized handle.
base | LPSPI peripheral address. |
handle | LPSPI handle pointer to lpspi_master_handle_t. |
callback | DSPI callback. |
userData | callback function parameter. |
brief Initializes the LPSPI master handle.
This function initializes the LPSPI handle, which can be used for other LPSPI transactional APIs. Usually, for a specified LPSPI instance, call this API once to get the initialized handle.
param base LPSPI peripheral address. param handle LPSPI handle pointer to lpspi_master_handle_t. param callback DSPI callback. param userData callback function parameter.
status_t LPSPI_MasterTransferGetCount | ( | LPSPI_Type * | base, |
lpspi_master_handle_t * | handle, | ||
size_t * | count | ||
) |
Gets the master transfer remaining bytes.
This function gets the master transfer remaining bytes.
base | LPSPI peripheral address. |
handle | pointer to lpspi_master_handle_t structure which stores the transfer state. |
count | Number of bytes transferred so far by the non-blocking transaction. |
brief Gets the master transfer remaining bytes.
This function gets the master transfer remaining bytes.
param base LPSPI peripheral address. param handle pointer to lpspi_master_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. return status of status_t.
void LPSPI_MasterTransferHandleIRQ | ( | LPSPI_Type * | base, |
lpspi_master_handle_t * | handle | ||
) |
LPSPI Master IRQ handler function.
This function processes the LPSPI transmit and receive IRQ.
base | LPSPI peripheral address. |
handle | pointer to lpspi_master_handle_t structure which stores the transfer state. |
brief LPSPI Master IRQ handler function.
This function processes the LPSPI transmit and receive IRQ.
param base LPSPI peripheral address. param handle pointer to lpspi_master_handle_t structure which stores the transfer state.
status_t LPSPI_MasterTransferNonBlocking | ( | LPSPI_Type * | base, |
lpspi_master_handle_t * | handle, | ||
lpspi_transfer_t * | transfer | ||
) |
LPSPI master transfer data using an interrupt method.
This function transfers data using an interrupt method. This is a non-blocking function, which returns right away. When all data is transferred, the callback function is called.
Note: The transfer data size should be integer multiples of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not integer multiples of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.
base | LPSPI peripheral address. |
handle | pointer to lpspi_master_handle_t structure which stores the transfer state. |
transfer | pointer to lpspi_transfer_t structure. |
brief LPSPI master transfer data using an interrupt method.
This function transfers data using an interrupt method. This is a non-blocking function, which returns right away. When all data is transferred, the callback function is called.
Note: The transfer data size should be integer multiples of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not integer multiples of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.
param base LPSPI peripheral address. param handle pointer to lpspi_master_handle_t structure which stores the transfer state. param transfer pointer to lpspi_transfer_t structure. return status of status_t.
void LPSPI_Reset | ( | LPSPI_Type * | base | ) |
Restores the LPSPI peripheral to reset state. Note that this function sets all registers to reset state. As a result, the LPSPI module can't work after calling this API.
base | LPSPI peripheral address. |
brief Restores the LPSPI peripheral to reset state. Note that this function sets all registers to reset state. As a result, the LPSPI module can't work after calling this API. param base LPSPI peripheral address.
void LPSPI_SetDummyData | ( | LPSPI_Type * | base, |
uint8_t | dummyData | ||
) |
Set up the dummy data.
base | LPSPI peripheral address. |
dummyData | Data to be transferred when tx buffer is NULL. Note: This API has no effect when LPSPI in slave interrupt mode, because driver will set the TXMSK bit to 1 if txData is NULL, no data is loaded from transmit FIFO and output pin is tristated. |
brief Set up the dummy data.
param base LPSPI peripheral address. param dummyData Data to be transferred when tx buffer is NULL. Note: This API has no effect when LPSPI in slave interrupt mode, because driver will set the TXMSK bit to 1 if txData is NULL, no data is loaded from transmit FIFO and output pin is tristated.
void LPSPI_SlaveGetDefaultConfig | ( | lpspi_slave_config_t * | slaveConfig | ) |
Sets the lpspi_slave_config_t structure to default values.
This API initializes the configuration structure for LPSPI_SlaveInit(). The initialized structure can remain unchanged in LPSPI_SlaveInit() or can be modified before calling the LPSPI_SlaveInit(). Example:
slaveConfig | pointer to lpspi_slave_config_t structure. |
brief Sets the lpspi_slave_config_t structure to default values.
This API initializes the configuration structure for LPSPI_SlaveInit(). The initialized structure can remain unchanged in LPSPI_SlaveInit() or can be modified before calling the LPSPI_SlaveInit(). Example: code lpspi_slave_config_t slaveConfig; LPSPI_SlaveGetDefaultConfig(&slaveConfig); endcode param slaveConfig pointer to lpspi_slave_config_t structure.
< Bits per frame, minimum 8, maximum 4096.
< Clock polarity.
< Clock phase.
< MSB or LSB data shift direction.
< Desired Peripheral Chip Select (pcs)
< Desired PCS active high or low
void LPSPI_SlaveInit | ( | LPSPI_Type * | base, |
const lpspi_slave_config_t * | slaveConfig | ||
) |
LPSPI slave configuration.
base | LPSPI peripheral address. |
slaveConfig | Pointer to a structure lpspi_slave_config_t. |
brief LPSPI slave configuration.
param base LPSPI peripheral address. param slaveConfig Pointer to a structure lpspi_slave_config_t.
void LPSPI_SlaveTransferAbort | ( | LPSPI_Type * | base, |
lpspi_slave_handle_t * | handle | ||
) |
LPSPI slave aborts a transfer which uses an interrupt method.
This function aborts a transfer which uses an interrupt method.
base | LPSPI peripheral address. |
handle | pointer to lpspi_slave_handle_t structure which stores the transfer state. |
brief LPSPI slave aborts a transfer which uses an interrupt method.
This function aborts a transfer which uses an interrupt method.
param base LPSPI peripheral address. param handle pointer to lpspi_slave_handle_t structure which stores the transfer state.
void LPSPI_SlaveTransferCreateHandle | ( | LPSPI_Type * | base, |
lpspi_slave_handle_t * | handle, | ||
lpspi_slave_transfer_callback_t | callback, | ||
void * | userData | ||
) |
Initializes the LPSPI slave handle.
This function initializes the LPSPI handle, which can be used for other LPSPI transactional APIs. Usually, for a specified LPSPI instance, call this API once to get the initialized handle.
base | LPSPI peripheral address. |
handle | LPSPI handle pointer to lpspi_slave_handle_t. |
callback | DSPI callback. |
userData | callback function parameter. |
brief Initializes the LPSPI slave handle.
This function initializes the LPSPI handle, which can be used for other LPSPI transactional APIs. Usually, for a specified LPSPI instance, call this API once to get the initialized handle.
param base LPSPI peripheral address. param handle LPSPI handle pointer to lpspi_slave_handle_t. param callback DSPI callback. param userData callback function parameter.
status_t LPSPI_SlaveTransferGetCount | ( | LPSPI_Type * | base, |
lpspi_slave_handle_t * | handle, | ||
size_t * | count | ||
) |
Gets the slave transfer remaining bytes.
This function gets the slave transfer remaining bytes.
base | LPSPI peripheral address. |
handle | pointer to lpspi_slave_handle_t structure which stores the transfer state. |
count | Number of bytes transferred so far by the non-blocking transaction. |
brief Gets the slave transfer remaining bytes.
This function gets the slave transfer remaining bytes.
param base LPSPI peripheral address. param handle pointer to lpspi_slave_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. return status of status_t.
void LPSPI_SlaveTransferHandleIRQ | ( | LPSPI_Type * | base, |
lpspi_slave_handle_t * | handle | ||
) |
LPSPI Slave IRQ handler function.
This function processes the LPSPI transmit and receives an IRQ.
base | LPSPI peripheral address. |
handle | pointer to lpspi_slave_handle_t structure which stores the transfer state. |
brief LPSPI Slave IRQ handler function.
This function processes the LPSPI transmit and receives an IRQ.
param base LPSPI peripheral address. param handle pointer to lpspi_slave_handle_t structure which stores the transfer state.
status_t LPSPI_SlaveTransferNonBlocking | ( | LPSPI_Type * | base, |
lpspi_slave_handle_t * | handle, | ||
lpspi_transfer_t * | transfer | ||
) |
LPSPI slave transfer data using an interrupt method.
This function transfer data using an interrupt method. This is a non-blocking function, which returns right away. When all data is transferred, the callback function is called.
Note: The transfer data size should be integer multiples of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not an integer multiple of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.
base | LPSPI peripheral address. |
handle | pointer to lpspi_slave_handle_t structure which stores the transfer state. |
transfer | pointer to lpspi_transfer_t structure. |
brief LPSPI slave transfer data using an interrupt method.
This function transfer data using an interrupt method. This is a non-blocking function, which returns right away. When all data is transferred, the callback function is called.
Note: The transfer data size should be integer multiples of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not an integer multiple of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.
param base LPSPI peripheral address. param handle pointer to lpspi_slave_handle_t structure which stores the transfer state. param transfer pointer to lpspi_transfer_t structure. return status of status_t.