|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " ?& Z/ y9 q/ s! A9 L$ A
- [code]EDMA sample test application' L2 u/ v5 H4 x$ D9 V
- /*
# K. F. F/ ~2 X - * edma_test.c1 [5 G) z3 h9 j6 V6 r
- *, @+ @) k7 U- q/ m8 T) [% u/ \
- * brief EDMA3 Test Application
3 U2 J0 T* ]. }- F0 T% C2 Z - *
0 D) A: M" z2 d6 `4 y - * This file contains EDMA3 Test code.$ l6 e9 ~, P7 K- x
- *1 G9 }2 F1 J' I3 s2 t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 j; f* K1 @* r/ q, m3 l4 ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# q& z6 N! E) Q0 u( v" g: g' w
- * TO CHANGE.
, U' h1 Y r* r: m* j( Z' f1 |0 P - *
4 S/ x9 r3 a5 n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, y: r/ m% Y4 Z) p% r% G# e - *$ I* j: \8 b5 N+ d
- * This program is free software; you can redistribute it and/or& Z: a. p% R6 D: W" a; ]0 y
- * modify it under the terms of the GNU General Public License as
}, W* P2 ?) j# ^: e, Q2 t+ L - * published by the Free Software Foundation version 2.+ u8 X5 T; V$ Q/ V, t0 D# S# \
- *3 }1 E) C& P2 T6 }8 c% _, l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 z& s: l1 z- z: m - * kind, whether express or implied; without even the implied warranty" m: a. k# L i8 l' ]7 Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* J; W) c, A+ m L( _
- * GNU General Public License for more details.
9 K9 Y( G( n* n2 g; [3 J - */
# A9 m+ g/ a @
3 Z5 ]# Q0 U2 s4 C- #include <linux/module.h>
( `4 M. A: ^& Z$ l/ Y! c - #include <linux/init.h>
1 R5 S [7 T# z# L6 ]5 z3 O - #include <linux/errno.h>
, p+ @& i! p7 D9 U3 w( t - #include <linux/types.h>! N* x- e# @: j [# \" W
- #include <linux/interrupt.h>
8 U/ R9 C1 l1 B8 x, [ - #include <asm/io.h>4 v. V" v2 }! v
- #include <linux/moduleparam.h>: V- I6 O+ T, n7 @, R
- #include <linux/sysctl.h>; P5 q) H+ m- W. X# P) ?( _2 V$ T
- #include <linux/mm.h>
+ c& f- t3 {$ t+ F+ H* c7 V - #include <linux/dma-mapping.h>6 x/ I; a8 N- B5 ^' d8 ]& B& z
4 }7 U. N& z# l( ^% B- #include <mach/memory.h>
' v! ~. ?" c6 I% `6 o - #include <mach/hardware.h>; B u9 ?& ]2 @, m6 T
- #include <mach/irqs.h>
5 t0 z# R+ K! Y: X - #include <asm/hardware/edma.h>
% `6 O. g" K' \0 M6 L. W
, w h# v ~ G" G# z0 d- #undef EDMA3_DEBUG
& M2 @1 s1 j+ @" ~- w! W& ~$ R - /*#define EDMA3_DEBUG*/
! P) v! k) L' D. |5 M
5 M, k. s9 k. G, d9 I- #ifdef EDMA3_DEBUG4 @8 H% t$ r% m' ^4 h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( z8 }+ |" k3 v Q! k. C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) @+ W4 q6 l$ ]3 K( ~& {/ O$ V5 Y0 Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& }7 \" W. ^# S) `. ^7 G - #else r7 v6 M: Q& q) `: ?
- #define DMA_PRINTK( x... )
4 j5 y! E0 ?" T; R8 K/ e7 L( U# I* Z - #define DMA_FN_IN% E' ]* \: K4 n/ c" F* g+ ^2 v
- #define DMA_FN_OUT
- e3 u! e9 ^+ a: C. \# S - #endif
9 s0 A. `! S, Z( I8 a% d
/ G$ s2 Q1 c& n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 C4 v: g' s8 t - #define STATIC_SHIFT 3( S3 B; B3 \( A B
- #define TCINTEN_SHIFT 20$ R0 ~* F8 {1 K& ~# {, f; q2 ]$ Z* ]
- #define ITCINTEN_SHIFT 21/ W/ C& n: }7 h/ m0 Y9 c
- #define TCCHEN_SHIFT 22
# ? q( A4 }2 t. s" [) g - #define ITCCHEN_SHIFT 23
# a7 S, d! j. K# u$ s) H- m1 f2 Y. P
R3 |7 _5 e6 F- r) c8 G6 g0 @$ F, n- static volatile int irqraised1 = 0;
& p# P, Y0 {; V8 q/ p. R - static volatile int irqraised2 = 0;
. q9 C$ X1 p& y( O3 p, Q& y3 u. O
8 O; q; Y h0 K4 G; L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" k) |8 c' ]2 P# z: }% [8 H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 \# g4 U8 M" u% S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& z$ ?% h- F- w; L
- 6 k# w/ G- V7 V6 b& h
- dma_addr_t dmaphyssrc1 = 0;6 q$ K- g4 [4 l6 W* o2 \8 x
- dma_addr_t dmaphyssrc2 = 0;
& y' a1 a( `- x! W/ j& l - dma_addr_t dmaphysdest1 = 0;; p! z# N, g. r& W- I; y) C k
- dma_addr_t dmaphysdest2 = 0;' |, C- @' g/ \: E& J2 v8 [0 _6 N( N$ b
# q- t+ D/ d/ x. \- char *dmabufsrc1 = NULL;
: x# j! Y( l* b - char *dmabufsrc2 = NULL;
% I+ r! Y) `2 W" M/ h3 [; v - char *dmabufdest1 = NULL;6 h) t. p% m/ c |) R7 X5 T
- char *dmabufdest2 = NULL;
u! z k9 e. t6 p1 v( @ - 5 d2 }4 q6 B+ D$ J
- static int acnt = 512;. k/ S+ i8 B; G+ z0 y" M# ^
- static int bcnt = 8;
" U M- s f# T* s! l! p - static int ccnt = 8;/ ]) W" n( L& r1 c: m
: V* ]. S# a5 r, X; ~: |- module_param(acnt, int, S_IRUGO);+ C) g5 Q2 K7 ]6 P% l' j7 B
- module_param(bcnt, int, S_IRUGO);
4 @* w! r* z; e# T! T - module_param(ccnt, int, S_IRUGO);
复制代码
3 c `* o2 K$ u$ w. A! u: e% q V3 j p. A7 M8 }& o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 x; U: \- Q( W8 u# x3 n- G1 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- K+ R7 v; V+ s$ l6 \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. z5 C: `8 e0 g6 L& h" ^/ o; Y2 g# T
/ S3 {9 }. H" V6 `6 q/ |( O
|
|