|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 o- [/ Z" U, E; y* L# {
- [code]EDMA sample test application2 V- a2 a2 m0 q% s& Z
- /*' Y9 J6 I9 H( F( @6 R6 C! `
- * edma_test.c/ F3 C0 c7 ^9 K. J9 x1 r- V6 D
- *
) P, m0 |; Q {$ b - * brief EDMA3 Test Application
& p6 k/ e4 }8 f: q2 h - * ^) ?% t; v% `2 F
- * This file contains EDMA3 Test code.
: i0 K, q; d7 K9 ^4 S1 z - *# ^* j; t9 j$ [5 }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ x$ ?* G5 H- X3 N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 ~) B# m0 ]- J$ I
- * TO CHANGE.
2 c% L/ r; K+ z- R$ A; f - *
# E8 w2 c" |' G2 F( ?8 B6 r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 n5 G7 H' C/ a5 a0 } C9 ^- n, s
- *
* l4 p4 Q9 A0 M! K$ q0 C - * This program is free software; you can redistribute it and/or
" B3 J- M2 y! w; T3 @; P - * modify it under the terms of the GNU General Public License as
* O& p& F8 _$ a/ b t - * published by the Free Software Foundation version 2.7 D) \) G @/ x, E5 v- Q) W
- *
6 J! Z- t/ F0 U2 @2 d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ J# u& B5 ]: n7 c9 p2 m: }+ l - * kind, whether express or implied; without even the implied warranty
. l" z+ {* ~2 w6 M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; n! r+ \: ~" V! H& h# r: ^* P - * GNU General Public License for more details." G6 Q: ]* z6 { L
- */
6 `. ~! J2 u# N6 \4 ], e4 Y - ) N' Z9 O% h; q: @, k$ X0 ~
- #include <linux/module.h>
6 S+ I3 b" L( M4 |; o - #include <linux/init.h>
9 \# V f0 u2 ^9 g& F! C - #include <linux/errno.h>
( j0 f+ M# P, ]/ t9 K - #include <linux/types.h>
5 R) _# i5 \5 i9 u, P - #include <linux/interrupt.h>
1 Y! M7 O! ]; I5 l9 m+ f+ d - #include <asm/io.h>
% _ @9 h* z( u- g; R5 y% g) U% R - #include <linux/moduleparam.h>! G1 B& f; a8 n
- #include <linux/sysctl.h>5 A- q7 \4 w! ?' G/ t1 _( M0 ?1 t
- #include <linux/mm.h>; S1 M* _, |& m9 L! I) ]
- #include <linux/dma-mapping.h>1 O# G0 U0 ]) ^# _! G) B! b% Y8 M
3 G5 s7 {. {7 t- #include <mach/memory.h>
; m& L) T5 T% d2 o. {! w - #include <mach/hardware.h>
9 ?- [ K5 s; ~) D- | - #include <mach/irqs.h>
4 C" x' k4 h4 B0 R- i1 g - #include <asm/hardware/edma.h>
9 I* {9 c: D/ S8 b4 p9 B
- ?+ H; M' e1 }$ p/ T- #undef EDMA3_DEBUG0 ]* W- O6 q1 {( D5 W6 S
- /*#define EDMA3_DEBUG*/! M! S& `8 A) W
) S8 k. O V! H8 q6 i* n& N- #ifdef EDMA3_DEBUG( t- @6 s( e4 L) n5 a1 k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% }% S! v. W2 L' _/ o) q# ^3 x3 u) M& T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( n. f \# I3 N" c0 Q% n- T9 R: y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 ]& p+ K3 W$ |1 ]1 O' m - #else
2 ?. g4 D' ~8 x - #define DMA_PRINTK( x... )
% `/ j$ S" N5 L" A! d4 } - #define DMA_FN_IN( d5 X& Z) V# ~- _( k( E& Z' \
- #define DMA_FN_OUT+ U# y& _- d1 u( j7 T
- #endif
* h5 ~2 m4 M' D4 d- X4 d4 ~ - & X8 y3 I; z; }1 v+ Y3 f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): |7 h* o, A. ?2 h9 b
- #define STATIC_SHIFT 33 f8 X) s9 q: D& p! `" o* f
- #define TCINTEN_SHIFT 20$ ~4 w3 {' C+ J5 d
- #define ITCINTEN_SHIFT 214 o9 h1 I. s! L" U+ j G ]( n/ E
- #define TCCHEN_SHIFT 227 [' e: X8 C( k) A y' b+ A
- #define ITCCHEN_SHIFT 23
R8 N; }! g" }; d+ {6 ~. f4 l+ ^
/ w* g) j9 \2 G/ E- static volatile int irqraised1 = 0;% L5 Y1 _! U$ u" d: H8 B4 ?" V9 g
- static volatile int irqraised2 = 0;
6 j7 h8 r4 r' L: Z' F2 Q4 Y - 9 w3 X" U4 Z: C" n+ ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ f F" x8 V, G5 t$ w; c: g- S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! @/ n6 m( V& C5 Y% p- j3 o# E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 G2 P) M$ j* V/ F S+ J
`0 R$ X W3 y- J5 z- dma_addr_t dmaphyssrc1 = 0;
" i! q) \; i% p - dma_addr_t dmaphyssrc2 = 0;
0 ^5 Y: J7 \9 |' p. m - dma_addr_t dmaphysdest1 = 0;/ ~% R4 ?" x% O4 t% a2 d
- dma_addr_t dmaphysdest2 = 0;6 y8 U5 m- n* V0 n
" \) c' D, k6 [, d) `- char *dmabufsrc1 = NULL;' |! E+ ]) [/ o1 ?/ f% v) s2 k
- char *dmabufsrc2 = NULL;& t6 \! ^9 i" q' }1 x
- char *dmabufdest1 = NULL;
- y; Y0 o& i6 O6 E& y" ? - char *dmabufdest2 = NULL;" l- u: M. f- u" @4 V$ k
- $ b9 A0 D% ~0 i7 d3 u! Y
- static int acnt = 512;
7 V/ q; f# ]+ i" q: j; ~# M - static int bcnt = 8;
: k |8 p) T: T2 _ - static int ccnt = 8;! _1 l3 E: x8 T& f5 X- L
* F+ y" }' G$ y' h( z- module_param(acnt, int, S_IRUGO);
+ G- Z/ T+ f2 [' y* b% h7 X - module_param(bcnt, int, S_IRUGO);
/ b; |( a6 ~9 G* [1 k - module_param(ccnt, int, S_IRUGO);
复制代码 4 O0 p+ u+ P# _$ `2 W3 n# i3 d# J. z( a
$ X3 p, C/ r& a6 @& Q* ]# f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; W. ?' r, t" C2 F$ ~/ V& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 ?; |% K9 W: s1 O J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' k# H G% S5 k, |# S c
4 B' y7 h) c3 e& B3 {7 [4 v
* p1 \; U# P- ~ Z2 a; j) J |
|