|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ z/ ?' C* N. h! a \$ A- [code]EDMA sample test application7 ?3 L$ x7 ]8 d+ A5 _% {5 H
- /*
6 O# P- w& m7 B+ R% \& I - * edma_test.c
& i0 Q# G$ h4 }2 ?" f5 e, l - *
$ \9 v0 n: G7 x0 J+ [ - * brief EDMA3 Test Application
n c7 G3 q' x5 e1 K - *2 B. q8 I/ u& } l. H6 `- p
- * This file contains EDMA3 Test code.1 ?7 O& K j- Y$ C+ N8 q4 w
- *7 _- i( z: s# Q& A9 H. f9 ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ^5 M7 a$ v. r! i1 B& Q1 t5 L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% m5 R- W, `! t) ^+ ] - * TO CHANGE.
" Y+ {: @3 h2 E9 P. @$ p- I - *. s9 M& [0 ?$ S& A5 ?- `! L! E/ d! n' q3 \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 h/ |; n: H8 a" g! W4 e - *' y5 R' D. Z/ b* C( p
- * This program is free software; you can redistribute it and/or
7 `3 y8 W; {6 o9 @2 a$ |0 ]# A: i2 v - * modify it under the terms of the GNU General Public License as7 e* a2 B) z# s( U
- * published by the Free Software Foundation version 2.
1 [0 ]& y3 V. n7 [ m- r/ Q/ N - *
' [/ X4 z4 a0 U$ T3 m- j' Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- w M* q9 q; W2 s$ \1 F" W% F2 m% c - * kind, whether express or implied; without even the implied warranty
- ]8 L, h6 o) K( y: P) m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* g6 N/ }- x; ], z' k - * GNU General Public License for more details.) ]2 s% q# r6 E* ?) `% K
- */
" h; e7 f6 y+ a- q& F7 h( f
5 s q! g7 R0 T! z- #include <linux/module.h>
4 e* ?: \7 L" q. S5 b% z - #include <linux/init.h>
( |% u+ U" m% O - #include <linux/errno.h>+ ^* p7 C! u7 z
- #include <linux/types.h>
% j' Y9 F. G/ E/ J - #include <linux/interrupt.h>
& b6 T* {0 T+ }5 y% P0 u - #include <asm/io.h>
' o3 ?* O0 |; }; [9 h$ c8 |0 N$ N# D - #include <linux/moduleparam.h>
3 N7 ?; @( K1 j3 y/ q' r" I - #include <linux/sysctl.h>
' l1 |8 _6 w+ h9 r - #include <linux/mm.h> G7 j/ y0 r' L* k9 f, l( M
- #include <linux/dma-mapping.h>
, i) ~4 _2 Q8 U, P9 F+ } - ; I, k' P. Z% l$ \4 {; R
- #include <mach/memory.h>
+ A6 R$ T5 w! [# z1 C, S1 U - #include <mach/hardware.h>1 ?5 l1 a3 t1 E' i0 l/ s
- #include <mach/irqs.h>* T- A- ^, W7 n! M2 D- w4 o
- #include <asm/hardware/edma.h>9 P* D+ n1 Q, l$ _ h3 L
- " V6 S( l9 Y* o; T; d- Q# h
- #undef EDMA3_DEBUG! S+ f6 j2 t& \5 h& G. E/ c
- /*#define EDMA3_DEBUG*/' n8 U" W2 S3 Y4 u
0 F7 r5 n9 t0 g- #ifdef EDMA3_DEBUG
( s1 S7 f2 L$ s* l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). y2 ]( s8 m' O; Y4 y4 O o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 \ V: V) W5 B- g/ F& r% W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) Q/ [- S* @* `1 _, Z( q
- #else A5 A2 i- a4 o, C8 x
- #define DMA_PRINTK( x... )
0 d" q \# F0 m' T7 @. [ - #define DMA_FN_IN. N/ N* A& ?2 g
- #define DMA_FN_OUT
k; a8 O; Q% W - #endif
9 ^6 {; ^) k3 m+ O0 H' p- ? - % i6 g9 H, L* @3 o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; s) Q6 M- _/ k' V4 ? c# p7 S3 i, Y - #define STATIC_SHIFT 3
4 H& t6 N( u+ y - #define TCINTEN_SHIFT 20* w) z: [: m( x+ D
- #define ITCINTEN_SHIFT 21, x# w& r# |' z% `' w
- #define TCCHEN_SHIFT 22
6 l; F& A% p/ a - #define ITCCHEN_SHIFT 23
: Q9 B! D6 D& U
$ \6 P6 P& M, I' C$ l3 j" X- static volatile int irqraised1 = 0;, q4 u, v: h" E* N D6 r
- static volatile int irqraised2 = 0;+ J; ^' f0 W7 I9 m2 W
- & k/ L& l6 l' ^$ ?0 q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 A( l: S Z5 L( v$ f3 ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* o+ p; n' U. H5 ^# S" P" H- j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Q/ V7 I# }. [
! L9 D- h: J$ Y7 ~$ b" P3 M- dma_addr_t dmaphyssrc1 = 0;
' I' a' l& d- v9 \3 m - dma_addr_t dmaphyssrc2 = 0;9 O. P; d* i2 o! P5 T& }. V
- dma_addr_t dmaphysdest1 = 0;
3 L/ Z6 h! j* z6 r+ v2 N - dma_addr_t dmaphysdest2 = 0;0 V8 k: C( [7 g: ^
- / y6 v( p' t1 G8 m, |8 }
- char *dmabufsrc1 = NULL;
6 @% y: c' K9 E, q( h+ ^ O: C# T7 w - char *dmabufsrc2 = NULL;
) m( a% p5 L$ P0 n - char *dmabufdest1 = NULL;" K) e) ?) R' n- e$ \3 N
- char *dmabufdest2 = NULL;( e; Y; @! K+ W7 n
8 R) q% M8 j! a8 [% y9 X1 F- static int acnt = 512;3 G8 z3 d# w& o9 v1 t% [
- static int bcnt = 8;
( ]" k4 h. |! c4 O - static int ccnt = 8; _: _9 u, o. i6 f7 Q
- 0 o" n. m2 z5 @4 U( w
- module_param(acnt, int, S_IRUGO);
/ f8 o9 k4 }& g5 C& U' `2 c) s: {4 r - module_param(bcnt, int, S_IRUGO);
. z8 I9 ?" r1 D# P- |& p/ \5 Z - module_param(ccnt, int, S_IRUGO);
复制代码
3 B: q: m# K1 l5 ?! D; h" w
6 H% }3 Y" L! ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( [$ L; J7 C+ H+ G) {" X6 O) C2 \
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 M7 t6 _8 I- ~. m# l- u1 |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) I% x: _3 ]9 Z+ T8 w6 q" Q
\3 _1 x( Z5 \5 V# Y
! }1 q' B* Z$ d* k0 _0 j |
|