|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " @4 b$ @8 m/ v
- [code]EDMA sample test application
: q2 y9 a3 i' G1 | - /*
! M/ Q# D! D- s4 a, ] - * edma_test.c% |8 a3 h3 q% d0 t
- *
2 Q9 D- j* k; s - * brief EDMA3 Test Application
6 j! A: Q) n# S - *; d+ d( u# {4 ~2 A
- * This file contains EDMA3 Test code.
( T: x7 Z! U1 l - *
) j2 r% O3 `3 z J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) R3 U' u2 {( W1 P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: {$ J [) D$ c) o9 @. o - * TO CHANGE.4 n' W( \: T1 {' u$ u) ~4 k
- *. r! r& V6 K7 f4 _( O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% i& }1 T3 i# l+ u - *- a& z. S7 J; N7 x9 n
- * This program is free software; you can redistribute it and/or! M, H4 A: p! O+ h* R. \9 C) v
- * modify it under the terms of the GNU General Public License as( Y& q$ f8 H. ?2 \, h1 R# ]/ T
- * published by the Free Software Foundation version 2.6 A* X/ U" j2 p7 a6 O
- *! e$ Z/ o J; |' |9 \9 k1 E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% ~% c) G' s) H1 l! @! `8 U6 w
- * kind, whether express or implied; without even the implied warranty: u- Z+ H. F3 h+ U! V- N! ^- @; v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 ~% i. c$ e& R* m& Z+ l& k - * GNU General Public License for more details.
$ a9 ^+ {7 b+ d/ a. r j - */$ p/ l0 W/ V* e1 R# P- [$ B; ~
- ' @, @, }' g7 |% J$ X8 S
- #include <linux/module.h>8 H! q- V b$ \
- #include <linux/init.h>8 W' G9 g. X& E6 F% w1 P4 t
- #include <linux/errno.h>
0 \/ K) @- w! F5 ]) }" b) P - #include <linux/types.h># Z9 D/ H3 f8 Y8 P" c, J2 e
- #include <linux/interrupt.h>, z8 r# @& m. q& B
- #include <asm/io.h>
# D9 l+ M- S0 h& e w% s0 f1 v$ n - #include <linux/moduleparam.h>
3 Y& W% W" W" o& {, I: Y5 M - #include <linux/sysctl.h>& @' K1 k7 `. u. V0 ~( Y
- #include <linux/mm.h>
+ ? y- a9 |& M - #include <linux/dma-mapping.h>
( i2 s( x: C$ z - $ T, s8 |2 F2 j1 p
- #include <mach/memory.h>
- a8 f. ^4 y. e- g- w4 ]6 P6 F6 X - #include <mach/hardware.h>
& P4 A6 |! e: H) k - #include <mach/irqs.h>
1 c1 x% A( p1 L - #include <asm/hardware/edma.h>
3 H$ S* t# p( e3 J) l1 [, u
% f3 ^; Q# A1 y( y, m8 m- #undef EDMA3_DEBUG$ L) k4 d' s5 I7 ~- a( n4 r" p
- /*#define EDMA3_DEBUG*/& @. f* G7 g7 }' A H8 y
- . d3 R3 h$ ]/ F3 D- |
- #ifdef EDMA3_DEBUG9 n# W) q, q) k, ]$ E$ o. a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) y0 h/ g5 n2 S+ R: V* I6 L* z$ y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): K' m$ Y. B* w7 h* U$ ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): X a: u" W! N' P3 L. d4 y& U, g, Q1 c1 z
- #else
4 y7 |+ Y1 F4 [+ L4 [* D - #define DMA_PRINTK( x... ): a9 p7 ]" i( \: z6 j
- #define DMA_FN_IN
& P( z0 Q& @* o' \. | - #define DMA_FN_OUT
$ F4 b9 J6 s! E) [$ \- K - #endif2 q# w4 u2 G4 [
% g4 n. O: e! t$ m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: E( i i& }" a: B- _" e0 Y! C - #define STATIC_SHIFT 3+ m! s8 u7 N# s+ n) F
- #define TCINTEN_SHIFT 20
( F1 c' i1 u5 \# F7 M! [2 h( T - #define ITCINTEN_SHIFT 21
% m' S+ f+ y3 o1 J - #define TCCHEN_SHIFT 22
6 k- j0 d: g8 X# w' l" F - #define ITCCHEN_SHIFT 23
* @6 d8 ^# c& |9 _! Y - & T* [9 i! X6 E7 o% G* E+ o5 Q
- static volatile int irqraised1 = 0;1 G/ r9 f* N$ T& h Q( e/ R$ l
- static volatile int irqraised2 = 0;- p, e& F- W) K3 K- S. q
* M6 M [! s6 N; z, J4 b. R9 H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- e% |, R1 [( v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% u" m- g0 r4 A& L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) k S& A4 }: a& a6 t) J m. r
- # y' Q5 X3 o3 i1 ]4 B' u# p2 h: b
- dma_addr_t dmaphyssrc1 = 0;8 _8 M/ y! _: C8 Q) k e) _
- dma_addr_t dmaphyssrc2 = 0;
8 H5 e4 ~- s+ z- k3 u - dma_addr_t dmaphysdest1 = 0;
9 u8 Y6 Q* E) g - dma_addr_t dmaphysdest2 = 0;( Z4 z' |& [& u9 H
- . I5 V8 |" ~8 c# D, N( T8 a
- char *dmabufsrc1 = NULL;% ]9 j; R) s/ L$ C9 Z
- char *dmabufsrc2 = NULL;
0 l, `& ~, c4 Z6 r) x! D$ X - char *dmabufdest1 = NULL;0 f3 S1 u+ \- O. l6 S ?
- char *dmabufdest2 = NULL;# m7 J6 m+ B/ L2 x+ C, P
- ) z3 r! e# |+ w
- static int acnt = 512;' p* V& E6 C( X F/ _
- static int bcnt = 8;! G) n4 {" o& | d( L1 X
- static int ccnt = 8;
" e3 G% y8 ^; x: o - ; U2 W; K; m. ^$ u
- module_param(acnt, int, S_IRUGO); P8 X2 w2 B6 ` G0 i/ ?
- module_param(bcnt, int, S_IRUGO);+ k* @. e9 D7 t3 u
- module_param(ccnt, int, S_IRUGO);
复制代码
q2 a/ P5 |3 d# i2 C2 n4 g; a! e) j; {7 E; I8 e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 j3 E) q$ A. W; v( ~) F7 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- r$ C' r- Q/ u' q/ | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! Y' l; ]9 {% q9 F( ?9 B8 b5 @
$ A0 M$ Q' v. L$ @. G3 {) g) k6 F& V; {) G& [% S; E
|
|