|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- H0 T* a3 B4 w- Y: k5 U- [code]EDMA sample test application+ j4 W, {, F# s9 j
- /*- R, A' S% {+ T' N2 }( L
- * edma_test.c
1 i/ B$ m/ k- x# N$ V9 S' ?) L) Q - *
% h. j) C9 h- o3 P- T - * brief EDMA3 Test Application
: W6 n1 {+ O' l2 D- f7 o& L% P3 L# F - *3 C# y' W4 V5 S: g1 I8 l+ n
- * This file contains EDMA3 Test code.
n: o9 `' Q- ? - *! W$ n5 `) P# D# k( b+ X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
}# g! ]9 n! e: x) d( i" Y3 c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 L) M0 x/ \+ T$ U7 \# u3 f - * TO CHANGE.$ Z9 L1 O6 M9 n2 M/ g
- *1 o/ s. q; z K4 M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 R0 G7 }- c* [0 W/ J - *2 z. p& F8 u1 C9 ~# t* g
- * This program is free software; you can redistribute it and/or* n8 }, W: f, g0 H( @- ~
- * modify it under the terms of the GNU General Public License as9 J( d; J3 b+ k- ` n
- * published by the Free Software Foundation version 2.
% j6 R/ {5 g; S - *
& P) K! a: ?1 t4 @; x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# a; l; k y0 W! \$ n: \5 v% } - * kind, whether express or implied; without even the implied warranty5 \9 r3 l5 H1 j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' m5 d% t2 m" _" |3 k6 a - * GNU General Public License for more details.# F5 \" \& y, x0 @+ @. @
- */. X$ P' B* s& I- ]1 m
" |; D/ `2 V2 ]- #include <linux/module.h>) C; D/ X6 |! U8 e5 ?
- #include <linux/init.h>) |* f7 e- m9 Y; e' c, h& D
- #include <linux/errno.h>
' N# d5 t! U( O6 w& p8 b( I - #include <linux/types.h>! y2 F* ^( U+ m6 K1 K u
- #include <linux/interrupt.h>
0 x) u, N: [8 c, e' E2 d - #include <asm/io.h>
9 v6 Y* ^. b3 y% G8 w1 P - #include <linux/moduleparam.h> N# l6 D# Q7 ]7 \
- #include <linux/sysctl.h>
, `. F: h v' F0 t. U/ p# ] - #include <linux/mm.h>
8 n3 x$ J6 [% ?* g1 j - #include <linux/dma-mapping.h>
" S+ E% E$ n/ L$ P# G
) B" ~- f# T0 w' B- #include <mach/memory.h>0 D+ F! ]7 E2 y( n. ?' t2 L
- #include <mach/hardware.h>9 P4 k* r% F0 | R$ ]2 P
- #include <mach/irqs.h>6 J. {# o9 q4 Z" |* [
- #include <asm/hardware/edma.h>
& N! P L2 P- F
0 P5 R1 A4 j. a& e% H" Z! h' E- #undef EDMA3_DEBUG
+ g" J( X7 z ^* a$ y - /*#define EDMA3_DEBUG*/
7 D: D9 H( _' I+ `3 P3 R( x
/ ?* a% v) Q" _- #ifdef EDMA3_DEBUG
, O7 x9 d' q# B8 m+ ?$ ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 e o) e# z! ~, x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) M+ o& Y) q, B( l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 z9 v5 ~7 H' S# k: H7 S/ W" r
- #else
+ R" R0 r) \3 T. R' |" Y - #define DMA_PRINTK( x... )
8 l' v& h( F- R - #define DMA_FN_IN8 U. F! S+ _' D5 Y1 {
- #define DMA_FN_OUT
* ^' E2 O/ g6 {9 v - #endif9 a* n8 t: W/ G2 ]0 _8 G. z
- + e- h' `! R7 z# G" U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 c" t+ Q* b5 j
- #define STATIC_SHIFT 3
7 E, D, H0 c. s# S. }- t4 o7 Q/ n - #define TCINTEN_SHIFT 20
0 X9 d5 P/ s- J/ n: F' e6 Y - #define ITCINTEN_SHIFT 21
7 ^; N6 y% Q1 H6 Z8 t9 Q% A7 m - #define TCCHEN_SHIFT 22
$ f3 P; z; R" i6 k$ ]- J5 E - #define ITCCHEN_SHIFT 231 r4 p. t3 M& M; c
* t) v3 R5 k+ X8 |- M# T; z- E; @- static volatile int irqraised1 = 0;
v8 A5 Y1 L. Y7 X7 Z# J1 A3 c - static volatile int irqraised2 = 0;
) ?0 S4 c& c* M& X/ z; {( c4 G" t - / h" w7 T7 E# w7 u: h( K/ O* @% d1 I3 i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 s. V" j% J' X7 ?) G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# @2 Y: F. m/ Q! \* x. O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' z4 t$ i; C( M$ n
# |6 x4 ?3 I1 a7 X- dma_addr_t dmaphyssrc1 = 0;" M4 B( _5 h) y. L
- dma_addr_t dmaphyssrc2 = 0;
0 n# @. o8 l2 P( e% x$ t+ E3 k - dma_addr_t dmaphysdest1 = 0;
% _0 J- d. g$ o# m7 C2 q4 v% }' n( V5 n - dma_addr_t dmaphysdest2 = 0;
8 Y: J( n C; W& N
6 l& `# Q; D* `: r- char *dmabufsrc1 = NULL;$ {$ R1 F- o9 V* q
- char *dmabufsrc2 = NULL;
: l, O7 c/ M6 v6 P2 o) S: L4 i# {3 Q - char *dmabufdest1 = NULL;
+ N0 F1 I5 \" f" r# H1 N - char *dmabufdest2 = NULL;4 k# |+ X4 Q/ G2 d5 }* q% W
% |' n; a2 Y& F+ g# T- static int acnt = 512;* d8 r2 L$ F' M
- static int bcnt = 8;
! {% S! R3 }2 O. y! M4 N4 C/ d; R - static int ccnt = 8;% _8 h( w1 N/ k* Z
- % v* a8 i' m' n
- module_param(acnt, int, S_IRUGO);
5 B) T0 w$ C8 z& r s4 k - module_param(bcnt, int, S_IRUGO);5 W B3 f, w8 L" z% h
- module_param(ccnt, int, S_IRUGO);
复制代码 / z! P" e. Z, x
; A8 ~& s( h) h! {! e( T; A) i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 @6 D5 q5 x( [. O5 ^" _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% v8 m2 k" X% t1 J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( f, \& g, G! i$ A& s" `" C6 @" J" O. T5 g
/ J4 ~1 z$ }- R- F% w7 I9 `2 M) N |
|