ADuCM4x50 Device Drivers API Reference Manual  Release 4.0.0.0
adi_sport.h
1 
14 #ifndef ADI_SPORT_H
15 #define ADI_SPORT_H
16 
17 /*============= I N C L U D E S =============*/
18 
19 #include <adi_processor.h>
20 #include <rtos_map/adi_rtos_map.h>
21 #include <drivers/dma/adi_dma.h>
22 #include <adi_callback.h>
23 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31 
32 
33 /*============== D E F I N E S ===============*/
34 
40 #define ADI_SPORT_MEMORY_SIZE (76u + ADI_SEM_SIZE)
41 
42 typedef void* ADI_SPORT_HANDLE;
47 typedef enum
48 {
52 
56 typedef enum
57 {
61 
65 typedef enum
66 {
68  ADI_SPORT_8BIT_PACKING = ENUM_SPORT_CTL_A_CTL_PACK_8BIT,
69  ADI_SPORT_16BIT_PACKING = ENUM_SPORT_CTL_A_CTL_PACK_16BIT
71 
75  typedef enum
76 {
89 
90 
94 typedef enum
95 {
110 
111 /*============= P U B L I C F U N C T I O N S =============*/
112 
113 /* Opens a SPORT device */
115  const uint32_t nDevNum,
116  const ADI_SPORT_CHANNEL eChannel,
117  const ADI_SPORT_DIRECTION eDirection,
118  void *pMemory,
119  const uint32_t nMemSize,
120  ADI_SPORT_HANDLE * const phDevice
121  );
122 
123 /* Closes a SPORT device */
125  ADI_SPORT_HANDLE const hDevice
126  );
127 
128 /* Submits a buffer to the driver */
130  ADI_SPORT_HANDLE const hDevice,
131  void * const pBuffer,
132  uint32_t const nNumBytes,
133  bool const bDMA
134  );
135 
136 /* Get the processed buffer from the driver */
138  ADI_SPORT_HANDLE const hDevice,
139  void ** const ppBuffer,
140  uint32_t * pHwError
141  );
142 
143 /* Peek function to know whether an processed buffer is avilable */
145  ADI_SPORT_HANDLE const hDevice,
146  bool * const pbAvailable
147  );
148 
149 /* To register the callback function */
151  ADI_SPORT_HANDLE const hDevice,
152  const ADI_CALLBACK pfCallback,
153  void * const pCBparam
154  );
155 
156 /* Configure the data */
158  ADI_SPORT_HANDLE const hDevice,
159  const uint8_t nWordLength,
160  const ADI_SPORT_PACKING_MODE ePackMode,
161  const bool bLSBFirst
162  );
163 
164 /* Configure the clock */
166  ADI_SPORT_HANDLE const hDevice,
167  const uint16_t nClockRatio,
168  const bool bUseIntlClock,
169  const bool bRisingEdge,
170  const bool bGatedClk
171  );
172 
173 /* Configure the frame sync */
175  ADI_SPORT_HANDLE const hDevice,
176  const uint16_t nFsDivisor,
177  const bool bFSRequired,
178  const bool bInternalFS,
179  const bool bDataFS,
180  const bool bActiveLowFS,
181  const bool bLateFS,
182  const bool bFSErrorOperation
183  );
184 
185 /* To mux the half-SPORT; this makes the device to use FS and Clock from other half-SPORT */
187  ADI_SPORT_HANDLE const hDevice,
188  const bool bUseOtherFS,
189  const bool bUseOtherClk
190  );
191 
192 /* To configure the SPORT in timer mode */
194  ADI_SPORT_HANDLE const hDevice,
195  const uint8_t nFSDuration,
196  const uint8_t nWidth,
197  const bool bActiveLow
198  );
199 
200 #ifdef __cplusplus
201 }
202 #endif /* __cplusplus */
203 
204 #endif /* ADI_SPORT_H */
205 
ADI_SPORT_DIRECTION
Definition: adi_sport.h:56
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.
Definition: adi_sport.c:1258
void * ADI_SPORT_HANDLE
Definition: adi_sport.h:42
ADI_SPORT_CHANNEL
Definition: adi_sport.h:47
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.
Definition: adi_sport.c:899
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 buffer...
Definition: adi_sport.c:348
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.
Definition: adi_sport.c:1322
ADI_SPORT_RESULT adi_sport_Close(ADI_SPORT_HANDLE const hDevice)
Closes the operation of specified SPORT device.
Definition: adi_sport.c:293
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.
Definition: adi_sport.c:1031
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 onl...
Definition: adi_sport.c:778
ADI_SPORT_PACKING_MODE
Definition: adi_sport.h:65
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.
Definition: adi_sport.c:193
ADI_SPORT_RESULT
Definition: adi_sport.h:94
ADI_SPORT_RESULT adi_sport_RegisterCallback(ADI_SPORT_HANDLE const hDevice, const ADI_CALLBACK pfCallback, void *const pCBparam)
Register and unregister a Callback function with the SPORT device driver. A registered call back func...
Definition: adi_sport.c:836
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 ...
Definition: adi_sport.c:717
ADI_SPORT_EVENT
Definition: adi_sport.h:75
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.
Definition: adi_sport.c:1162