|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, h9 }( y0 H# d( {2 M! B' x9 v2 e, `- G- [code]EDMA sample test application
3 p9 \& l7 H1 z! p - /*
& ^8 b# K9 N: T - * edma_test.c
6 V: B+ } T- n3 z9 R$ U - *
[1 }& q$ U" k6 T0 g" b - * brief EDMA3 Test Application- \5 L3 ^8 O+ E
- *
# i9 Q) R T0 g - * This file contains EDMA3 Test code.8 C, T; l5 n1 K" U$ G* x( y
- *
8 g/ H: f* R- _: C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, j; G1 ^2 h, J( a3 V; b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 ~; B: O3 n! f2 f4 Y - * TO CHANGE.) D8 d. m3 F- J# E% t' x( f( E
- *
; ^' r- N; I3 K, _3 n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; P, l7 B. a3 Y; ?
- *) V. N( u* [8 A7 ]8 r% q7 ]
- * This program is free software; you can redistribute it and/or
3 K+ N$ v0 f1 M: e. t7 { - * modify it under the terms of the GNU General Public License as
) p" v! T o% s) s; K) ? - * published by the Free Software Foundation version 2.
b& n) J, W ` - *1 ?/ S$ y2 N% E0 c" Q, }- I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- }7 ]8 m9 Y, B) r+ _) Q - * kind, whether express or implied; without even the implied warranty
. }: v4 n% E5 f6 ~7 j) g I8 a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 u. d9 I9 p5 Y6 h - * GNU General Public License for more details.3 K4 J0 Z) Y, n; b
- */
# [% T- d( |! E; U( ?# H
8 H9 M; m6 O7 B& E: O+ i- #include <linux/module.h>
9 A0 ]# \! I5 h - #include <linux/init.h>
' @) S, ^' n' y5 Q' ~% P! ?0 W" r - #include <linux/errno.h>
8 j3 W2 N1 K6 J- n6 F# ] - #include <linux/types.h>
`5 B: F$ ?$ c% k/ x - #include <linux/interrupt.h>
. Z% K4 v8 w) g G - #include <asm/io.h> u1 ~. u7 ]& O
- #include <linux/moduleparam.h>
F2 ^+ B' A3 n* c! Y# I: u( F - #include <linux/sysctl.h>
. Q& c! k* ]2 S! ^; f# | - #include <linux/mm.h>
: R* p4 y" S8 |+ @ - #include <linux/dma-mapping.h>: N/ X: F# P5 \) e* c4 D
3 d i" s6 s1 L3 [6 N, P/ k% _4 X- #include <mach/memory.h>
$ M7 F0 ?/ m% Q6 v - #include <mach/hardware.h>; ]0 P! k4 B- \% a0 n! U; l
- #include <mach/irqs.h>
7 p& l- [: d) }8 n - #include <asm/hardware/edma.h>$ T7 J5 J+ |; p" ?! u+ o1 Y& ~1 C" }
/ ~- ^8 U' i% f1 o4 |) X% F- #undef EDMA3_DEBUG
9 l2 E1 V' O# R+ B - /*#define EDMA3_DEBUG*/
e" `7 m/ ?) ^
+ @: y% s: I5 |3 O; ~( n- #ifdef EDMA3_DEBUG0 a1 w8 [5 Q% y$ e: Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ X, ~5 Y: D; t. U* {6 L* t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) w6 W6 f- z- y, Z( L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: O4 x& R7 n( y. o/ b/ d9 u - #else
4 }$ A4 `5 N1 P$ @$ y - #define DMA_PRINTK( x... )
8 X1 V( o( o3 h" ^+ n$ m7 W9 t - #define DMA_FN_IN
5 Q( c) x# P- h6 Z1 W& P7 _% T& o - #define DMA_FN_OUT
+ \4 B+ t! b* {6 g. h: W - #endif4 U6 ?- H4 {( r7 X. R5 V
- 1 ~1 K* s- ], K e" c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( A+ m9 a9 z6 I+ b% t! a* e& f - #define STATIC_SHIFT 3) [6 T1 v# Z! R' \ v
- #define TCINTEN_SHIFT 20# z* _ i9 p( @+ g3 I, s
- #define ITCINTEN_SHIFT 212 l, P# h; {$ r, U r
- #define TCCHEN_SHIFT 228 W- l$ B* t5 I% l
- #define ITCCHEN_SHIFT 23
9 J r4 i6 {. I - $ X) H: K. E3 E7 S7 H c+ E
- static volatile int irqraised1 = 0;# ^; D8 C9 p: s
- static volatile int irqraised2 = 0;" i; O1 K2 v4 u- F* z* \
- / s# |5 K* E+ ]1 l4 V( p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& D+ L2 c7 S- Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 u; a5 E! p' g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ?. K; \' i( J9 U7 Y% i' {& w6 t
- , Q! K; z7 K* q. @! y
- dma_addr_t dmaphyssrc1 = 0;
7 V9 Y1 S- S7 Q - dma_addr_t dmaphyssrc2 = 0;
% w; J0 ]9 _/ S% V' x! c - dma_addr_t dmaphysdest1 = 0;, x7 t; ^8 F/ N/ s6 j `' a8 `
- dma_addr_t dmaphysdest2 = 0;8 j. O2 s( @" Z; i: \! j' ^( Z
+ K' Z. B' c* J# i* S$ y: e" a Q8 K( U- char *dmabufsrc1 = NULL;
% w- K+ Z0 c0 U - char *dmabufsrc2 = NULL;
" R, V w9 Q, z0 y% p, l- P - char *dmabufdest1 = NULL;
, T* c* G) T) [0 L: |) J8 s - char *dmabufdest2 = NULL;
, c2 a/ J3 z8 o: E
6 o8 {* k4 G8 z1 w/ v, m0 v' M' t- static int acnt = 512;2 K( W. i% e# i" R
- static int bcnt = 8;
# \2 Q" `4 a9 X$ H8 ~ - static int ccnt = 8;1 E% ^4 G" N! D/ R& m' g8 i
2 J* b- _! g7 W, g! o' Y( R7 O6 q- module_param(acnt, int, S_IRUGO);
2 [ N- }1 I4 O3 v& q* u! S3 n& K - module_param(bcnt, int, S_IRUGO);$ a5 ~ k( e& T8 m$ X2 k& R) Y
- module_param(ccnt, int, S_IRUGO);
复制代码
2 ^/ k7 [' D1 J/ Y$ S. R. X* O7 i/ _' }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. v8 t" G6 T9 s0 V% ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; l+ O( l4 O; h3 ?2 Q3 s2 O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% u* Z* k" L0 w, d2 T
* ]" h) N+ P% a& J2 v
1 v8 {! \" V$ i, ~ |
|