|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 d. P# u& E% P! t7 N- [code]EDMA sample test application
, M2 h( O0 Z# }% Y) c/ u - /*
2 P% K9 W# e% A - * edma_test.c$ ]: ?! e- P& {, P. C' N# E R
- *
# |# E. D& y. ~6 e! l [ - * brief EDMA3 Test Application
3 B+ D# l* z+ V/ n( w; o7 x2 L! i - *
( Y# r$ C2 k: @ e - * This file contains EDMA3 Test code.
2 E( Z1 o% }6 {! L& S' i" v$ f - *. |% D0 y+ |2 h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; y. D1 M0 a% M3 s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 Y( ]# F5 ?# Z
- * TO CHANGE.* S0 d6 A3 [ A, H1 G T ^
- *2 J+ _. V* c+ [3 w1 a6 W7 }4 J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 `/ D' D, ~. Y! c, h - *2 A% q, g& d8 D, i" g4 D* t* G
- * This program is free software; you can redistribute it and/or
( n5 q6 R) @: ~& d" h7 Q - * modify it under the terms of the GNU General Public License as5 o. o0 K& J; M; a8 r3 i& \
- * published by the Free Software Foundation version 2.
% B5 l2 v; }3 w - *
" [7 L2 a1 Z2 c3 @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 O8 r* _; a1 W - * kind, whether express or implied; without even the implied warranty
e$ c2 [0 n. { Z& E! r4 F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. V$ _! A: ~ B: L% V - * GNU General Public License for more details.
! E% I1 }5 p2 c# G7 |$ G - */
8 b W5 o9 {9 E0 ~6 C/ ~( z6 _# D
: D3 I. w b1 u9 c& J K9 A- #include <linux/module.h>& s! \2 S3 L' J- ~! p I9 e% r
- #include <linux/init.h># `) ?1 J0 @/ j% s5 \, C
- #include <linux/errno.h>& u# M( P' k9 s D! o, Q
- #include <linux/types.h>
7 z* J, o6 y4 v# q- I - #include <linux/interrupt.h>
5 V# T' J! K/ t9 q f - #include <asm/io.h>
4 x l+ W, z+ f9 m( Z7 L6 U! c - #include <linux/moduleparam.h>+ {/ u8 v8 M/ y6 R& t
- #include <linux/sysctl.h>
- }" ?# q! O/ A: d - #include <linux/mm.h>
- }( ^1 M8 \0 _- h - #include <linux/dma-mapping.h>4 a! K7 h$ j1 H2 j9 D0 J
; e/ P! N7 b H/ s- #include <mach/memory.h>
8 {- s) o' r% j4 E$ S' B - #include <mach/hardware.h>* l5 B0 C6 W' n! _3 K
- #include <mach/irqs.h>, y. p$ t5 g- f6 O* a9 A8 S
- #include <asm/hardware/edma.h> @0 S- t+ ]* U2 s. G
- ( Y( E) X) Q) d7 q
- #undef EDMA3_DEBUG
- N" o; K. V. e - /*#define EDMA3_DEBUG*/! N; y/ v, f' i9 B
- ) {% H. T% Z6 Y" }
- #ifdef EDMA3_DEBUG3 B9 u! B0 ?- h* d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' P' }) Q7 `: R* O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
j- G* U5 a- l/ p. n2 L/ j5 G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 f6 I+ C# T$ v
- #else
$ X+ A9 W, x0 q: S - #define DMA_PRINTK( x... )$ q2 s1 C; l- t; T# U
- #define DMA_FN_IN
: W, i4 U6 |1 I/ `1 N2 V - #define DMA_FN_OUT" B: I3 L& j2 U$ S
- #endif
8 P2 E- N0 Q- A& k - 9 H& A0 Z5 S) {3 g% n6 O" @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" A2 c7 u, Q# m2 F3 U
- #define STATIC_SHIFT 3
8 i0 ^) u7 G& g6 a4 E$ o5 L - #define TCINTEN_SHIFT 20
. N9 a# ]* d1 m" A# d) K7 t. @5 H - #define ITCINTEN_SHIFT 21
; `( J% K( L" h* f) w1 V3 j) X - #define TCCHEN_SHIFT 22
4 S- M2 a# \" b& r, ] - #define ITCCHEN_SHIFT 238 w3 G% S4 y& q: q$ w( V- s; b
2 B$ u$ v! h7 R1 M+ y- static volatile int irqraised1 = 0;& w- G4 U# V9 u7 q# {( N. i
- static volatile int irqraised2 = 0;0 \ `' J* ~ i P5 z
0 @0 ~1 ~, W) F. @9 H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 @: ^6 K! G4 s3 u6 p6 ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 \. N& f: Z( g6 q0 }9 p; s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
~( f, e S: B% q1 O7 V7 t+ | - ) T* w& G3 H2 X8 d# ~' D1 w4 j
- dma_addr_t dmaphyssrc1 = 0;' _6 x" P" i& C( `1 C& O
- dma_addr_t dmaphyssrc2 = 0;
! ~- K- p! _7 W# h$ @ _& I$ r - dma_addr_t dmaphysdest1 = 0;4 a5 k h+ W' V# r; }
- dma_addr_t dmaphysdest2 = 0;! `3 W% z& C! o8 S
- 4 U! Y* I# z% p }6 j. B/ ?: L
- char *dmabufsrc1 = NULL;# G: `- N4 l$ }& l: e4 q- e, E: O3 {
- char *dmabufsrc2 = NULL;/ D$ j$ g4 P) p1 w
- char *dmabufdest1 = NULL;9 e9 t( ?# |2 y! O" N& d
- char *dmabufdest2 = NULL;; A8 F- N: K7 o9 G. j% y
q0 G4 x. U1 o' A5 W) k$ U- static int acnt = 512;
4 |$ R8 f- r% H2 e5 u" E - static int bcnt = 8;
) n' n+ Z2 n e2 x - static int ccnt = 8;, |7 p! W% z& ?4 p7 l8 p A
- n/ g$ W: c6 k. D- module_param(acnt, int, S_IRUGO);! P8 H7 x6 C& m8 \2 O2 t! t& g7 I
- module_param(bcnt, int, S_IRUGO);
9 l- Y0 O3 z3 G6 c9 t - module_param(ccnt, int, S_IRUGO);
复制代码 # x! `0 b# C+ V2 V
7 x; k1 K0 m7 n, K8 x- i! a, L. S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& r* I. {- i! C* @8 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 q2 r5 F5 c& @7 K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" b) p& X& i& U; I1 O
9 u) H$ ? e: X4 V! \/ |; G- O+ ^# |
|
|