ADuCM4x50 Device Drivers API Reference Manual
Release 4.0.0.0
|
Modules | |
Static Configuration | |
Macros | |
#define | ADI_SPORT_MEMORY_SIZE (76u + ADI_SEM_SIZE) |
Typedefs | |
typedef void * | ADI_SPORT_HANDLE |
Functions | |
ADI_SPORT_RESULT | adi_sport_Open (const uint32_t nDevNum, const ADI_SPORT_CHANNEL eChannel, const ADI_SPORT_DIRECTION eDirection, void *pMemory, const uint32_t nMemSize, ADI_SPORT_HANDLE *const phDevice) |
Initialization function for SPORT device. More... | |
ADI_SPORT_RESULT | adi_sport_Close (ADI_SPORT_HANDLE const hDevice) |
Closes the operation of specified SPORT device. More... | |
ADI_SPORT_RESULT | adi_sport_SubmitBuffer (ADI_SPORT_HANDLE const hDevice, void *const pBuffer, uint32_t const nNumBytes, bool const bDMA) |
Submit the buffer for transmitting/receiving the data. This function can be used to submit the buffers for both transmitting and receiving. It will be returned after successfully submitting the buffer for transmitting data. User will be notified if a call back function is registered with an event code ADI_SPORT_EVENT_RX_BUFFER_PROCESSED or ADI_SPORT_EVENT_TX_BUFFER_PROCESSED" depending on the direction in which device is operating. More... | |
ADI_SPORT_RESULT | adi_sport_GetBuffer (ADI_SPORT_HANDLE const hDevice, void **const ppBuffer, uint32_t *pHwError) |
This function returns the address of a processed buffer. This is a blocking function: it waits until a buffer has been dealt with. This function returns an error if a callback function is registered. adi_sport_IsBufferAvailable can be used as a peek function to know whether a buffer is available. More... | |
ADI_SPORT_RESULT | adi_sport_IsBufferAvailable (ADI_SPORT_HANDLE const hDevice, bool *const pbAvailable) |
Peek function to know whether an empty/filled buffer is available. Call to this function is valid only if the call back function is not registered. Call to this function results in error if a call back function is registered. More... | |
ADI_SPORT_RESULT | adi_sport_RegisterCallback (ADI_SPORT_HANDLE const hDevice, ADI_CALLBACK const pfCallback, void *const pCBparam) |
Register and unregister a Callback function with the SPORT device driver. A registered call back function will be called, if not NULL, when a buffer is processed OR hardware error(s) encountered. More... | |
ADI_SPORT_RESULT | adi_sport_ConfigData (ADI_SPORT_HANDLE const hDevice, const uint8_t nWordLength, const ADI_SPORT_PACKING_MODE ePackMode, const bool bLSBFirst) |
Sets data format for the specified SPORT device. More... | |
ADI_SPORT_RESULT | adi_sport_ConfigClock (ADI_SPORT_HANDLE const hDevice, const uint16_t nClockRatio, const bool bUseIntlClock, const bool bRisingEdge, const bool bGatedClk) |
Configure the clock for the specified SPORT device. More... | |
ADI_SPORT_RESULT | adi_sport_ConfigFrameSync (ADI_SPORT_HANDLE const hDevice, const uint16_t nFsDivisor, const bool bFSRequired, const bool bInternalFS, const bool bDataFS, const bool bActiveLowFS, const bool bLateFS, const bool bFSErrorOperation) |
Frame Sync(FS) configuration for the specified SPORT. More... | |
ADI_SPORT_RESULT | adi_sport_MultiplexSportSignal (ADI_SPORT_HANDLE const hDevice, const bool bUseOtherFS, const bool bUseOtherClk) |
Configure the SPORT use the Clocks and Frame Sync of other Half-Sport. More... | |
ADI_SPORT_RESULT | adi_sport_ConfigTimerMode (ADI_SPORT_HANDLE const hDevice, const uint8_t nFSDuration, const uint8_t nWidth, const bool bActiveLow) |
Configure the SPORT use the Clocks and Frame Sync of other Half-Sport. More... | |
void | SPORT0A_Int_Handler (void) |
void | SPORT0B_Int_Handler (void) |
void | DMA_SPORT0A_Int_Handler (void) |
void | DMA_SPORT0B_Int_Handler (void) |
#define ADI_SPORT_MEMORY_SIZE (76u + ADI_SEM_SIZE) |
Amount of memory (bytes) required by the SPORT device driver for managing the operation in interrupt mode. This memory is completely owned by the driver till the end of the operation.
Definition at line 40 of file adi_sport.h.
typedef void* ADI_SPORT_HANDLE |
Handle to the SPORT Device
Definition at line 42 of file adi_sport.h.
enum ADI_SPORT_CHANNEL |
Enumeration of different channels of the SPORT
Enumerator | |
---|---|
ADI_HALF_SPORT_A | First half SPORT |
ADI_HALF_SPORT_B | Second half SPORT |
Definition at line 47 of file adi_sport.h.
enum ADI_SPORT_DIRECTION |
Enumeration for the direction of operation.
Enumerator | |
---|---|
ADI_SPORT_DIR_RX | Sport in Rx mode |
ADI_SPORT_DIR_TX | Sport in Tx mode |
Definition at line 56 of file adi_sport.h.
Enumeration for enabling packing.
Enumerator | |
---|---|
ADI_SPORT_NO_PACKING | No Packing |
ADI_SPORT_8BIT_PACKING | 8-bit packing |
ADI_SPORT_16BIT_PACKING | 16-Bit packing |
Definition at line 65 of file adi_sport.h.
enum ADI_SPORT_EVENT |
Enumeration for Hardware Error encountered by the SPORT device.
Definition at line 75 of file adi_sport.h.
enum ADI_SPORT_RESULT |
Enumeration for result code returned from the SPORT device driver functions.
Definition at line 94 of file adi_sport.h.
ADI_SPORT_RESULT adi_sport_Open | ( | const uint32_t | nDevNum, |
const ADI_SPORT_CHANNEL | eChannel, | ||
const ADI_SPORT_DIRECTION | eDirection, | ||
void * | pMemory, | ||
const uint32_t | nMemSize, | ||
ADI_SPORT_HANDLE *const | phDevice | ||
) |
Initialization function for SPORT device.
Initialization function for SPORT device. This function must be called before operating any SPORT device.
[in] | nDevNum | SPORT Device instance to be opened. |
[in] | eChannel | Channel ID of the SPORT device (A or B) |
[in] | eDirection | Direction of the SPORT operation (i.e Rx or Tx) |
[in] | pMemory | Pointer to a 32 bit aligned buffer containing ADI_SPORT_MEMORY_SIZE bytes. This buffer is required by the SPORT driver for its operations. The "ADI_SPORT_MEMORY_SIZE" varies based on the configuration. |
[in] | nMemSize | Size of the buffer to which "pMemory" points. |
[out] | phDevice | Pointer to a location where a handle to the opened SPORT driver can be stored. This handle will be used to identity a SPORT device when calling SPORT management functions. |
Definition at line 193 of file adi_sport.c.
ADI_SPORT_RESULT adi_sport_Close | ( | ADI_SPORT_HANDLE const | hDevice | ) |
Closes the operation of specified SPORT device.
Closes the operation of specified SPORT device. Device need to be opened again for any further use.
[in] | hDevice | SPORT device handle whose operation is to be closed. This handle was obtained when a SPORT device is opened successfully. |
- #ADI_SPORT_SUCCESS Successfully closed the specified device. - #ADI_SPORT_INVALID_HANDLE [D] Invalid SPORT device handle. - #ADI_SPORT_FAILED [D] SPORT device internal error.
Definition at line 293 of file adi_sport.c.
Referenced by adi_sport_Open().
ADI_SPORT_RESULT adi_sport_SubmitBuffer | ( | ADI_SPORT_HANDLE const | hDevice, |
void *const | pBuffer, | ||
uint32_t const | nNumBytes, | ||
bool const | bDMA | ||
) |
Submit the buffer for transmitting/receiving the data. This function can be used to submit the buffers for both transmitting and receiving. It will be returned after successfully submitting the buffer for transmitting data. User will be notified if a call back function is registered with an event code ADI_SPORT_EVENT_RX_BUFFER_PROCESSED or ADI_SPORT_EVENT_TX_BUFFER_PROCESSED" depending on the direction in which device is operating.
[in] | hDevice | Device handle to SPORT device is obtained when a SPORT device is opened successfully. |
[in] | pBuffer | Pointer to buffer from where data need to be transmitted OR to which received data need to to be written. |
[in] | nNumBytes | Size in bytes of the data to be transmitted/received. |
[in] | bDMA | True if the buffer must be processed through DMA-driven SPORT operations. |
Definition at line 348 of file adi_sport.c.
ADI_SPORT_RESULT adi_sport_GetBuffer | ( | ADI_SPORT_HANDLE const | hDevice, |
void **const | ppBuffer, | ||
uint32_t * | pHwError | ||
) |
This function returns the address of a processed buffer. This is a blocking function: it waits until a buffer has been dealt with. This function returns an error if a callback function is registered. adi_sport_IsBufferAvailable can be used as a peek function to know whether a buffer is available.
[in] | hDevice | Device handle to SPORT device, obtained when a SPORT device is openedsuccessfully. |
[out] | ppBuffer | Pointer to a location where the the address of the buffer is to be written. Contains the address of an "empty" buffer (i.e the content of the buffer is transmitted) OR "filled" buffer which contains the received data. |
[out] | pHwError | Pointer to 32-bit value reporting SPORT/DMA events that can occur when processing buffer ppBuffer. |
Definition at line 717 of file adi_sport.c.
ADI_SPORT_RESULT adi_sport_IsBufferAvailable | ( | ADI_SPORT_HANDLE const | hDevice, |
bool *const | pbAvailable | ||
) |
Peek function to know whether an empty/filled buffer is available. Call to this function is valid only if the call back function is not registered. Call to this function results in error if a call back function is registered.
[in] | hDevice | Device handle to SPORT device obtained when a SPORT device is opened successfully. |
[out] | pbAvailable | Pointer to a boolean variable. Contains "True" if there is an empty/filled buffer and a call to adi_sport_GetBuffer is ensured to be successful. Contains "false" if there is no empty buffer. |
Definition at line 778 of file adi_sport.c.
ADI_SPORT_RESULT adi_sport_RegisterCallback | ( | ADI_SPORT_HANDLE const | hDevice, |
ADI_CALLBACK const | pfCallback, | ||
void *const | pCBparam | ||
) |
Register and unregister a Callback function with the SPORT device driver. A registered call back function will be called, if not NULL, when a buffer is processed OR hardware error(s) encountered.
[in] | hDevice | Device handle to SPORT device is obtained when a SPORT device is opened successfully. |
[in] | pfCallback | Function pointer to Callback function. Passing a NULL pointer will unregister the call back function. |
[in] | pCBparam | Call back function parameter. |
Definition at line 836 of file adi_sport.c.
ADI_SPORT_RESULT adi_sport_ConfigData | ( | ADI_SPORT_HANDLE const | hDevice, |
const uint8_t | nWordLength, | ||
const ADI_SPORT_PACKING_MODE | ePackMode, | ||
const bool | bLSBFirst | ||
) |
Sets data format for the specified SPORT device.
Sets data type,Big endian (MSB first) OR Little endian (LSB first) and word length(in bits) for the specified SPORT device.This function return error if the device is already enabled.
[in] | hDevice | Device handle to SPORT device. |
[in] | nWordLength | Specify the word size of the data. Valid range is from 4(nWordLength = 3) to 32(nWordLength =31). |
[in] | bLSBFirst | Configure the specified SPORT device to operate either LSB first or MSB first. true : LSB first (Little endian) . false : MSB first (Big endian) |
[in] | ePackMode | Mode of packging need to configured. Please refer ADI_SPORT_PACKING_MODE. |
Definition at line 899 of file adi_sport.c.
ADI_SPORT_RESULT adi_sport_ConfigClock | ( | ADI_SPORT_HANDLE const | hDevice, |
const uint16_t | nClockRatio, | ||
const bool | bUseIntlClock, | ||
const bool | bRisingEdge, | ||
const bool | bGatedClk | ||
) |
Configure the clock for the specified SPORT device.
Configure the SPORT device to use the "internal/external " rising/falling clock edge,clock edge and for enabling the gated Clock Mode.
fspclk = fsclk/(2*( nClockRatio + 1))
fspclk: frequency of SPORT clock
[in] | hDevice | Device handle to SPORT device. |
[in] | nClockRatio | The value which determines the ratio between System clock and SPORT clock as explained above. |
[in] | bUseIntlClock | Boolean flag to indicate whether to use internal clock or external clock for data transmission. By default, device is configured to use the external clock. true : Device configured to use Internal clock. false : Device configured to use external clock.. |
[in] | bRisingEdge | Boolean flag to indicate whether to drive data and internal frame sync with rising edge OR falling edge of SP clock. true : Use falling edge of the clock. false : Use rising edge of the clock. |
[in] | bGatedClk | Boolean flag to indicate whether to enable/disable gated clock for the specified SPORT channel.Ignored in Multi channel mode. Clock will be active only when active data is getting transmitted or received when this mode is enabled. true : Enable gated clock mode. false : Disable gated clock mode. |
Definition at line 1031 of file adi_sport.c.
ADI_SPORT_RESULT adi_sport_ConfigFrameSync | ( | ADI_SPORT_HANDLE const | hDevice, |
const uint16_t | nFsDivisor, | ||
const bool | bFSRequired, | ||
const bool | bInternalFS, | ||
const bool | bDataFS, | ||
const bool | bActiveLowFS, | ||
const bool | bLateFS, | ||
const bool | bFSErrorOperation | ||
) |
Frame Sync(FS) configuration for the specified SPORT.
Configure the SPORT to use internal/external frame sync,level/edge sensitive early/late frame sync etc.
[in] | hDevice | Device handle to SPORT device. |
[in] | nFsDivisor | The value which decides the number of SPORT clock cycles between each frame count. |
[in] | bFSRequired | Boolean flag to indicate whether frame sync required OR not to the frame sync for the data transfer. true : Device requires a frame sync for its operation. false : Device does not requires a frame sync for its operation |
[in] | bInternalFS | Boolean flag to indicate whether to configure the specified SPORT device to use the internal frame sync OR external frame sync as below. true : Use internal frame sync. false : Use external frame sync |
[in] | bDataFS | Boolean flag to indicate whether to configure the specified SPORT device to use the data-independent frame sync OR Serial port uses a data-dependent frame sync. Valid only if the specified device is in "transmit"(TX)mode . Ignored if the device is opened in "receive"(RX) mode. true : Use data-independent frame sync. false : Use data-dependent frame sync. |
[in] | bActiveLowFS | Boolean flag to indicate whether to configure the specified SPORT device for active low frame sync OR active high frame sync. Call to this function will return error if SPORT is configured in I2S mode. true : Use active low frame sync. false : Use active high frame sync. |
[in] | bLateFS | Boolean flag to indicate whether to use the late frame sync OR Early frame sync. true : Use late frame sync. false : Use Early frame sync. |
[in] | bFSErrorOperation | Frame Sync Error Operation. This decides the way the SPORT responds when a frame sync error occurs. true : When frame Sync error occurs, discard the receive data. false : Flag the Frame Sync error and continue normal operation |
Definition at line 1162 of file adi_sport.c.
ADI_SPORT_RESULT adi_sport_MultiplexSportSignal | ( | ADI_SPORT_HANDLE const | hDevice, |
const bool | bUseOtherFS, | ||
const bool | bUseOtherClk | ||
) |
Configure the SPORT use the Clocks and Frame Sync of other Half-Sport.
[in] | hDevice | Device handle to SPORT device. |
[in] | bUseOtherFS | Boolean flag to indicate whether to use own Frame Sync(false) OR to use frame sync of other half SPORT (true). true : Use frame sync of other half SPORT device. false : Use own frame sync. |
[in] | bUseOtherClk | Boolean flag to indicate whether to use own clock clock(false) OR to use clock of other half SPORT(true). true : Use clock of other half SPORT device. false : Use own clock. |
Definition at line 1258 of file adi_sport.c.
ADI_SPORT_RESULT adi_sport_ConfigTimerMode | ( | ADI_SPORT_HANDLE const | hDevice, |
const uint8_t | nFSDuration, | ||
const uint8_t | nWidth, | ||
const bool | bActiveLow | ||
) |
Configure the SPORT use the Clocks and Frame Sync of other Half-Sport.
[in] | hDevice | Device handle to SPORT device. |
[in] | nFSDuration | Specify the value of the number of clocks which would be programmed corresponding to the desired time duration from assertion of CONVT signal to Frame sync signal |
[in] | nWidth | Specify the value of the number of serial clocks for which CONVT signal should be active. |
[in] | bActiveLow | Boolean flag to indicate the polarity of the Convt signal. true : Active low Polarity. false : Active High Polarity. |
Definition at line 1322 of file adi_sport.c.
void SPORT0A_Int_Handler | ( | void | ) |
Interrupt handler for the SPORT0-A
void SPORT0B_Int_Handler | ( | void | ) |
Interrupt handler for the SPORT0-B
void DMA_SPORT0A_Int_Handler | ( | void | ) |
DMA handler for the SPORT0-A
void DMA_SPORT0B_Int_Handler | ( | void | ) |
DMA handler for the SPORT0-B