This document consists of sections titled with Driver Overview, Data Structures, Enumerations, Functions, etc., each with an overview list and detailed documentation. It is recommended to read the Driver Overview first for it includes a comprehensive description of the peripheral, driver and driver changes. Other sections give detailed information for APIs, enums, macros, etc., for your further reference.
|
#define | QSCI_RETRY_TIMES 0U /* Default defines to zero, driver keeps checking status flag untill it changes. */ |
| Retry times when checking status flags. More...
|
|
#define | QSCI_GET_BUS_STATUS(psHandle) (psHandle)->busStatus |
| Macros to be used inside user callback. More...
|
|
|
enum | {
kStatus_QSCI_TxBusy = MAKE_STATUS(kStatusGroup_QSCI, 0U),
kStatus_QSCI_RxBusy = MAKE_STATUS(kStatusGroup_QSCI, 1U),
kStatus_QSCI_TxIdle = MAKE_STATUS(kStatusGroup_QSCI, 2U),
kStatus_QSCI_RxIdle = MAKE_STATUS(kStatusGroup_QSCI, 3U),
kStatus_QSCI_FlagCannotClearManually,
kStatus_QSCI_RxRingBufferOverrun = MAKE_STATUS(kStatusGroup_QSCI, 5U),
kStatus_QSCI_RxHardwareOverrun = MAKE_STATUS(kStatusGroup_QSCI, 6U),
kStatus_QSCI_NoiseError = MAKE_STATUS(kStatusGroup_QSCI, 7U),
kStatus_QSCI_FramingError = MAKE_STATUS(kStatusGroup_QSCI, 8U),
kStatus_QSCI_ParityError = MAKE_STATUS(kStatusGroup_QSCI, 9U),
kStatus_QSCI_BaudrateNotSupport,
kStatus_QSCI_IdleLineDetected = MAKE_STATUS(kStatusGroup_QSCI, 11),
kStatus_QSCI_Timeout
} |
| Status codes for the QSCI driver. More...
|
|
enum | _qsci_status_flags {
kQSCI_TxDataRegEmptyFlag = QSCI_STAT_TDRE_MASK,
kQSCI_TxIdleFlag = QSCI_STAT_TIDLE_MASK,
kQSCI_RxDataRegFullFlag = QSCI_STAT_RDRF_MASK,
kQSCI_RxIdleLineFlag = QSCI_STAT_RIDLE_MASK,
kQSCI_RxOverrunFlag = QSCI_STAT_OR_MASK,
kQSCI_RxNoiseFlag = QSCI_STAT_NF_MASK,
kQSCI_RxFrameErrorFlag = QSCI_STAT_FE_MASK,
kQSCI_RxParityErrorFlag,
kQSCI_RxInputEdgeFlag,
kQSCI_LINSyncErrorFlag = QSCI_STAT_LSE_MASK,
kQSCI_TxDMARequestFlag = QSCI_STAT_TDMA_MASK,
kQSCI_RxDMARequestFlag = QSCI_STAT_RDMA_MASK
,
kQSCI_Group0Flags,
kQSCI_Group1Flags,
kQSCI_Group2Flags
} |
| QSCI hardware status flags. More...
|
|
enum | _qsci_interrupt_enable {
kQSCI_TxEmptyInterruptEnable = QSCI_CTRL1_TEIE_MASK,
kQSCI_TxIdleInterruptEnable = QSCI_CTRL1_TIIE_MASK,
kQSCI_RxFullInterruptEnable = QSCI_CTRL1_RFIE_MASK,
kQSCI_RxErrorInterruptEnable = QSCI_CTRL1_REIE_MASK,
kQSCI_RxInputEdgeInterruptEnable = QSCI_CTRL2_RIEIE_MASK >> 2U,
kQSCI_RxIdleLineInterruptEnable = QSCI_CTRL2_RIIE_MASK >> 2U
} |
| QSCI interrupt enable/disable source. More...
|
|
enum | qsci_transfer_mode_t {
kQSCI_Normal = 0U,
kQSCI_LoopInternal = 1U,
kQSCI_SingleWire = 2U
} |
| QSCI transmiter/receiver loop mode. More...
|
|
enum | qsci_data_bit_mode_t {
kQSCI_Data8Bit = 0U,
kQSCI_Data9Bit
} |
| QSCI data bit count. More...
|
|
enum | qsci_wakeup_mode_t {
kQSCI_WakeupOnIdleLine = 0U,
kQSCI_WakeupOnAddressMark = 1U
} |
| QSCI wakeup mode. More...
|
|
enum | qsci_polarity_mode_t {
kQSCI_PolarityNormal = 0U,
kQSCI_PolarityInvert = 1U
} |
| QSCI signal polarity mode. More...
|
|
enum | qsci_parity_mode_t {
kQSCI_ParityDisabled = 0x0U,
kQSCI_ParityEven = 0x1U,
kQSCI_ParityOdd = 0x2U
} |
| QSCI parity mode. More...
|
|
enum | qsci_tx_water_t {
kQSCI_TxWater0Word = 0x0U,
kQSCI_TxWater1Word = 0x1U,
kQSCI_TxWater2Word = 0x2U,
kQSCI_TxWater3Word = 0x3U
} |
| QSCI transmitter watermark level. More...
|
|
enum | qsci_rx_water_t {
kQSCI_RxWater1Word = 0x0U,
kQSCI_RxWater2Word = 0x1U,
kQSCI_RxWater3Word = 0x2U,
kQSCI_RxWater4Word = 0x3U
} |
| QSCI receiver watermark level. More...
|
|
|
static void | QSCI_Reset (QSCI_Type *base) |
| Sets the QSCI register value to reset value. More...
|
|
static void | QSCI_EnableTx (QSCI_Type *base, bool bEnable) |
| Enables or disables the QSCI transmitter. More...
|
|
static void | QSCI_EnableRx (QSCI_Type *base, bool bEnable) |
| Enables or disables the QSCI receiver. More...
|
|
static void | QSCI_EnableStopInWait (QSCI_Type *base, bool bEnable) |
| Enables/disables stop in wait. More...
|
|
static void | QSCI_Enable9bitMode (QSCI_Type *base, bool bEnable) |
| Enables/Disables 9-bit data mode for QSCI. More...
|
|
static void | QSCI_EnableStandbyMode (QSCI_Type *base, bool bEnable) |
| Enables/Disables standby mode. More...
|
|
static void | QSCI_EnableLINSlaveMode (QSCI_Type *base, bool bEnable) |
| Enable/Disable LIN slave mode. More...
|
|
static void | QSCI_EnableStopHold (QSCI_Type *base, bool bEnable) |
| Enable/Disable stop mode hold off. More...
|
|
static void | QSCI_SetTransferMode (QSCI_Type *base, qsci_transfer_mode_t eTransferMode) |
| Sets the QSCI transfer mode. More...
|
|
static void | QSCI_SetWakeupMode (QSCI_Type *base, qsci_wakeup_mode_t eWakeupMode) |
| Sets wakeup mode for QSCI. More...
|
|
static void | QSCI_SetPolarityMode (QSCI_Type *base, qsci_polarity_mode_t ePolarityMode) |
| Sets polarity mode for QSCI. More...
|
|
static void | QSCI_SetParityMode (QSCI_Type *base, qsci_parity_mode_t eParityMode) |
| Sets parity mode for QSCI. More...
|
|
status_t | QSCI_SetBaudRate (QSCI_Type *base, uint32_t u32BaudRateBps, uint32_t u32SrcClockHz) |
| Sets the QSCI instance baud rate. More...
|
|
|
void | QSCI_TransferCreateHandle (QSCI_Type *base, qsci_transfer_handle_t *psHhandle, qsci_transfer_callback_t pfCallback, void *pUserData) |
| Initializes the QSCI handle. More...
|
|
void | QSCI_TransferStartRingBuffer (qsci_transfer_handle_t *psHandle, uint8_t *pu8RxRingBuffer, uint16_t u16RxRingBufferSize) |
| Sets up the RX ring buffer. More...
|
|
void | QSCI_TransferStopRingBuffer (qsci_transfer_handle_t *psHandle) |
| Aborts the background transfer and uninstalls the ring buffer. More...
|
|
uint16_t | QSCI_TransferGetRxRingBufferLength (qsci_transfer_handle_t *psHandle) |
| Get the ring buffer valid data length. More...
|
|
status_t | QSCI_TransferSendNonBlocking (qsci_transfer_handle_t *psHandle, qsci_transfer_t *psTransfer) |
| Transmits a buffer of data using the interrupt method. More...
|
|
void | QSCI_TransferAbortSend (qsci_transfer_handle_t *psHandle) |
| Aborts the interrupt-driven data transmit. More...
|
|
status_t | QSCI_TransferGetSendCount (qsci_transfer_handle_t *psHandle, uint32_t *pu32Count) |
| Gets the number of bytes sent out to bus. More...
|
|
status_t | QSCI_TransferReceiveNonBlocking (qsci_transfer_handle_t *psHandle, qsci_transfer_t *psTransfer, size_t *pu32ReceivedBytes) |
| Receives a buffer of data using an interrupt method. More...
|
|
void | QSCI_TransferAbortReceive (qsci_transfer_handle_t *psHandle) |
| Aborts the interrupt-driven data receiving. More...
|
|
status_t | QSCI_TransferGetReceiveCount (qsci_transfer_handle_t *psHandle, uint32_t *pu32Count) |
| Gets the number of bytes that have been received. More...
|
|
bool qsci_config_t::bStopInWaitEnable |
bool qsci_config_t::bEnableStopHold |
uint8_t qsci_config_t::u8Interrupts |
uint32_t qsci_config_t::u32SrcClockHz |
struct _qsci_transfer_handle_t |
- Note
- If user wants to use the transactional API to transfer data in interrupt way, one QSCI instance should and can only be allocated one handle.
-
The handle is maintained by QSCI driver internally, which means the transfer state is retained and user shall not modify its state u8TxState or u8RxState in application level. If user only wish to use transactional APIs without understanding its machanism, it is not necessary to understand these members.
QSCI_Type* qsci_transfer_handle_t::base |
uint8_t* qsci_transfer_handle_t::pu8TxData |
volatile uint32_t qsci_transfer_handle_t::u32TxRemainingSize |
uint32_t qsci_transfer_handle_t::u32TxDataSize |
uint8_t* qsci_transfer_handle_t::pu8RxData |
volatile uint32_t qsci_transfer_handle_t::u32RxRemainingSize |
uint32_t qsci_transfer_handle_t::u32RxDataSize |
uint8_t* qsci_transfer_handle_t::pu8RxRingBuffer |
uint16_t qsci_transfer_handle_t::u16RxRingBufferSize |
volatile uint16_t qsci_transfer_handle_t::u16RxRingBufferHead |
volatile uint16_t qsci_transfer_handle_t::u16RxRingBufferTail |
void* qsci_transfer_handle_t::pUserData |
volatile uint8_t qsci_transfer_handle_t::u8TxState |
status_t qsci_transfer_handle_t::busStatus |
uint8_t* qsci_transfer_t::pu8Data |
uint32_t qsci_transfer_t::u32DataSize |
#define QSCI_RETRY_TIMES 0U /* Default defines to zero, driver keeps checking status flag untill it changes. */ |
#define QSCI_GET_BUS_STATUS |
( |
|
psHandle | ) |
(psHandle)->busStatus |
typedef void(* qsci_transfer_callback_t)(qsci_transfer_handle_t *psHandle) |
Defines the interface of user callback function used in QSCI interrupt transfer using transactional APIs. The callback function shall be defined and declared in application level by user. Before starting QSCI transmiting or receiving by calling QSCI_TransferSendNonBlocking or QSCI_TransferReceiveNonBlocking, call QSCI_TransferCreateHandle to install the user callback. When the transmiting or receiving ends or any bus error like hardware overrun occurs, user callback will be invoked by driver.
- Parameters
-
psHandle | Transfer handle that contains bus status, user data. |
Enumerator |
---|
kStatus_QSCI_TxBusy |
Transmitter is busy.
|
kStatus_QSCI_RxBusy |
Receiver is busy.
|
kStatus_QSCI_TxIdle |
Transmitter is idle.
|
kStatus_QSCI_RxIdle |
Receiver is idle.
|
kStatus_QSCI_FlagCannotClearManually |
Status flag can't be manually cleared.
|
kStatus_QSCI_RxRingBufferOverrun |
QSCI RX software ring buffer overrun.
|
kStatus_QSCI_RxHardwareOverrun |
QSCI receiver hardware overrun.
|
kStatus_QSCI_NoiseError |
QSCI noise error.
|
kStatus_QSCI_FramingError |
QSCI framing error.
|
kStatus_QSCI_ParityError |
QSCI parity error.
|
kStatus_QSCI_BaudrateNotSupport |
Baudrate is not supported in current clock source.
|
kStatus_QSCI_IdleLineDetected |
QSCI IDLE line detected.
|
kStatus_QSCI_Timeout |
Timeout happens when waiting for status flags to change.
|
These enumerations can be ORed together to form bit masks.
Enumerator |
---|
kQSCI_TxDataRegEmptyFlag |
TX data register empty flag.
|
kQSCI_TxIdleFlag |
Transmission idle flag.
|
kQSCI_RxDataRegFullFlag |
RX data register full flag.
|
kQSCI_RxIdleLineFlag |
Rx Idle line flag.
|
kQSCI_RxOverrunFlag |
RX overrun flag.
|
kQSCI_RxNoiseFlag |
RX detect noise on Rx input.
|
kQSCI_RxFrameErrorFlag |
Rx frame error flag, sets if logic 0 was detected for stop bit.
|
kQSCI_RxParityErrorFlag |
Rx parity error if parity enabled, sets upon parity error detection.
|
kQSCI_RxInputEdgeFlag |
RX pin active edge interrupt flag, sets when active edge detected.
|
kQSCI_LINSyncErrorFlag |
Only for LIN mode.
|
kQSCI_TxDMARequestFlag |
Tx DMA request is ongoing.
|
kQSCI_RxDMARequestFlag |
Rx DMA request is ongoing.
|
kQSCI_Group0Flags |
Members in kQSCI_Group0Flags can't be cleared by QSCI_ClearStatusFlags, they are handled by HW.
|
kQSCI_Group1Flags |
Whole kQSCI_Group1Flags will be cleared if trying to clear any member in kQSCI_Group1Flags or kQSCI_Group2Flags in the mask.
|
kQSCI_Group2Flags |
Member in kQSCI_Group2Flags can be cleared individually.
|
These enumerations can be ORed together to form bit masks.
Enumerator |
---|
kQSCI_TxEmptyInterruptEnable |
Transmit data register empty interrupt.
|
kQSCI_TxIdleInterruptEnable |
Transmission idle interrupt.
|
kQSCI_RxFullInterruptEnable |
Receive data register full interrupt.
|
kQSCI_RxErrorInterruptEnable |
Receive error interrupt.
|
kQSCI_RxInputEdgeInterruptEnable |
Receive input edge interrupt.
|
kQSCI_RxIdleLineInterruptEnable |
Receive idle interrupt.
|
Enumerator |
---|
kQSCI_Normal |
Normal mode, 2 signal pins, no loop.
|
kQSCI_LoopInternal |
Loop mode with internal TXD fed back to RXD.
|
kQSCI_SingleWire |
Use tx pin as input and output half-duplex transfer.
|
Enumerator |
---|
kQSCI_Data8Bit |
1 start bit, 8 data bit, 1 stop bit
|
kQSCI_Data9Bit |
1 start bit, 9 data bit, 1 stop bit.
This mode actually is not supported yet in driver.
|
Enumerator |
---|
kQSCI_WakeupOnIdleLine |
Idle condition wakes the QSCI module.
|
kQSCI_WakeupOnAddressMark |
Address mark wakes the QSCI module.
|
Enumerator |
---|
kQSCI_PolarityNormal |
Normal mode, no inversion.
|
kQSCI_PolarityInvert |
Invert transmit and receive data bits.
|
Enumerator |
---|
kQSCI_ParityDisabled |
Parity disabled.
|
kQSCI_ParityEven |
Parity enabled, type even, bit setting: PE|PT = 10.
|
kQSCI_ParityOdd |
Parity enabled, type odd, bit setting: PE|PT = 11.
|
Enumerator |
---|
kQSCI_TxWater0Word |
Tx interrupt sets when tx fifo empty.
|
kQSCI_TxWater1Word |
Tx interrupt sets when tx fifo has 1 or few word.
|
kQSCI_TxWater2Word |
Tx interrupt sets when tx fifo has 2 or few words.
|
kQSCI_TxWater3Word |
Tx interrupt sets when tx fifo not full.
|
Enumerator |
---|
kQSCI_RxWater1Word |
Rx interrupt sets when rx fifo not empty.
|
kQSCI_RxWater2Word |
Rx interrupt sets when rx fifo has at least 1 word.
|
kQSCI_RxWater3Word |
Rx interrupt sets when rx fifo has at least 2 words.
|
kQSCI_RxWater4Word |
Rx interrupt sets when rx fifo full.
|
void QSCI_GetDefaultConfig |
( |
qsci_config_t * |
psConfig, |
|
|
uint32_t |
u32BaudRateBps, |
|
|
uint32_t |
u32SrcClockHz |
|
) |
| |
The purpose of this API is to initialize the configuration structure to default value for QSCI_Init to use. Use the unchanged structure in QSCI_Init or modify the structure before calling QSCI_Init. This is an example:
- Parameters
-
psConfig | Pointer to configuration structure. |
u32BaudRateBps | Baudrate setting. |
u32SrcClockHz | The clock source frequency for QSCI module. |
This function configures the QSCI module with the customed settings. User can configure the configuration structure manually or get the default configuration by using the QSCI_GetDefaultConfig function. The example below shows how to use this API to configure QSCI.
- Parameters
-
base | QSCI peripheral base address. |
psConfig | Pointer to the user-defined configuration structure. |
- Return values
-
kStatus_QSCI_BaudrateNotSupport | Baudrate is not supported in the current clock source. |
kStatus_Success | Set baudrate succeeded. |
void QSCI_Deinit |
( |
QSCI_Type * |
base | ) |
|
This function waits for transmiting complete, then disables TX and RX.
- Parameters
-
base | QSCI peripheral base address. |
static uint16_t QSCI_GetStatusFlags |
( |
QSCI_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | QSCI peripheral base address. |
- Returns
- QSCI status flags, can be a single flag or several flags in _qsci_status_flags combined by OR.
void QSCI_ClearStatusFlags |
( |
QSCI_Type * |
base, |
|
|
uint16_t |
u16StatusFlags |
|
) |
| |
This function clears QSCI status flags. Members in kQSCI_Group0Flags can't be cleared by this function, they are cleared or set by hardware.
- Parameters
-
base | QSCI peripheral base address. |
u16StatusFlags | The status flag mask, can be a single flag or several flags in _qsci_status_flags combined by OR. |
void QSCI_EnableInterrupts |
( |
QSCI_Type * |
base, |
|
|
uint8_t |
u8Interrupts |
|
) |
| |
This function enables the QSCI interrupts according to the provided mask. The mask is a logical OR of enumeration members in _qsci_interrupt_enable.
- Parameters
-
base | QSCI peripheral base address. |
u8Interrupts | The interrupt source mask, can be a single source or several sources in _qsci_interrupt_enable combined by OR. |
void QSCI_DisableInterrupts |
( |
QSCI_Type * |
base, |
|
|
uint8_t |
u8Interrupts |
|
) |
| |
This function disables the QSCI interrupts according to the provided mask. The mask is a logical OR of enumeration members in _qsci_interrupt_enable.
- Parameters
-
base | QSCI peripheral base address. |
u8Interrupts | The interrupt source mask, can be a single source or several sources in _qsci_interrupt_enable combined by OR. |
uint8_t QSCI_GetEnabledInterrupts |
( |
QSCI_Type * |
base | ) |
|
This function gets the enabled QSCI interrupts. The enabled interrupts are returned as the logical OR value of the enumerators _qsci_interrupt_enable.
- Parameters
-
base | QSCI peripheral base address. |
- Returns
- The interrupt source mask, can be a single source or several sources in _qsci_interrupt_enable combined by OR.
static void QSCI_Reset |
( |
QSCI_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | QSCI peripheral base address. |
static void QSCI_EnableTx |
( |
QSCI_Type * |
base, |
|
|
bool |
bEnable |
|
) |
| |
|
inlinestatic |
This function enables or disables the QSCI transmitter.
- Parameters
-
base | QSCI peripheral base address. |
bEnable | True to enable, false to disable. |
static void QSCI_EnableRx |
( |
QSCI_Type * |
base, |
|
|
bool |
bEnable |
|
) |
| |
|
inlinestatic |
This function enables or disables the QSCI receiver.
- Parameters
-
base | QSCI peripheral base address. |
bEnable | True to enable, false to disable. |
static void QSCI_EnableStopInWait |
( |
QSCI_Type * |
base, |
|
|
bool |
bEnable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | QSCI peripheral base address. |
bEnable | true to enable, QSCI stops working in wait mode, false to disable, QSCI keeps working in wait mode |
static void QSCI_Enable9bitMode |
( |
QSCI_Type * |
base, |
|
|
bool |
bEnable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | QSCI peripheral base address. |
bEnable | true to enable, false to disable. |
static void QSCI_EnableStandbyMode |
( |
QSCI_Type * |
base, |
|
|
bool |
bEnable |
|
) |
| |
|
inlinestatic |
When QSCI is in standby mode, further receiver interrupt requests are inhibited waiting to be wake up. The wakeup mode can be configured by QSCI_SetWakeupMode. Hardware wakes the receiver by automatically disabling standby.
- Parameters
-
base | QSCI peripheral base address. |
bEnable | true to enable, false to disable. |
static void QSCI_EnableLINSlaveMode |
( |
QSCI_Type * |
base, |
|
|
bool |
bEnable |
|
) |
| |
|
inlinestatic |
If enabled QSCI is in LIN slave mode. When break is detected, the baudrate register is automatically adjusted to match the value measured from the sync character that follows.
- Parameters
-
base | QSCI peripheral base address. |
bEnable | true to enable, false to disable. |
static void QSCI_EnableStopHold |
( |
QSCI_Type * |
base, |
|
|
bool |
bEnable |
|
) |
| |
|
inlinestatic |
When enabled, if chip level stop mode occurs and transmiter or receiver is still busy, QSCI will hold off stop mode until both transmiter and receiver are idle.
- Parameters
-
base | QSCI peripheral base address. |
bEnable | true to enable, false to disable. |
- Parameters
-
base | QSCI peripheral base address. |
eTransferMode | The QSCI tx/rx loop mode, kQSCI_Normal to use normal transfer, kQSCI_LoopInternal to let internal tx feed back to rx, kQSCI_SingleWire to use single wire mode using tx pin as tx and rx. |
status_t QSCI_SetBaudRate |
( |
QSCI_Type * |
base, |
|
|
uint32_t |
u32BaudRateBps, |
|
|
uint32_t |
u32SrcClockHz |
|
) |
| |
This function configures the QSCI module baud rate. This function can be used to update QSCI module baud rate after the QSCI module is initialized by the QSCI_Init.
- Parameters
-
base | QSCI peripheral base address. |
u32BaudRateBps | QSCI baudrate to be set. |
u32SrcClockHz | QSCI clock source frequency in Hz. |
- Return values
-
kStatus_QSCI_BaudrateNotSupport | Baudrate is not supported in the current clock source. |
kStatus_Success | Set baudrate succeeded. |
static void QSCI_EnableFifo |
( |
QSCI_Type * |
base, |
|
|
bool |
bEnable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | QSCI peripheral base address. |
bEnable | true to enable, false to disable. |
static void QSCI_SetTxWaterMark |
( |
QSCI_Type * |
base, |
|
|
qsci_tx_water_t |
eTxFifoWatermark |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | QSCI peripheral base address. |
eTxFifoWatermark | Tx water mark level. |
static void QSCI_SetRxWaterMark |
( |
QSCI_Type * |
base, |
|
|
qsci_rx_water_t |
eRxFifoWatermark |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | QSCI peripheral base address. |
eRxFifoWatermark | Rx water mark level. |
static void QSCI_EnableTxDMA |
( |
QSCI_Type * |
base, |
|
|
bool |
bEnable |
|
) |
| |
|
inlinestatic |
This function enables or disables CTRL2[TDE], to generate the DMA requests when Tx data register is empty.
- Parameters
-
base | QSCI peripheral base address. |
bEnable | True to enable, false to disable. |
static void QSCI_EnableRxDMA |
( |
QSCI_Type * |
base, |
|
|
bool |
bEnable |
|
) |
| |
|
inlinestatic |
This function enables or disables CTRL2[RDE], to generate DMA requests when receiver data register is full.
- Parameters
-
base | QSCI peripheral base address. |
bEnable | True to enable, false to disable. |
static uint32_t QSCI_GetDataRegisterAddress |
( |
QSCI_Type * |
base | ) |
|
|
inlinestatic |
This function returns the QSCI data register address, which is mainly used by DMA/eDMA.
- Parameters
-
base | QSCI peripheral base address. |
- Returns
- QSCI data register byte addresses which are used both by the transmitter and the receiver.
static void QSCI_WriteByte |
( |
QSCI_Type * |
base, |
|
|
uint8_t |
u8Data |
|
) |
| |
|
inlinestatic |
This function writes data to the TX register directly. The upper layer must ensure that the TX register is empty or TX FIFO has room before calling this function.
- Parameters
-
base | QSCI peripheral base address. |
u8Data | The byte to write. |
static void QSCI_SendAddress |
( |
QSCI_Type * |
base, |
|
|
uint8_t |
u8Address |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | QSCI peripheral base address. |
u8Address | QSCI slave address. |
static uint8_t QSCI_ReadByte |
( |
QSCI_Type * |
base | ) |
|
|
inlinestatic |
This function reads data from the RX register directly. The upper layer must ensure that the RX register is full or that the TX FIFO has data before calling this function.
- Parameters
-
base | QSCI peripheral base address. |
- Returns
- The byte read from QSCI data register.
void QSCI_WriteBlocking |
( |
QSCI_Type * |
base, |
|
|
const uint8_t * |
pu8Data, |
|
|
uint32_t |
u32Length |
|
) |
| |
This function polls the TX register, waits TX register to be empty or TX FIFO have room then writes data to the TX buffer.
- Parameters
-
base | QSCI peripheral base address. |
pu8Data | Start address of the data to write. |
u32Length | Size of the data to write. |
status_t QSCI_ReadBlocking |
( |
QSCI_Type * |
base, |
|
|
uint8_t * |
pu8Data, |
|
|
uint32_t |
u32Length |
|
) |
| |
This function polls the RX register, waits RX register to be full or RX FIFO have data, then reads data from the RX register.
- Parameters
-
base | QSCI peripheral base address. |
pu8Data | Start address of the buffer to store the received data. |
u32Length | Size of the buffer. |
- Return values
-
kStatus_Fail | Receiver error occurred while receiving data. |
kStatus_QSCI_RxHardwareOverrun | Receiver overrun occurred while receiving data |
kStatus_QSCI_NoiseError | Noise error occurred while receiving data |
kStatus_QSCI_FramingErrorFraming | error occurred while receiving data |
kStatus_QSCI_ParityError | Parity error occurred while receiving data |
kStatus_Success | Successfully received all data. |
static void QSCI_SendBreak |
( |
QSCI_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | QSCI peripheral base address. |
void QSCI_TransferCreateHandle |
( |
QSCI_Type * |
base, |
|
|
qsci_transfer_handle_t * |
psHhandle, |
|
|
qsci_transfer_callback_t |
pfCallback, |
|
|
void * |
pUserData |
|
) |
| |
This function initializes the QSCI handle which can be used for other QSCI transactional APIs. Usually, for a specified QSCI instance, call this API once to get the initialized handle.
- Parameters
-
base | QSCI peripheral base address. |
psHhandle | QSCI handle pointer. |
pfCallback | The callback function. |
pUserData | The parameter of the callback function. |
void QSCI_TransferStartRingBuffer |
( |
qsci_transfer_handle_t * |
psHandle, |
|
|
uint8_t * |
pu8RxRingBuffer, |
|
|
uint16_t |
u16RxRingBufferSize |
|
) |
| |
This function sets up the RX ring buffer to a specific QSCI handle.
When the RX ring buffer is used, data received are stored into the ring buffer even when the user doesn't call the QSCI_TransferReceiveNonBlocking() API. If data is already received in the ring buffer, the user can get the received data from the ring buffer directly.
- Note
- When using the RX ring buffer, one byte is reserved for internal use. In other words, if
ringBufferSize
is 32, only 31 bytes are used for saving data.
- Parameters
-
psHandle | QSCI handle pointer. |
pu8RxRingBuffer | Start address of the ring buffer for background receiving. Pass NULL to disable the ring buffer. |
u16RxRingBufferSize | Size of the ring buffer. |
void QSCI_TransferStopRingBuffer |
( |
qsci_transfer_handle_t * |
psHandle | ) |
|
This function aborts the background transfer and uninstalls the ring buffer.
- Parameters
-
psHandle | QSCI handle pointer. |
uint16_t QSCI_TransferGetRxRingBufferLength |
( |
qsci_transfer_handle_t * |
psHandle | ) |
|
- Parameters
-
psHandle | QSCI handle pointer. |
- Returns
- Valid data length in ring buffer.
This function sends data using an interrupt method. This is a non-blocking function, which returns directly without waiting for all data to be written to the TX register. When all data is sent out, the QSCI driver calls the callback function and passes the kStatus_QSCI_TxIdle as status parameter.
- Parameters
-
psHandle | QSCI handle pointer. |
psTransfer | QSCI transfer structure. See qsci_transfer_t. |
- Return values
-
kStatus_Success | Successfully start the data transmission. |
kStatus_QSCI_TxBusy | Previous transmission still not finished; data not all written to TX register yet. |
void QSCI_TransferAbortSend |
( |
qsci_transfer_handle_t * |
psHandle | ) |
|
This function aborts the interrupt-driven data sending. The user can get the remainBytes to find out how many bytes are not sent out.
- Parameters
-
psHandle | QSCI handle pointer. |
status_t QSCI_TransferGetSendCount |
( |
qsci_transfer_handle_t * |
psHandle, |
|
|
uint32_t * |
pu32Count |
|
) |
| |
This function gets the number of bytes sent out to bus by using the interrupt method.
- Parameters
-
psHandle | QSCI handle pointer. |
pu32Count | Send bytes count. |
- Return values
-
kStatus_NoTransferInProgress | No send in progress. |
kStatus_Success | Get successfully through the parameter count ; |
status_t QSCI_TransferReceiveNonBlocking |
( |
qsci_transfer_handle_t * |
psHandle, |
|
|
qsci_transfer_t * |
psTransfer, |
|
|
size_t * |
pu32ReceivedBytes |
|
) |
| |
This function receives data using an interrupt method. This is a non-blocking function, which returns without waiting for all data to be received. If the RX ring buffer is used and not empty, the data in the ring buffer is copied and the parameter pu32ReceivedBytes
shows how many bytes are copied from the ring buffer. After copying, if the data in the ring buffer is not enough to read, the receive request is saved by the QSCI driver. When the new data arrives, the receive request is serviced first. When all data is received, the QSCI driver notifies the upper layer through a callback function and passes the status parameter kStatus_QSCI_RxIdle. For example, the upper layer needs 10 bytes but there are only 5 bytes in the ring buffer. The 5 bytes are copied to the psTransfer->data and this function returns with the parameter pu32ReceivedBytes
set to 5. For the left 5 bytes, newly arrived data is saved from the psTransfer->data[5]. When 5 bytes are received, the QSCI driver notifies the upper layer. If the RX ring buffer is not enabled, this function enables the RX and RX interrupt to receive data to the psTransfer->data. When all data is received, the upper layer is notified.
- Parameters
-
psHandle | QSCI handle pointer. |
psTransfer | QSCI transfer structure, see qsci_transfer_t. |
pu32ReceivedBytes | Bytes received from the ring buffer directly. |
- Return values
-
kStatus_Success | Successfully queue the transfer into transmit queue. |
kStatus_QSCI_RxBusy | Previous receive request is not finished. |
void QSCI_TransferAbortReceive |
( |
qsci_transfer_handle_t * |
psHandle | ) |
|
This function aborts the interrupt-driven data receiving. The user can get the remainBytes to know how many bytes are not received yet.
- Parameters
-
psHandle | QSCI handle pointer. |
status_t QSCI_TransferGetReceiveCount |
( |
qsci_transfer_handle_t * |
psHandle, |
|
|
uint32_t * |
pu32Count |
|
) |
| |
This function gets the number of bytes that have been received.
- Parameters
-
psHandle | QSCI handle pointer. |
pu32Count | Receive bytes count. |
- Return values
-
kStatus_NoTransferInProgress | No receive in progress. |
kStatus_InvalidArgument | Parameter is invalid. |
kStatus_Success | Get successfully through the parameter pu32Count ; |
uint16_t QSCI_GetInstance |
( |
QSCI_Type * |
base | ) |
|
- Parameters
-
base | QSCI peripheral base address. |
- Returns
- QSCI instance.