|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# Y# U9 T$ [) f/ M; Q! E6 b- [code]EDMA sample test application7 N2 i' |1 k% b/ v9 K& Q
- /*' v8 h% Z- @5 n' c8 ]0 G
- * edma_test.c
: d j1 w2 [3 d4 t# i, Q7 C; T - *$ {2 R$ u6 _4 r$ a+ U0 z
- * brief EDMA3 Test Application6 n2 ]' j& q( `' }& ?
- *5 X) ?8 H" Q' m4 _7 L3 p0 h( l C
- * This file contains EDMA3 Test code.
) X4 z b* u ?, O- m9 E6 E - *
/ g. z# o6 H9 _% u7 [! [+ J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 F" m+ O7 h) Y4 @2 o. k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& j' y7 r+ A# E6 R9 ]0 L1 I - * TO CHANGE.
) ^3 b* y9 }% I" [8 t. F- m) r5 j - *
# u2 p/ _ Z- W- I3 ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# X$ p, ?: p1 v6 F3 k - *4 W; d5 q+ f' }* Y {* A3 x
- * This program is free software; you can redistribute it and/or$ d3 f0 J! }6 ?- b0 F
- * modify it under the terms of the GNU General Public License as
/ a9 W" T2 \' S. q: _ - * published by the Free Software Foundation version 2.
, n+ S, \- V' C6 B+ m$ t' W - *: q& _6 p% O9 @6 f0 A+ }; k- J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, v0 P. Y/ ]" ], `
- * kind, whether express or implied; without even the implied warranty+ ~ h; c; x# H( Y5 K& P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 k, T" K" S% ?* J# E; D" g
- * GNU General Public License for more details.2 H; s$ U2 x2 [* Y$ C
- */
7 @0 E2 \% X; w" K+ k+ D - 4 U- `2 z/ ]) i
- #include <linux/module.h>! M v' x) f1 G7 s" p) L
- #include <linux/init.h>* P, L+ G% i k4 v' \/ J
- #include <linux/errno.h>
6 @- m! s2 {. N- ~, H9 Q - #include <linux/types.h>+ a; a& L; ^3 W( @' {8 n, r
- #include <linux/interrupt.h>
6 q2 ]8 c0 P4 p, m* u y, y - #include <asm/io.h>
`8 ~4 W% M7 P% @& L - #include <linux/moduleparam.h>
8 q) m1 h$ z- _* e2 O. F( X1 J - #include <linux/sysctl.h>1 d3 l+ i6 X; e3 N3 `) m1 O9 ?2 z1 d
- #include <linux/mm.h>
, {$ [+ k- d- ]5 F( Z( q - #include <linux/dma-mapping.h>
! j- _9 ^! t+ q& ~- V4 i7 O3 n6 Q* j - ( E, M1 @, b. v" ]/ F
- #include <mach/memory.h>! M8 b2 X) f( R& N% _* l# V
- #include <mach/hardware.h>
6 \) f v; Q9 x: s; O2 P3 G - #include <mach/irqs.h>
; R6 f$ @- k5 B( T+ T - #include <asm/hardware/edma.h>
/ s$ M6 r9 [. Z- l$ U - ) P- e; b" r3 P( E! A) R8 K9 B
- #undef EDMA3_DEBUG0 T$ B. z% U' n
- /*#define EDMA3_DEBUG*/
7 I7 k% S* Z% {2 P - ! a6 u; O) n! G2 ]6 \ O: L, y5 w8 S
- #ifdef EDMA3_DEBUG( j; R1 ~3 S9 p7 I( S' _9 z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 w6 @6 M" I, Y, ~3 S6 L9 ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 F4 R& x" _; t7 c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( ?& Z; [' ?4 b! {8 y4 q$ n7 l# x+ W - #else$ O1 v8 h S7 u/ }
- #define DMA_PRINTK( x... )
8 W6 r& N, U! A' ]7 \0 I - #define DMA_FN_IN
# }6 Y( }! |5 j: b - #define DMA_FN_OUT* Z. O+ @! j7 k3 {( s- R t$ @
- #endif# J- y0 a# r# u9 U
- ; ^! ^6 o! y% N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. G; P9 _: x5 N$ l - #define STATIC_SHIFT 3
. p( e5 m; X$ d! c - #define TCINTEN_SHIFT 20/ Z4 f3 m# D! A# ]
- #define ITCINTEN_SHIFT 21
- `/ I: n- c4 j+ _7 r: e9 n5 H" n - #define TCCHEN_SHIFT 22
, Q6 W$ B9 ]' ^; o - #define ITCCHEN_SHIFT 23
/ U6 t$ {! }2 y0 w9 l - ' c' ~: G: O9 L) Z7 L
- static volatile int irqraised1 = 0;
~% Q) J" ~. {! X" s! \. O9 P/ i# F- r- h - static volatile int irqraised2 = 0;* ?# X9 x4 U7 i4 X- D6 A( s& w
- ' i0 z! y: M1 q. I% }# A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% Q4 Y. O( e' p& S; x* f: U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
w! M4 x& S& T1 [' \) ^% }) h3 Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% |; \( q1 d9 q. B: B% i! a( B/ \
/ @& b' t% d5 j _1 j7 G; C& R3 u( e+ \- dma_addr_t dmaphyssrc1 = 0;
) U* L4 Y7 M0 k8 x" N! D - dma_addr_t dmaphyssrc2 = 0;# ?6 v/ Z( H' M+ C1 P) m* A
- dma_addr_t dmaphysdest1 = 0;( Q& w3 W9 [ E7 [' T) b v2 t M! m
- dma_addr_t dmaphysdest2 = 0;$ j. s" P6 I# N r) T' P! @ J
0 j4 k: x( u) _$ i: K. i- char *dmabufsrc1 = NULL;
0 I/ G. w# {6 |5 y) E* | - char *dmabufsrc2 = NULL;
, B5 `. K1 O0 \) G0 H5 } - char *dmabufdest1 = NULL;7 _$ d3 I' D' z; O
- char *dmabufdest2 = NULL;
- N b$ A) ^3 t& o0 y - 1 }- F" n: p2 W9 _+ ~
- static int acnt = 512;, G/ p" d- R8 p. Y) y$ W
- static int bcnt = 8;
3 Q5 N6 i9 v, x t - static int ccnt = 8;
, p( Y, z% Q& W. t, i1 X% f - ' e0 Z* a N4 j; b; l! b9 S+ s. Y
- module_param(acnt, int, S_IRUGO);9 {+ W9 ]* c/ b. E! K! O
- module_param(bcnt, int, S_IRUGO);
' G* p; _! I* K/ C6 H - module_param(ccnt, int, S_IRUGO);
复制代码
/ I P2 _2 S0 A, _7 ^
" O* A/ T* \" t1 { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( _; S9 ?- l3 w$ X7 Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 G/ R2 T6 Z7 a; | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% b& z% h/ N! U, }% X9 Q, P$ B9 }
5 U! f: r/ D; b: o2 l& m
' @4 j- V9 C; X$ q) Y9 e, h7 e
|
|