RTEMS 6.1-rc2
|
Data Structures | |
struct | _spdif_config |
SPDIF user configuration structure. More... | |
struct | _spdif_transfer |
SPDIF transfer structure. More... | |
struct | _spdif_handle |
SPDIF handle structure. More... | |
Driver version | |
enum | { kStatus_SPDIF_RxDPLLLocked = MAKE_STATUS(kStatusGroup_SPDIF, 0) , kStatus_SPDIF_TxFIFOError = MAKE_STATUS(kStatusGroup_SPDIF, 1) , kStatus_SPDIF_TxFIFOResync = MAKE_STATUS(kStatusGroup_SPDIF, 2) , kStatus_SPDIF_RxCnew = MAKE_STATUS(kStatusGroup_SPDIF, 3) , kStatus_SPDIF_ValidatyNoGood = MAKE_STATUS(kStatusGroup_SPDIF, 4) , kStatus_SPDIF_RxIllegalSymbol = MAKE_STATUS(kStatusGroup_SPDIF, 5) , kStatus_SPDIF_RxParityBitError = MAKE_STATUS(kStatusGroup_SPDIF, 6) , kStatus_SPDIF_UChannelOverrun = MAKE_STATUS(kStatusGroup_SPDIF, 7) , kStatus_SPDIF_QChannelOverrun = MAKE_STATUS(kStatusGroup_SPDIF, 8) , kStatus_SPDIF_UQChannelSync = MAKE_STATUS(kStatusGroup_SPDIF, 9) , kStatus_SPDIF_UQChannelFrameError = MAKE_STATUS(kStatusGroup_SPDIF, 10) , kStatus_SPDIF_RxFIFOError = MAKE_STATUS(kStatusGroup_SPDIF, 11) , kStatus_SPDIF_RxFIFOResync = MAKE_STATUS(kStatusGroup_SPDIF, 12) , kStatus_SPDIF_LockLoss = MAKE_STATUS(kStatusGroup_SPDIF, 13) , kStatus_SPDIF_TxIdle = MAKE_STATUS(kStatusGroup_SPDIF, 14) , kStatus_SPDIF_RxIdle = MAKE_STATUS(kStatusGroup_SPDIF, 15) , kStatus_SPDIF_QueueFull = MAKE_STATUS(kStatusGroup_SPDIF, 16) } |
SPDIF return status. More... | |
enum | _spdif_rxfull_select { kSPDIF_RxFull1Sample = 0x0u , kSPDIF_RxFull4Samples , kSPDIF_RxFull8Samples , kSPDIF_RxFull16Samples } |
SPDIF Rx FIFO full falg select, it decides when assert the rx full flag. More... | |
enum | _spdif_txempty_select { kSPDIF_TxEmpty0Sample = 0x0u , kSPDIF_TxEmpty4Samples , kSPDIF_TxEmpty8Samples , kSPDIF_TxEmpty12Samples } |
SPDIF tx FIFO EMPTY falg select, it decides when assert the tx empty flag. More... | |
enum | _spdif_uchannel_source { kSPDIF_NoUChannel = 0x0U , kSPDIF_UChannelFromRx = 0x1U , kSPDIF_UChannelFromTx = 0x3U } |
SPDIF U channel source. More... | |
enum | _spdif_gain_select { kSPDIF_GAIN_24 = 0x0U , kSPDIF_GAIN_16 , kSPDIF_GAIN_12 , kSPDIF_GAIN_8 , kSPDIF_GAIN_6 , kSPDIF_GAIN_4 , kSPDIF_GAIN_3 } |
SPDIF clock gain. More... | |
enum | _spdif_tx_source { kSPDIF_txFromReceiver = 0x1U , kSPDIF_txNormal = 0x5U } |
SPDIF tx data source. More... | |
enum | _spdif_validity_config { kSPDIF_validityFlagAlwaysSet = 0x0U , kSPDIF_validityFlagAlwaysClear } |
SPDIF tx data source. More... | |
enum | { kSPDIF_RxDPLLLocked = SPDIF_SIE_LOCK_MASK , kSPDIF_TxFIFOError = SPDIF_SIE_TXUNOV_MASK , kSPDIF_TxFIFOResync = SPDIF_SIE_TXRESYN_MASK , kSPDIF_RxControlChannelChange = SPDIF_SIE_CNEW_MASK , kSPDIF_ValidityFlagNoGood = SPDIF_SIE_VALNOGOOD_MASK , kSPDIF_RxIllegalSymbol = SPDIF_SIE_SYMERR_MASK , kSPDIF_RxParityBitError = SPDIF_SIE_BITERR_MASK , kSPDIF_UChannelReceiveRegisterFull = SPDIF_SIE_URXFUL_MASK , kSPDIF_UChannelReceiveRegisterOverrun = SPDIF_SIE_URXOV_MASK , kSPDIF_QChannelReceiveRegisterFull = SPDIF_SIE_QRXFUL_MASK , kSPDIF_QChannelReceiveRegisterOverrun = SPDIF_SIE_QRXOV_MASK , kSPDIF_UQChannelSync = SPDIF_SIE_UQSYNC_MASK , kSPDIF_UQChannelFrameError = SPDIF_SIE_UQERR_MASK , kSPDIF_RxFIFOError = SPDIF_SIE_RXFIFOUNOV_MASK , kSPDIF_RxFIFOResync = SPDIF_SIE_RXFIFORESYN_MASK , kSPDIF_LockLoss = SPDIF_SIE_LOCKLOSS_MASK , kSPDIF_TxFIFOEmpty = SPDIF_SIE_TXEM_MASK , kSPDIF_RxFIFOFull = SPDIF_SIE_RXFIFOFUL_MASK , kSPDIF_AllInterrupt } |
The SPDIF interrupt enable flag. More... | |
enum | { kSPDIF_RxDMAEnable = SPDIF_SCR_DMA_RX_EN_MASK , kSPDIF_TxDMAEnable = SPDIF_SCR_DMA_TX_EN_MASK } |
The DMA request sources. More... | |
typedef enum _spdif_rxfull_select | spdif_rxfull_select_t |
SPDIF Rx FIFO full falg select, it decides when assert the rx full flag. | |
typedef enum _spdif_txempty_select | spdif_txempty_select_t |
SPDIF tx FIFO EMPTY falg select, it decides when assert the tx empty flag. | |
typedef enum _spdif_uchannel_source | spdif_uchannel_source_t |
SPDIF U channel source. | |
typedef enum _spdif_gain_select | spdif_gain_select_t |
SPDIF clock gain. | |
typedef enum _spdif_tx_source | spdif_tx_source_t |
SPDIF tx data source. | |
typedef enum _spdif_validity_config | spdif_validity_config_t |
SPDIF tx data source. | |
typedef struct _spdif_config | spdif_config_t |
SPDIF user configuration structure. | |
typedef struct _spdif_transfer | spdif_transfer_t |
SPDIF transfer structure. | |
typedef struct _spdif_handle | spdif_handle_t |
typedef void(* | spdif_transfer_callback_t) (SPDIF_Type *base, spdif_handle_t *handle, status_t status, void *userData) |
SPDIF transfer callback prototype. | |
#define | FSL_SPDIF_DRIVER_VERSION (MAKE_VERSION(2, 0, 6)) |
#define | SPDIF_XFER_QUEUE_SIZE (4U) |
SPDIF transfer queue size, user can refine it according to use case. | |
Initialization and deinitialization | |
void | SPDIF_Init (SPDIF_Type *base, const spdif_config_t *config) |
Initializes the SPDIF peripheral. | |
void | SPDIF_GetDefaultConfig (spdif_config_t *config) |
Sets the SPDIF configuration structure to default values. | |
void | SPDIF_Deinit (SPDIF_Type *base) |
De-initializes the SPDIF peripheral. | |
uint32_t | SPDIF_GetInstance (SPDIF_Type *base) |
Get the instance number for SPDIF. | |
void | SPDIF_TxEnable (SPDIF_Type *base, bool enable) |
Enables/disables the SPDIF Tx. | |
Bus Operations | |
void | SPDIF_TxSetSampleRate (SPDIF_Type *base, uint32_t sampleRate_Hz, uint32_t sourceClockFreq_Hz) |
Configures the SPDIF Tx sample rate. | |
uint32_t | SPDIF_GetRxSampleRate (SPDIF_Type *base, uint32_t clockSourceFreq_Hz) |
Configures the SPDIF Rx audio format. | |
void | SPDIF_WriteBlocking (SPDIF_Type *base, uint8_t *buffer, uint32_t size) |
Sends data using a blocking method. | |
void | SPDIF_ReadBlocking (SPDIF_Type *base, uint8_t *buffer, uint32_t size) |
Receives data using a blocking method. | |
Transactional | |
void | SPDIF_TransferTxCreateHandle (SPDIF_Type *base, spdif_handle_t *handle, spdif_transfer_callback_t callback, void *userData) |
Initializes the SPDIF Tx handle. | |
void | SPDIF_TransferRxCreateHandle (SPDIF_Type *base, spdif_handle_t *handle, spdif_transfer_callback_t callback, void *userData) |
Initializes the SPDIF Rx handle. | |
status_t | SPDIF_TransferSendNonBlocking (SPDIF_Type *base, spdif_handle_t *handle, spdif_transfer_t *xfer) |
Performs an interrupt non-blocking send transfer on SPDIF. | |
status_t | SPDIF_TransferReceiveNonBlocking (SPDIF_Type *base, spdif_handle_t *handle, spdif_transfer_t *xfer) |
Performs an interrupt non-blocking receive transfer on SPDIF. | |
status_t | SPDIF_TransferGetSendCount (SPDIF_Type *base, spdif_handle_t *handle, size_t *count) |
Gets a set byte count. | |
status_t | SPDIF_TransferGetReceiveCount (SPDIF_Type *base, spdif_handle_t *handle, size_t *count) |
Gets a received byte count. | |
void | SPDIF_TransferAbortSend (SPDIF_Type *base, spdif_handle_t *handle) |
Aborts the current send. | |
void | SPDIF_TransferAbortReceive (SPDIF_Type *base, spdif_handle_t *handle) |
Aborts the current IRQ receive. | |
void | SPDIF_TransferTxHandleIRQ (SPDIF_Type *base, spdif_handle_t *handle) |
Tx interrupt handler. | |
void | SPDIF_TransferRxHandleIRQ (SPDIF_Type *base, spdif_handle_t *handle) |
Tx interrupt handler. | |
#define FSL_SPDIF_DRIVER_VERSION (MAKE_VERSION(2, 0, 6)) |
Version 2.0.6
anonymous enum |
SPDIF return status.
anonymous enum |
The SPDIF interrupt enable flag.
anonymous enum |
enum _spdif_gain_select |
enum _spdif_rxfull_select |
SPDIF Rx FIFO full falg select, it decides when assert the rx full flag.
enum _spdif_tx_source |
SPDIF tx FIFO EMPTY falg select, it decides when assert the tx empty flag.
void SPDIF_Deinit | ( | SPDIF_Type * | base | ) |
De-initializes the SPDIF peripheral.
This API gates the SPDIF clock. The SPDIF module can't operate unless SPDIF_Init is called to enable the clock.
base | SPDIF base pointer |
brief De-initializes the SPDIF peripheral.
This API gates the SPDIF clock. The SPDIF module can't operate unless SPDIF_Init is called to enable the clock.
param base SPDIF base pointer
void SPDIF_GetDefaultConfig | ( | spdif_config_t * | config | ) |
Sets the SPDIF configuration structure to default values.
This API initializes the configuration structure for use in SPDIF_Init. The initialized structure can remain unchanged in SPDIF_Init, or it can be modified before calling SPDIF_Init. This is an example.
config | pointer to master configuration structure |
brief Sets the SPDIF configuration structure to default values.
This API initializes the configuration structure for use in SPDIF_Init. The initialized structure can remain unchanged in SPDIF_Init, or it can be modified before calling SPDIF_Init. This is an example. code spdif_config_t config; SPDIF_GetDefaultConfig(&config); endcode
param config pointer to master configuration structure
uint32_t SPDIF_GetInstance | ( | SPDIF_Type * | base | ) |
Get the instance number for SPDIF.
base | SPDIF base pointer. |
uint32_t SPDIF_GetRxSampleRate | ( | SPDIF_Type * | base, |
uint32_t | clockSourceFreq_Hz | ||
) |
Configures the SPDIF Rx audio format.
The audio format can be changed at run-time. This function configures the sample rate and audio data format to be transferred.
base | SPDIF base pointer. |
clockSourceFreq_Hz | SPDIF system clock frequency in hz. |
brief Configures the SPDIF Rx audio format.
The audio format can be changed at run-time. This function configures the sample rate and audio data format to be transferred.
param base SPDIF base pointer. param clockSourceFreq_Hz SPDIF system clock frequency in hz.
void SPDIF_Init | ( | SPDIF_Type * | base, |
const spdif_config_t * | config | ||
) |
Initializes the SPDIF peripheral.
Ungates the SPDIF clock, resets the module, and configures SPDIF with a configuration structure. The configuration structure can be custom filled or set with default values by SPDIF_GetDefaultConfig().
base | SPDIF base pointer |
config | SPDIF configuration structure. |
brief Initializes the SPDIF peripheral.
Ungates the SPDIF clock, resets the module, and configures SPDIF with a configuration structure. The configuration structure can be custom filled or set with default values by SPDIF_GetDefaultConfig().
note This API should be called at the beginning of the application to use the SPDIF driver. Otherwise, accessing the SPDIF module can cause a hard fault because the clock is not enabled.
param base SPDIF base pointer param config SPDIF configuration structure.
void SPDIF_ReadBlocking | ( | SPDIF_Type * | base, |
uint8_t * | buffer, | ||
uint32_t | size | ||
) |
Receives data using a blocking method.
base | SPDIF base pointer. |
buffer | Pointer to the data to be read. |
size | Bytes to be read. |
brief Receives data using a blocking method.
note This function blocks by polling until data is ready to be sent.
param base SPDIF base pointer. param buffer Pointer to the data to be read. param size Bytes to be read.
void SPDIF_TransferAbortReceive | ( | SPDIF_Type * | base, |
spdif_handle_t * | handle | ||
) |
Aborts the current IRQ receive.
base | SPDIF base pointer |
handle | Pointer to the spdif_handle_t structure which stores the transfer state. |
brief Aborts the current IRQ receive.
note This API can be called when an interrupt non-blocking transfer initiates to abort the transfer early.
param base SPDIF base pointer param handle Pointer to the spdif_handle_t structure which stores the transfer state.
void SPDIF_TransferAbortSend | ( | SPDIF_Type * | base, |
spdif_handle_t * | handle | ||
) |
Aborts the current send.
base | SPDIF base pointer. |
handle | Pointer to the spdif_handle_t structure which stores the transfer state. |
brief Aborts the current send.
note This API can be called any time when an interrupt non-blocking transfer initiates to abort the transfer early.
param base SPDIF base pointer. param handle Pointer to the spdif_handle_t structure which stores the transfer state.
status_t SPDIF_TransferGetReceiveCount | ( | SPDIF_Type * | base, |
spdif_handle_t * | handle, | ||
size_t * | count | ||
) |
Gets a received byte count.
base | SPDIF base pointer. |
handle | Pointer to the spdif_handle_t structure which stores the transfer state. |
count | Bytes count received. |
kStatus_Success | Succeed get the transfer count. |
kStatus_NoTransferInProgress | There is not a non-blocking transaction currently in progress. |
brief Gets a received byte count.
param base SPDIF base pointer. param handle Pointer to the spdif_handle_t structure which stores the transfer state. param count Bytes count received. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress.
status_t SPDIF_TransferGetSendCount | ( | SPDIF_Type * | base, |
spdif_handle_t * | handle, | ||
size_t * | count | ||
) |
Gets a set byte count.
base | SPDIF base pointer. |
handle | Pointer to the spdif_handle_t structure which stores the transfer state. |
count | Bytes count sent. |
kStatus_Success | Succeed get the transfer count. |
kStatus_NoTransferInProgress | There is not a non-blocking transaction currently in progress. |
brief Gets a set byte count.
param base SPDIF base pointer. param handle Pointer to the spdif_handle_t structure which stores the transfer state. param count Bytes count sent. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress.
status_t SPDIF_TransferReceiveNonBlocking | ( | SPDIF_Type * | base, |
spdif_handle_t * | handle, | ||
spdif_transfer_t * | xfer | ||
) |
Performs an interrupt non-blocking receive transfer on SPDIF.
base | SPDIF base pointer |
handle | Pointer to the spdif_handle_t structure which stores the transfer state. |
xfer | Pointer to the spdif_transfer_t structure. |
kStatus_Success | Successfully started the data receive. |
kStatus_SPDIF_RxBusy | Previous receive still not finished. |
kStatus_InvalidArgument | The input parameter is invalid. |
brief Performs an interrupt non-blocking receive transfer on SPDIF.
note This API returns immediately after the transfer initiates. Call the SPDIF_RxGetTransferStatusIRQ to poll the transfer status and check whether the transfer is finished. If the return status is not kStatus_SPDIF_Busy, the transfer is finished.
param base SPDIF base pointer param handle Pointer to the spdif_handle_t structure which stores the transfer state. param xfer Pointer to the spdif_transfer_t structure. retval kStatus_Success Successfully started the data receive. retval kStatus_SPDIF_RxBusy Previous receive still not finished. retval kStatus_InvalidArgument The input parameter is invalid.
void SPDIF_TransferRxCreateHandle | ( | SPDIF_Type * | base, |
spdif_handle_t * | handle, | ||
spdif_transfer_callback_t | callback, | ||
void * | userData | ||
) |
Initializes the SPDIF Rx handle.
This function initializes the Rx handle for the SPDIF Rx transactional APIs. Call this function once to get the handle initialized.
base | SPDIF base pointer. |
handle | SPDIF handle pointer. |
callback | Pointer to the user callback function. |
userData | User parameter passed to the callback function. |
brief Initializes the SPDIF Rx handle.
This function initializes the Rx handle for the SPDIF Rx transactional APIs. Call this function once to get the handle initialized.
param base SPDIF base pointer. param handle SPDIF handle pointer. param callback Pointer to the user callback function. param userData User parameter passed to the callback function.
void SPDIF_TransferRxHandleIRQ | ( | SPDIF_Type * | base, |
spdif_handle_t * | handle | ||
) |
Tx interrupt handler.
base | SPDIF base pointer. |
handle | Pointer to the spdif_handle_t structure. |
brief Tx interrupt handler.
param base SPDIF base pointer. param handle Pointer to the spdif_handle_t structure.
status_t SPDIF_TransferSendNonBlocking | ( | SPDIF_Type * | base, |
spdif_handle_t * | handle, | ||
spdif_transfer_t * | xfer | ||
) |
Performs an interrupt non-blocking send transfer on SPDIF.
base | SPDIF base pointer. |
handle | Pointer to the spdif_handle_t structure which stores the transfer state. |
xfer | Pointer to the spdif_transfer_t structure. |
kStatus_Success | Successfully started the data receive. |
kStatus_SPDIF_TxBusy | Previous receive still not finished. |
kStatus_InvalidArgument | The input parameter is invalid. |
brief Performs an interrupt non-blocking send transfer on SPDIF.
note This API returns immediately after the transfer initiates. Call the SPDIF_TxGetTransferStatusIRQ to poll the transfer status and check whether the transfer is finished. If the return status is not kStatus_SPDIF_Busy, the transfer is finished.
param base SPDIF base pointer. param handle Pointer to the spdif_handle_t structure which stores the transfer state. param xfer Pointer to the spdif_transfer_t structure. retval kStatus_Success Successfully started the data receive. retval kStatus_SPDIF_TxBusy Previous receive still not finished. retval kStatus_InvalidArgument The input parameter is invalid.
void SPDIF_TransferTxCreateHandle | ( | SPDIF_Type * | base, |
spdif_handle_t * | handle, | ||
spdif_transfer_callback_t | callback, | ||
void * | userData | ||
) |
Initializes the SPDIF Tx handle.
This function initializes the Tx handle for the SPDIF Tx transactional APIs. Call this function once to get the handle initialized.
base | SPDIF base pointer |
handle | SPDIF handle pointer. |
callback | Pointer to the user callback function. |
userData | User parameter passed to the callback function |
brief Initializes the SPDIF Tx handle.
This function initializes the Tx handle for the SPDIF Tx transactional APIs. Call this function once to get the handle initialized.
param base SPDIF base pointer param handle SPDIF handle pointer. param callback Pointer to the user callback function. param userData User parameter passed to the callback function
void SPDIF_TransferTxHandleIRQ | ( | SPDIF_Type * | base, |
spdif_handle_t * | handle | ||
) |
Tx interrupt handler.
base | SPDIF base pointer. |
handle | Pointer to the spdif_handle_t structure. |
brief Tx interrupt handler.
param base SPDIF base pointer. param handle Pointer to the spdif_handle_t structure.
void SPDIF_TxEnable | ( | SPDIF_Type * | base, |
bool | enable | ||
) |
Enables/disables the SPDIF Tx.
base | SPDIF base pointer |
enable | True means enable SPDIF Tx, false means disable. |
brief Enables/disables the SPDIF Tx.
param base SPDIF base pointer param enable True means enable SPDIF Tx, false means disable.
void SPDIF_TxSetSampleRate | ( | SPDIF_Type * | base, |
uint32_t | sampleRate_Hz, | ||
uint32_t | sourceClockFreq_Hz | ||
) |
Configures the SPDIF Tx sample rate.
The audio format can be changed at run-time. This function configures the sample rate.
base | SPDIF base pointer. |
sampleRate_Hz | SPDIF sample rate frequency in Hz. |
sourceClockFreq_Hz | SPDIF tx clock source frequency in Hz. |
brief Configures the SPDIF Tx sample rate.
The audio format can be changed at run-time. This function configures the sample rate.
param base SPDIF base pointer. param sampleRate_Hz SPDIF sample rate frequency in Hz. param sourceClockFreq_Hz SPDIF tx clock source frequency in Hz.
void SPDIF_WriteBlocking | ( | SPDIF_Type * | base, |
uint8_t * | buffer, | ||
uint32_t | size | ||
) |
Sends data using a blocking method.
base | SPDIF base pointer. |
buffer | Pointer to the data to be written. |
size | Bytes to be written. |
brief Sends data using a blocking method.
note This function blocks by polling until data is ready to be sent.
param base SPDIF base pointer. param buffer Pointer to the data to be written. param size Bytes to be written.