![]() |
spdif
Xilinx SDK Drivers API Documentation
|
Data Structures | |
struct | XSpdif_Config |
This typedef contains configuration information for the XSpdif. More... | |
struct | XSpdif |
The XSpdif driver instance data. More... | |
Typedefs | |
typedef void(* | XSpdif_Callback )(void *CallbackRef) |
Callback function data type for handling interrupt requests from the XSpdif peripheral. More... | |
Functions | |
XSpdif_Config * | XSpdif_LookupConfig (u16 DeviceId) |
This function returns a reference to an XSpdif_Config structure based on the core id, DeviceId. More... | |
int | XSpdif_Initialize (XSpdif *InstancePtr, u16 DeviceId) |
Initializes a specific Xspdif instance such that the driver is ready to use. More... | |
int | XSpdif_CfgInitialize (XSpdif *InstancePtr, XSpdif_Config *CfgPtr, UINTPTR EffectiveAddr) |
This function initializes the XSpdif. More... | |
void | XSpdif_Enable (XSpdif *InstancePtr, u8 Enable) |
This function enables/disables the XSpdif. More... | |
void | XSpdif_SetClkConfig (XSpdif *InstancePtr, u8 Clk_DivNum) |
This function sets the clock configuration bits. More... | |
u32 | XSpdif_GetFs (XSpdif *InstancePtr, u32 AudClk) |
This function calculates the Sampling Frequency (Fs) and returns it's value. More... | |
void | XSpdif_SoftReset (XSpdif *InstancePtr) |
This function is used to soft reset the interrupt registers. More... | |
void | XSpdif_ResetFifo (XSpdif *InstancePtr) |
This function resets the Fifo. More... | |
void | XSpdif_IntrHandler (void *InstancePtr) |
This function is the interrupt handler for the XSpdif driver. More... | |
int | XSpdif_SetHandler (XSpdif *InstancePtr, XSpdif_HandlerType HandlerType, XSpdif_Callback FuncPtr, void *CallbackRef) |
This function installs an asynchronous callback function for the given HandlerType: More... | |
void | XSpdif_Rx_GetChStat (XSpdif *InstancePtr, u8 *ChStatBuf) |
This function reads all the Channel Status registers and writes to a buffer. More... | |
void | XSpdif_Rx_GetChA_UserData (XSpdif *InstancePtr, u8 *ChA_UserDataBuf) |
This function reads the Channel A user data and writes to a buffer. More... | |
void | XSpdif_Rx_GetChB_UserData (XSpdif *InstancePtr, u8 *ChB_UserDataBuf) |
This function reads the Channel B user data and writes to a buffer. More... | |
Handler Types | |
enum | XSpdif_HandlerType { XSPDIF_HANDLER_TX_OR_RX_FIFO_FULL = 0, XSPDIF_HANDLER_TX_OR_RX_FIFO_EMPTY, XSPDIF_HANDLER_START_OF_BLOCK, XSPDIF_HANDLER_BMC_ERROR, XSPDIF_HANDLER_PREAMBLE_ERROR, XSPDIF_NUM_HANDLERS } |
These constants specify different types of handlers and is used to differentiate interrupt requests from the XSpdif peripheral. More... | |
typedef void(* XSpdif_Callback)(void *CallbackRef) |
Callback function data type for handling interrupt requests from the XSpdif peripheral.
The application using this driver is expected to define a handler of this type to support interrupt driven mode. The handler is called in an interrupt context such that minimal processing should be performed.
CallBackRef | is a callback reference passed in by the upper layer when setting the callback functions, and passed back to the upper layer when the callback is invoked. |
enum XSpdif_HandlerType |
These constants specify different types of handlers and is used to differentiate interrupt requests from the XSpdif peripheral.
int XSpdif_CfgInitialize | ( | XSpdif * | InstancePtr, |
XSpdif_Config * | CfgPtr, | ||
UINTPTR | EffectiveAddr | ||
) |
This function initializes the XSpdif.
This function must be called prior to using the core. Initialization of the XSpdif includes setting up the instance data, and ensuring the hardware is in a quiescent state.
InstancePtr | is a pointer to the XSpdif instance. |
CfgPtr | points to the configuration structure associated with the XSpdif. |
EffectiveAddr | is the base address of the device. If address translation is being used, then this parameter must reflect the virtual base address. Otherwise, the physical address should be used. |
References XSpdif_Config::BaseAddress, XSpdif::Config, XSpdif::IsReady, and XSpdif_Enable().
Referenced by SpdifSelfTestExample(), and XSpdif_Initialize().
void XSpdif_Enable | ( | XSpdif * | InstancePtr, |
u8 | Enable | ||
) |
This function enables/disables the XSpdif.
InstancePtr | is a pointer to the XSpdif instance. |
Enable | specifies TRUE/FALSE value to either enable or disable the XSpdif. |
References XSpdif_Config::BaseAddress, XSpdif::Config, XSpdif::IsStarted, XSPDIF_CONTROL_REGISTER_OFFSET, XSPDIF_CORE_ENABLE_MASK, XSpdif_ReadReg, and XSpdif_WriteReg.
Referenced by XSpdif_CfgInitialize().
u32 XSpdif_GetFs | ( | XSpdif * | InstancePtr, |
u32 | AudClk | ||
) |
This function calculates the Sampling Frequency (Fs) and returns it's value.
InstancePtr | is a pointer to the XSpdif instance. |
AudClk | is the audio clock frequency value in Hz. |
References XSpdif_Config::BaseAddress, XSpdif::Config, XSpdif_ReadReg, XSPDIF_SAMPLE_CLOCK_COUNT_MASK, and XSPDIF_STATUS_REGISTER_OFFSET.
int XSpdif_Initialize | ( | XSpdif * | InstancePtr, |
u16 | DeviceId | ||
) |
Initializes a specific Xspdif instance such that the driver is ready to use.
InstancePtr | is a pointer to the XSpdif instance to be worked on. |
DeviceId | is the unique id of the device controlled by this XSpdif instance. Passing in a device id associates the generic XSpdif instance to a specific device, as chosen by the caller or application developer. |
References XSpdif_Config::BaseAddress, XSpdif_CfgInitialize(), and XSpdif_LookupConfig().
void XSpdif_IntrHandler | ( | void * | InstancePtr | ) |
This function is the interrupt handler for the XSpdif driver.
This handler reads the pending interrupt from the XSpdif peripheral, determines the source of the interrupts, clears the interrupts and calls call backs accordingly.
InstancePtr | is a pointer to the XSpdif instance. |
References XSpdif_Config::BaseAddress, XSpdif::BmcErrHandler, XSpdif::BmcErrHandlerRef, XSpdif::Config, XSpdif::IsReady, XSpdif::PreambleErrHandler, XSpdif::PreambleErrHandlerRef, XSpdif::StartOfBlockHandler, XSpdif::StartOfBlockHandlerRef, XSpdif::TxOrRxFifoEmptyHandler, XSpdif::TxOrRxFifoEmptyHandlerRef, XSpdif::TxOrRxFifoFullHandler, XSpdif::TxOrRxFifoFullHandlerRef, XSPDIF_BMC_ERROR_MASK, XSPDIF_INTERRUPT_ENABLE_REGISTER_OFFSET, XSPDIF_INTERRUPT_STATUS_REGISTER_OFFSET, XSPDIF_PREAMBLE_ERROR_MASK, XSpdif_ReadReg, XSPDIF_START_OF_BLOCK_MASK, XSPDIF_TX_OR_RX_FIFO_EMPTY_MASK, and XSPDIF_TX_OR_RX_FIFO_FULL_MASK.
XSpdif_Config* XSpdif_LookupConfig | ( | u16 | DeviceId | ) |
This function returns a reference to an XSpdif_Config structure based on the core id, DeviceId.
The return value will refer to an entry in the device configuration table defined in the xspdif_g.c file.
DeviceId | is the unique core ID of the XSpdif core for the lookup operation. |
Referenced by SpdifSelfTestExample(), and XSpdif_Initialize().
void XSpdif_ResetFifo | ( | XSpdif * | InstancePtr | ) |
This function resets the Fifo.
InstancePtr | is a pointer to the XSpdif instance. |
References XSpdif_Config::BaseAddress, XSpdif::Config, XSPDIF_CONTROL_REGISTER_OFFSET, XSPDIF_CORE_ENABLE_MASK, XSpdif_ReadReg, and XSpdif_WriteReg.
void XSpdif_Rx_GetChA_UserData | ( | XSpdif * | InstancePtr, |
u8 * | ChA_UserDataBuf | ||
) |
This function reads the Channel A user data and writes to a buffer.
InstancePtr | is a pointer to the XSPDIF instance. |
ChA_UserDataBuf | is a pointer to a buffer. |
References XSpdif_Config::BaseAddress, XSpdif::Config, XSPDIF_CHANNEL_A_USER_DATA_REGISTER0_OFFSET, and XSpdif_ReadReg.
void XSpdif_Rx_GetChB_UserData | ( | XSpdif * | InstancePtr, |
u8 * | ChB_UserDataBuf | ||
) |
This function reads the Channel B user data and writes to a buffer.
InstancePtr | is a pointer to the XSPDIF instance. |
ChB_UserDataBuf | is a pointer to a buffer. |
References XSpdif_Config::BaseAddress, XSpdif::Config, XSPDIF_CHANNEL_B_USER_DATA_REGISTER0_OFFSET, and XSpdif_ReadReg.
void XSpdif_Rx_GetChStat | ( | XSpdif * | InstancePtr, |
u8 * | ChStatBuf | ||
) |
This function reads all the Channel Status registers and writes to a buffer.
InstancePtr | is a pointer to the XSpdif instance. |
ChStatBuf | is a pointer to a buffer. |
References XSpdif_Config::BaseAddress, XSpdif::Config, XSPDIF_CHANNEL_STATUS_REGISTER0_OFFSET, and XSpdif_ReadReg.
void XSpdif_SetClkConfig | ( | XSpdif * | InstancePtr, |
u8 | Clk_DivNum | ||
) |
This function sets the clock configuration bits.
InstancePtr | is a pointer to the Spdif instance. |
Clk_DivNum | is the clock division number. Clk_DivNum value can be only 4,8,16,24,32,48,or 64. |
References XSpdif_Config::BaseAddress, XSpdif::Config, XSPDIF_CLK_16, XSPDIF_CLK_24, XSPDIF_CLK_32, XSPDIF_CLK_4, XSPDIF_CLK_48, XSPDIF_CLK_64, XSPDIF_CLK_8, XSPDIF_CLOCK_CONFIG_BITS_MASK, XSPDIF_CLOCK_CONFIG_BITS_SHIFT, XSPDIF_CONTROL_REGISTER_OFFSET, XSpdif_ReadReg, and XSpdif_WriteReg.
int XSpdif_SetHandler | ( | XSpdif * | InstancePtr, |
XSpdif_HandlerType | HandlerType, | ||
XSpdif_Callback | FuncPtr, | ||
void * | CallbackRef | ||
) |
This function installs an asynchronous callback function for the given HandlerType:
HandlerType Callback Function -------------------------------- ---------------------------------- (XSPDIF_HANDLER_START_OF_BLOCK) StartOfBlockHandler (XSPDIF_HANDLE_PREAMBLE_ERROR) PreambleErrHandler (XSPDIF_HANDLE_BMC_ERROR) BmcErrHandler (XSPDIF_HANDLER_TX_OR_RX_FIFO_EMPTY) TxOrRxFifoEmptyHandler (XSPDIF_HANDLER_TX_OR_RX_FIFO_FULL) TxOrRxFifoFullHandler
InstancePtr | is a pointer to the XSpdif core instance. |
HandlerType | specifies the type of handler. |
FuncPtr | is a pointer to the callback function. |
CallbackRef | is a reference pointer passed on actual calling of the callback function. |
References XSpdif::BmcErrHandler, XSpdif::BmcErrHandlerRef, XSpdif::PreambleErrHandler, XSpdif::PreambleErrHandlerRef, XSpdif::StartOfBlockHandler, XSpdif::StartOfBlockHandlerRef, XSpdif::TxOrRxFifoEmptyHandler, XSpdif::TxOrRxFifoEmptyHandlerRef, XSpdif::TxOrRxFifoFullHandler, XSpdif::TxOrRxFifoFullHandlerRef, XSPDIF_HANDLER_BMC_ERROR, XSPDIF_HANDLER_PREAMBLE_ERROR, XSPDIF_HANDLER_START_OF_BLOCK, XSPDIF_HANDLER_TX_OR_RX_FIFO_EMPTY, XSPDIF_HANDLER_TX_OR_RX_FIFO_FULL, and XSPDIF_NUM_HANDLERS.
void XSpdif_SoftReset | ( | XSpdif * | InstancePtr | ) |
This function is used to soft reset the interrupt registers.
InstancePtr | is a pointer to the XSPDIF instance. |
References XSpdif_Config::BaseAddress, XSpdif::Config, XSPDIF_SOFT_RESET_REGISTER_OFFSET, XSPDIF_SOFT_RESET_REGISTER_VALUE, and XSpdif_WriteReg.