|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 [. k/ |. p$ W6 Y4 e- [code]EDMA sample test application, m1 D- {, ^. i8 I. z6 M1 T& l
- /*
$ c( h8 f) I* X! e; [ - * edma_test.c2 X& M) J# \) l4 e& r* p) q6 n; |
- *
$ V" T, r) E9 ]- g5 `3 B - * brief EDMA3 Test Application
7 T, V W' }' Q$ q - *
2 n8 x6 v: X: k: r$ O - * This file contains EDMA3 Test code.0 L) m! N1 x1 ]( h' }, S; Z# c) S
- *
Y9 d- B( c/ y) M- W* \; V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 I5 r) s, V0 ]9 F: ?0 b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! y: z$ v+ f# W; P/ u. ^# { - * TO CHANGE.
& R$ N* K' k/ {6 M9 d5 X" Y1 h/ W - *4 g# H( ]9 F' _# {" z# |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: i( E0 H8 {4 _' u - *! F8 N, O: ]7 Q+ ?6 a$ z
- * This program is free software; you can redistribute it and/or# d7 s# _1 {! n) A' _( T& @4 w9 @& C
- * modify it under the terms of the GNU General Public License as
, J1 l, ?* F+ Y+ S% V# d. ^$ f - * published by the Free Software Foundation version 2.
/ e# h2 e6 w$ P$ @6 | - *: v1 K. ^/ ^1 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 x1 N4 G; Q! d0 G
- * kind, whether express or implied; without even the implied warranty
; c9 B# B5 ~ c! Q, q* ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 [! y' k& L" @! x" G+ C
- * GNU General Public License for more details.3 Y: c) t1 b9 i( t+ }" Z2 a _
- */
' b; n( t$ Y u( @/ F3 ^6 X - & |8 i+ e5 N+ L, P& I) x' M% {
- #include <linux/module.h>
5 P! p% O. O1 o# E2 ~ - #include <linux/init.h>
# D) o$ ^7 r+ Y3 B( h F. M* ^ - #include <linux/errno.h>' C& b# m1 Q: l
- #include <linux/types.h>
+ s: N1 s, P3 R9 o - #include <linux/interrupt.h>* V3 x2 ?# _, j/ [" w
- #include <asm/io.h>; T, V9 G, l9 S
- #include <linux/moduleparam.h>1 K& d; T7 @$ Q
- #include <linux/sysctl.h>
8 F( W8 r$ M" E5 Q U - #include <linux/mm.h>0 c+ { g' ?7 R2 s1 i
- #include <linux/dma-mapping.h>
& q; s Z- r' @, s. x a1 ~
! v* g7 [5 i5 {- @ E. b$ y- #include <mach/memory.h>
& {+ x0 k0 [+ s - #include <mach/hardware.h># N: O- {* ]: `# d0 I W
- #include <mach/irqs.h>
$ r( d1 \# U+ k5 } - #include <asm/hardware/edma.h>& n! U7 j$ H; X! K0 M. t# l
- 1 @7 k: l7 B( U! I( C2 X/ r- |1 y
- #undef EDMA3_DEBUG
! c, v1 L3 Q/ }/ t% T7 e - /*#define EDMA3_DEBUG*/
7 q) N1 v8 A- g2 m# }
* o# x$ `) o; F8 D( p+ }1 k- #ifdef EDMA3_DEBUG( h0 U6 Z0 p' Z3 {4 ^ j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, B @0 ?! N- d& N, C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 l4 q( N& |( R- Q7 j7 k: w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 G& p2 i7 m" R- n) H% T- j
- #else X7 @0 p/ g3 F$ s
- #define DMA_PRINTK( x... )
0 H$ P2 p3 u$ _- P5 }- ?/ N, H - #define DMA_FN_IN
3 I3 C. P7 V$ j4 e2 n - #define DMA_FN_OUT
- D% s% S+ i8 n& P - #endif5 Q7 N# {5 r. {: l$ |% d
9 {$ O1 e3 P8 U/ C' _- #define MAX_DMA_TRANSFER_IN_BYTES (32768) x0 ? r; v' g- c4 \' y
- #define STATIC_SHIFT 3
5 P& t7 C1 y8 Y2 R - #define TCINTEN_SHIFT 20; F' c% Q% m+ i4 P! |) d7 \
- #define ITCINTEN_SHIFT 21. x6 {9 X3 w8 h3 `+ A7 z8 f$ o( I* i, d
- #define TCCHEN_SHIFT 22
7 L* i: r$ W* p - #define ITCCHEN_SHIFT 23
" m1 D" P- h# x) r! h - 3 W/ r1 Z( y( U8 `: ]$ h5 G6 F7 ^
- static volatile int irqraised1 = 0;- k# ^% x# T* q0 L2 S8 x9 W
- static volatile int irqraised2 = 0;
% E2 E8 s" E h5 u* B; w - 9 C8 T. C2 ^9 M0 \. T ?6 b: Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! w; e% x' W2 U% G) o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" ^ T8 E) T9 M3 U8 v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 V% `) L8 ?4 d: n" K+ }! c
- 5 x7 K. a* H, C" ]0 S( Z% |+ B' F
- dma_addr_t dmaphyssrc1 = 0;
! t( Z2 N' V- C. V2 O3 ~ - dma_addr_t dmaphyssrc2 = 0;
* |4 N5 M: ]% ~7 Q1 u - dma_addr_t dmaphysdest1 = 0;7 Y' c1 o5 C {4 k' J
- dma_addr_t dmaphysdest2 = 0;- O' w# b( j2 R
- ' j% s+ G: o& J% l! l) n J9 z
- char *dmabufsrc1 = NULL;/ T) p, }* R, b1 T. U
- char *dmabufsrc2 = NULL;7 U; c" p; _7 W6 S- z
- char *dmabufdest1 = NULL;- I9 ^& ]' X* ^/ ^ ~$ L
- char *dmabufdest2 = NULL;
; I' a e2 R/ [) _6 v - " `; Y; t$ k& h1 m2 e3 b1 Y+ k
- static int acnt = 512;& }: x! T' g1 g' m$ ~% d
- static int bcnt = 8; X4 k+ ]2 T- ?8 Z% f2 R6 g
- static int ccnt = 8;
4 l1 y9 `! O) Z- A5 F2 b - 8 ]. X& U0 g0 \: N" x s
- module_param(acnt, int, S_IRUGO);
: ^! Z* L8 e: T$ x! `: _8 L$ r - module_param(bcnt, int, S_IRUGO);
& ?5 V# J; e4 S/ y/ D! b - module_param(ccnt, int, S_IRUGO);
复制代码 # E& a t2 k1 D$ x! K
; i. ^6 ~$ v) M0 _& m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) S3 j) K5 h# j+ z( i2 q% w darm-none-linux-gnueabi-gcc -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( C3 N8 O3 w4 b+ o* a. n) P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ _$ }3 C7 k1 N' j* q! `
2 D" E; f% d' Z5 f. T8 d: }6 l a) f! h: ^, ]2 k
|
|