TI-radar AWR1843 C674x DSP core  1
dss_config_edma_util.h
Go to the documentation of this file.
1 
39 #ifndef DSS_CONFIG_EDMA_UTIL_H
40 #define DSS_CONFIG_EDMA_UTIL_H
41 
42 #include <ti/drivers/edma/edma.h>
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 /******************************************************************************
49  * @b Description
50  * @n
51  * Sets up a EDMA channel for transferring a contiguous set of data
52  * (of length Acnt Bytes) from a source to a destination buffer.
53  * The EDMA can be configured for multiple transfers, so that subsequent
54  * initiations of the EDMA channel, initiate these subsequent transfers.
55  * The number of such multiple transfers is defined by Bcnt.
56  * For subsequent transfers the start pointer of the source buffer increments
57  * by srcBIdx bytes. The destination buffer remains the same across subsequent
58  * transfers. The EDMA is programmed as an "A-Synchronized transfer")
59  *
60  * The ParamSet (parameter set) into which the EDMA is programmed is the same
61  * as the EDMA channel number. Additionally, the same parameters are programmed
62  * into a shadow ParamSet which is linked to the original ParamSet. Thus after all
63  * the Bnt transfers are complete, the ParamSet is automatically reinitialized
64  * and ready for another set of Bcnt transfers.
65  *
66  * This routine is useful when data from external memory has to be brought
67  * sequentially in chunks into the DSP's internal buffer (L1/L2) for signal
68  * processing. The automatic reinitialization ensures that a one-time
69  * programming suffices (e.g.does not need to be re-programmed every frame)
70  *
71  *
72  * @param[in] srcBuff Pointer to source buffer
73  * @param[in] dstBuff Pointer to destination buffer
74  * @param[in] chId EDMA channel Id. (The ParamSet allocated to
75  * this EDMA is also indexed by this EDMA channel number).
76  * @param[in] isEventTriggered true if event triggered else (manual/chain triggered) false.
77  * @param[in] shadowParamId EDMA channel number for "shadow channels" which
78  * stores a replica of the orignal EDMA channel.
79  * @param[in] This enables reload of the EDMA channel registers
80  * once an AB-synchronized transfer is complete.
81  * @param[in] aCount This specifies the Acnt of the transfer. (i.e number
82  * of contiguous bytes per transfer).
83  * @param[in] bCount Number of EDMA transfers (each of length Acnt bytes).
84  * @param[in] srcBIdx Specifies the byte offset between the source pointer
85  * of subsequent EDMA transfers.
86  * @param[in] dstBIdx Specifies the byte offset between the source pointer
87  * of subsequent EDMA transfers.
88  * @param[in] eventQueueId Event Queue Id on which to schedule the transfer.
89  * @param[in] transferCompletionCallbackFxn Transfer completion call back function.
90  * @param[in] transferCompletionCallbackFxnArg Transfer completion call back function argument.
91  * @param[in] isEventTriggered true if event triggered else (manual/chain triggered) false.
92  *
93  * @retval
94  * EDMA driver error code, see "EDMA_ERROR_CODES" in EDMA API.
95  *
96  ******************************************************************************/
97 int32_t EDMAutil_configType1(EDMA_Handle handle,
98  uint8_t *srcBuff,
99  uint8_t *dstBuff,
100  uint8_t chId,
101  bool isEventTriggered,
102  uint16_t shadowParamId,
103  uint16_t aCount,
104  uint16_t bCount,
105  int16_t srcBIdx,
106  int16_t dstBIdx,
107  uint8_t eventQueueId,
108  EDMA_transferCompletionCallbackFxn_t transferCompletionCallbackFxn,
109  uintptr_t transferCompletionCallbackFxnArg);
110 
111 /******************************************************************************
112  * @b Description
113  * @n
114  * Sets up a EDMA channel for transferring a contiguous set of Bcnt samples
115  * from a source to a destination buffer. The data in the destination buffer
116  * is stored in a transposed format, with @ref destBIdx being the offset in bytes
117  * between subsequent complex samples. The EDMA can be configured for multiple
118  * such transfers, so that subsequent initiations of the EDMA channel, initiate
119  * these subsequent transfers. The number of such multiple transfers is
120  * defined by Ccnt. For subsequent transfers the start pointer of the
121  * destination buffer increments by one sample (sampleLenInBytes).
122  * The source buffer remains the same across subsequent transfers.
123  * Note that the EDMA is programmed as an "AB-Synchronized transfer".
124  *
125  * The ParamSet (parameter set) into which the EDMA is programmed is the same
126  * as the EDMA channel number. Additionally, the same parameters are
127  * programmed into a shadow ParamSet which is linked to the original ParamSet.
128  * Thus after all the Ccnt transfers are complete, the ParamSet is automatically
129  * reinitialized and ready for another set of Ccnt transfers.
130  *
131  * This routine is useful when processed data from the DSP has to be stored
132  * in external memory in a transpose fashion. The automatic reinitialization
133  * ensures that a one-time programming suffices
134  * (e.g.does not need to be re-programmed every frame)
135  *
136  *
137  * @param[in] srcBuff Pointer to source buffer
138  * @param[in] dstBuff Pointer to destination buffer
139  * @param[in] chId EDMA channel Id (The ParamSet allocated to this
140  * EDMA is also indexed by this EDMA channel number).
141  * @param[in] isEventTriggered true if event triggered else (manual/chain triggered) false.
142  * @param[in] shadowParamId EDMA shadow PaRAM Id which stores a replica of the
143  * original EDMA channel.
144  * @param[in] This enables reload of the EDMA channel registers
145  * once an AB-synchronized transfer is complete.
146  * @param[in] sampleLenInBytes Number of bytes corresponding to one complex sample.
147  * @param[in] numRangeBins number of range bins.
148  * @param[in] numTxAnt number of Tx antenna.
149  * @param[in] numRxAnt number of Rx antenna.
150  * @param[in] numDopplerBins number of doppler bins.
151  * @param[in] transferCompletionCallbackFxn Transfer completion call back function.
152  * @param[in] transferCompletionCallbackFxnArg Transfer completion call back function argument.
153  *
154  * @retval
155  * EDMA driver error code, see "EDMA_ERROR_CODES" in EDMA API.
156  *
157  ******************************************************************************/
158 int32_t EDMAutil_configType2a(EDMA_Handle handle,
159  uint8_t *srcBuff,
160  uint8_t *dstBuff,
161  uint8_t chId,
162  bool isEventTriggered,
163  uint16_t shadowParamId,
164  uint16_t sampleLenInBytes,
165  uint16_t numRangeBins,
166  uint8_t numTxAnt,
167  uint8_t numRxAnt,
168  uint16_t numDopplerBins,
169  uint8_t eventQueueId,
170  EDMA_transferCompletionCallbackFxn_t transferCompletionCallbackFxn,
171  uintptr_t transferCompletionCallbackFxnArg);
172 
173 /******************************************************************************
174  * @b Description
175  * @n
176  * Sets up a EDMA channel for performing a 2-Dimensional EDMA transfer
177  * (with Acnt and Bcnt defined both both source and destination).
178  * The ParamaSet is automatically reinitialized (by linking to a shadow ParamSet)
179  * when the transfer is complete.
180  *
181  * @param[in] srcBuff Pointer to source buffer.
182  * @param[in] dstBuff Pointer to destination buffer.
183  * @param[in] chId EDMA channel Id (The ParamSet allocated to this
184  * EDMA is also indexed by this EDMA channel number).
185  * @param[in] isEventTriggered true if event triggered else (manual/chain triggered) false.
186  * @param[in] shadowParamId EDMA shadow PaRAM Id which stores a replica of
187  * the original EDMA channel. This enables reload of
188  * the EDMA channel registers once an AB-synchronized
189  * transfer is complete.
190  * @param[in] aCount This specifies the number of contiguous bytes
191  * (from the soruce) per transfer. (BCNT of the transfer)
192  * @param[in] bCount Number of EDMA transfers (each of length Acnt bytes).
193  * @param[in] srcBIdx Specifies the byte offset between the source pointer
194  * of subsequent EDMA transfers.
195  * @param[in] dstBIdx Specifies the byte offset between the source pointer
196  * of subsequent EDMA transfers.
197  * @param[in] eventQueueId Event Queue Id on which to schedule the transfer.
198  * @param[in] transferCompletionCallbackFxn Transfer completion call back function.
199  * @param[in] transferCompletionCallbackFxnArg Transfer completion call back function argument.
200  *
201  * @retval
202  * EDMA driver error code, see "EDMA_ERROR_CODES" in EDMA API.
203  *
204  *******************************************************************************/
205 int32_t EDMAutil_configType3(EDMA_Handle handle,
206  uint8_t *srcBuff,
207  uint8_t *dstBuff,
208  uint8_t chId,
209  bool isEventTriggered,
210  uint16_t shadowParamId,
211  uint16_t aCount,
212  uint16_t bCount,
213  int16_t srcBIdx,
214  int16_t destBIdx,
215  uint8_t eventQueueId,
216  EDMA_transferCompletionCallbackFxn_t transferCompletionCallbackFxn,
217  uintptr_t transferCompletionCallbackFxnArg);
218 
219 /******************************************************************************
220  * @b Description
221  * @n
222  * Reconfigures source and destination addresses of a given channel Id
223  * (whose param Id is assumed to be already configured to be same as channel Id)
224  * and then starts a transfer on that channel.
225  *
226  * @param[in] srcBuff Pointer to source buffer. If NULL, does not update.
227  * @param[in] dstBuff Pointer to destination buffer. If NULL, does not update.
228  * @param[in] chId EDMA channel Id.
229  * @param[in] triggerEnabled =1: trigger EDMA, =0: does not trigger EDMA
230  *
231  * @retval
232  * EDMA driver error code, see "EDMA_ERROR_CODES" in EDMA API.
233  *
234  *******************************************************************************/
235 int32_t EDMAutil_triggerType3(EDMA_Handle handle,
236  uint8_t *srcBuff,
237  uint8_t *dstBuff,
238  uint8_t chId,
239  uint8_t triggerEnabled);
240 
241 #ifdef __cplusplus
242 }
243 #endif
244 
245 #endif
EDMAutil_configType1
int32_t EDMAutil_configType1(EDMA_Handle handle, uint8_t *srcBuff, uint8_t *dstBuff, uint8_t chId, bool isEventTriggered, uint16_t shadowParamId, uint16_t aCount, uint16_t bCount, int16_t srcBIdx, int16_t dstBIdx, uint8_t eventQueueId, EDMA_transferCompletionCallbackFxn_t transferCompletionCallbackFxn, uintptr_t transferCompletionCallbackFxnArg)
Definition: dss_config_edma_util.c:86
EDMAutil_configType2a
int32_t EDMAutil_configType2a(EDMA_Handle handle, uint8_t *srcBuff, uint8_t *dstBuff, uint8_t chId, bool isEventTriggered, uint16_t shadowParamId, uint16_t sampleLenInBytes, uint16_t numRangeBins, uint8_t numTxAnt, uint8_t numRxAnt, uint16_t numDopplerBins, uint8_t eventQueueId, EDMA_transferCompletionCallbackFxn_t transferCompletionCallbackFxn, uintptr_t transferCompletionCallbackFxnArg)
Definition: dss_config_edma_util.c:153
EDMAutil_triggerType3
int32_t EDMAutil_triggerType3(EDMA_Handle handle, uint8_t *srcBuff, uint8_t *dstBuff, uint8_t chId, uint8_t triggerEnabled)
Definition: dss_config_edma_util.c:364
EDMAutil_configType3
int32_t EDMAutil_configType3(EDMA_Handle handle, uint8_t *srcBuff, uint8_t *dstBuff, uint8_t chId, bool isEventTriggered, uint16_t shadowParamId, uint16_t aCount, uint16_t bCount, int16_t srcBIdx, int16_t destBIdx, uint8_t eventQueueId, EDMA_transferCompletionCallbackFxn_t transferCompletionCallbackFxn, uintptr_t transferCompletionCallbackFxnArg)
Definition: dss_config_edma_util.c:297