]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/edma3_lld.git/blob - examples/edma3_driver/src/sample.h
da771676bc279c0ffd15f511c67aa42ea9c8e444
[keystone-rtos/edma3_lld.git] / examples / edma3_driver / src / sample.h
1 /*
2  * bios6_edma3_drv_sample.h
3  *
4  * Header file for the Demo application for the EDMA3 Driver.
5  *
6  * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
7  *
8  *
9  *  Redistribution and use in source and binary forms, with or without
10  *  modification, are permitted provided that the following conditions
11  *  are met:
12  *
13  *    Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  *
16  *    Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the
19  *    distribution.
20  *
21  *    Neither the name of Texas Instruments Incorporated nor the names of
22  *    its contributors may be used to endorse or promote products derived
23  *    from this software without specific prior written permission.
24  *
25  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  *
37 */
39 #ifndef _SAMPLE_H_
40 #define _SAMPLE_H_
42 #include <stdio.h>
43 #include <xdc/std.h>
44 #include <ti/sysbios/knl/Task.h>
46 /* Include EDMA3 Driver */
47 #include <ti/sdo/edma3/drv/sample/bios6_edma3_drv_sample.h>
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
53 /* MAX ACOUNT */
54 #define MAX_ACOUNT                                      (64u)
55 /* MAX BCOUNT */
56 #define MAX_BCOUNT                                      (1u)
57 /* MAX CCOUNT */
58 #define MAX_CCOUNT                                      (1u)
59 /**
60  * Buffers (src and dest) are needed for mem-2-mem data transfers.
61  * This define is for the MAXIMUM size and hence the maximum data
62  * which could be transferred using the sample test cases below.
63  */
64 #define MAX_BUFFER_SIZE                         (MAX_ACOUNT * MAX_BCOUNT * MAX_CCOUNT)
66 /* To enable/disable the cache .*/
67 #define EDMA3_ENABLE_DCACHE                 (1u)
69 /* OPT Field specific defines */
70 #define OPT_SYNCDIM_SHIFT                   (0x00000002u)
71 #define OPT_TCC_MASK                        (0x0003F000u)
72 #define OPT_TCC_SHIFT                       (0x0000000Cu)
73 #define OPT_ITCINTEN_SHIFT                  (0x00000015u)
74 #define OPT_TCINTEN_SHIFT                   (0x00000014u)
76 /**
77  * EDMA3 Driver Handle, which is used to call all the Driver APIs.
78  * It gets initialized during EDMA3 Initialization.
79  */
80 extern EDMA3_DRV_Handle hEdma[];
82 extern void callback1 (unsigned int tcc, EDMA3_RM_TccStatus status,
83                         void *appData);
85 extern void callback2 (unsigned int tcc, EDMA3_RM_TccStatus status,
86                         void *appData);
88 extern signed char*  getGlobalAddr(signed char* addr);
89 /* Flag variable to check transfer completion on channel 1 */
90 extern volatile short irqRaised1;
91 /* Flag variable to check transfer completion on channel 2 */
92 extern volatile short irqRaised2;
94 #define MAX_NUM_EDMA_INSTANCES  3
96 /* Define to verify the default RM config.
97  * Additional configuration required. Update the 
98  * gblCfgReqdArray[] to reflect the master/slave config.
99  * In the case of multiple instances default configuration
100  * may require more than one cores other than core 0 to be master. 
101  * #define EDMA3_DRV_USE_DEF_RM_CFG 
102  */
104 #define GLOBAL_ADDR(addr) (getGlobalAddr(addr))
106 /**
107  *  \brief   EDMA3 mem-to-mem data copy test case, using a DMA channel.
108  *
109  *
110  *  \param  acnt        [IN]      Number of bytes in an array
111  *  \param  bcnt        [IN]      Number of arrays in a frame
112  *  \param  ccnt        [IN]      Number of frames in a block
113  *  \param  syncType    [IN]      Synchronization type (A/AB Sync)
114  *
115  *  \return  EDMA3_DRV_SOK or EDMA3_DRV Error Code
116  */
117 EDMA3_DRV_Result edma3_test(
118                     EDMA3_DRV_Handle hEdma,
119                     unsigned int acnt,
120                     unsigned int bcnt,
121                     unsigned int ccnt,
122                     EDMA3_DRV_SyncType syncType);
126 /**
127  *  \brief   EDMA3 mem-to-mem data copy test case, using two DMA
128  *              channels, linked to each other.
129  *
130  *  \param  acnt        [IN]      Number of bytes in an array
131  *  \param  bcnt        [IN]      Number of arrays in a frame
132  *  \param  ccnt        [IN]      Number of frames in a block
133  *  \param  syncType    [IN]      Synchronization type (A/AB Sync)
134  *
135  *  \return  EDMA3_DRV_SOK or EDMA3_DRV Error Code
136  */
137 EDMA3_DRV_Result edma3_test_with_link(
138                     EDMA3_DRV_Handle hEdma,
139                     unsigned int acnt,
140                     unsigned int bcnt,
141                     unsigned int ccnt,
142                     EDMA3_DRV_SyncType syncType);
146 /**
147  *  \brief   EDMA3 mem-to-mem data copy test case, using a QDMA channel.
148  *
149  *
150  *  \param  acnt        [IN]      Number of bytes in an array
151  *  \param  bcnt        [IN]      Number of arrays in a frame
152  *  \param  ccnt        [IN]      Number of frames in a block
153  *  \param  syncType    [IN]      Synchronization type (A/AB Sync)
154  *
155  *  \return  EDMA3_DRV_SOK or EDMA3_DRV Error Code
156  */
157 EDMA3_DRV_Result qdma_test(
158                     EDMA3_DRV_Handle hEdma,
159                     unsigned int acnt,
160                     unsigned int bcnt,
161                     unsigned int ccnt,
162                     EDMA3_DRV_SyncType syncType);
166 /**
167  *  \brief   EDMA3 misc test cases.
168  *              This test case will read/write to some CC registers.
169  *
170  *  \return  EDMA3_DRV_SOK or EDMA3_DRV Error Code
171  */
172 EDMA3_DRV_Result edma3_misc_test(EDMA3_DRV_Handle hEdma);
175 /**
176  *  \brief   EDMA3 mem-to-mem data copy test case, using a QDMA channel,
177  *              linked to another LINK channel.
178  *
179  *  \param  acnt        [IN]      Number of bytes in an array
180  *  \param  bcnt        [IN]      Number of arrays in a frame
181  *  \param  ccnt        [IN]      Number of frames in a block
182  *  \param  syncType    [IN]      Synchronization type (A/AB Sync)
183  *
184  *  \return  EDMA3_DRV_SOK or EDMA3_DRV Error Code
185  */
186 EDMA3_DRV_Result qdma_test_with_link(
187                     EDMA3_DRV_Handle hEdma,
188                     unsigned int acnt,
189                     unsigned int bcnt,
190                     unsigned int ccnt,
191                     EDMA3_DRV_SyncType syncType);
194 /**
195  *  \brief   EDMA3 mem-to-mem data copy test case, using two DMA channels,
196  *              chained to each other.
197  *
198  *  \param  acnt        [IN]      Number of bytes in an array
199  *  \param  bcnt        [IN]      Number of arrays in a frame
200  *  \param  ccnt        [IN]      Number of frames in a block
201  *  \param  syncType    [IN]      Synchronization type (A/AB Sync)
202  *
203  *  \return  EDMA3_DRV_SOK or EDMA3_DRV Error Code
204  */
205 EDMA3_DRV_Result edma3_test_with_chaining(
206                     EDMA3_DRV_Handle hEdma,
207                                 unsigned int acnt,
208                                 unsigned int bcnt,
209                                 unsigned int ccnt,
210                                 EDMA3_DRV_SyncType syncType);
213 /**
214  *  \brief   EDMA3 mem-to-mem data copy test case, using a DMA channel.
215  *              This test case doesnot rely on the callback mechanism.
216  *              Instead, it Polls the IPR register to check the transfer
217  *              completion status.
218  *
219  *  \param  acnt        [IN]      Number of bytes in an array
220  *  \param  bcnt        [IN]      Number of arrays in a frame
221  *  \param  ccnt        [IN]      Number of frames in a block
222  *  \param  syncType    [IN]      Synchronization type (A/AB Sync)
223  *
224  *  \return  EDMA3_DRV_SOK or EDMA3_DRV Error Code
225  */
226 EDMA3_DRV_Result edma3_test_poll_mode(
227                     EDMA3_DRV_Handle hEdma,
228                                 unsigned int acnt,
229                                 unsigned int bcnt,
230                                 unsigned int ccnt,
231                                 EDMA3_DRV_SyncType syncType);
234 /**
235  *  \brief   EDMA3 ping-pong based data copy test case, using a DMA and
236  *              a link channel.
237  *
238  *  \return  EDMA3_DRV_SOK or EDMA3_DRV Error Code
239  */
240 EDMA3_DRV_Result edma3_test_ping_pong_mode(EDMA3_DRV_Handle hEdma);
242 #ifdef __cplusplus
244 #endif /* extern "C" */
246 #endif  /* _SAMPLE_H_ */