|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 x* q# P6 R$ o4 C( [& G
- [code]EDMA sample test application% |1 Q% _$ p$ [$ P, {$ ^
- /*
7 `* @$ f8 _ k" A2 D4 y - * edma_test.c
! `7 {8 K! s0 b O; C, c - *- X! a5 }! F8 f* h' \
- * brief EDMA3 Test Application
& n% f3 Y8 a: C# u2 w0 d# e; V - *
+ N8 d- L; s6 I$ P) y) i - * This file contains EDMA3 Test code./ y8 c0 R! L* O6 E$ b) ^
- *
8 y( u! Y6 s7 A$ b. r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. g* L$ I0 X6 L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: K& ~5 l! `. u3 E - * TO CHANGE.
- P( g3 q. y2 a5 x: n! Z1 \# l - *
8 C: U1 v% O" u5 [1 y; w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 \, C6 ~# w* }( v, |- Y$ e% X/ H - *
7 a% R3 D2 [) D4 l - * This program is free software; you can redistribute it and/or4 B0 Z" b& B% I. Q' ?2 d- _
- * modify it under the terms of the GNU General Public License as5 Y, ?& n% b& }( b' Y; R% O
- * published by the Free Software Foundation version 2.
/ _4 s* f) g# p5 M, [ - *
. ]% f/ D: S2 p6 S% z1 k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ q/ E7 F3 S U
- * kind, whether express or implied; without even the implied warranty& e5 g# r4 b( R' S' w* @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 p: c6 d' |6 q! o0 F' y$ d6 g0 T
- * GNU General Public License for more details.$ a6 z9 z6 k; F. S# X
- */* F: m/ `. B8 N; z% b1 H' R6 _, b
- , W; l% ~ `8 M8 L( l+ h
- #include <linux/module.h>
# P- q9 x& [, ^% `8 ^7 Y$ c - #include <linux/init.h>
9 ]! S" X* l; g - #include <linux/errno.h>
0 W: f9 \9 ?" s0 a - #include <linux/types.h># k, C% Z7 P0 }; Y& f5 Z+ u# ]5 e* E' y
- #include <linux/interrupt.h>
- ?- ]2 O/ V# `$ I2 u - #include <asm/io.h>
. n- y+ Y% ~/ f/ r - #include <linux/moduleparam.h>
% M$ S$ u2 ^' J( n; f3 l k" w - #include <linux/sysctl.h>
6 B) q' e; d4 \+ B - #include <linux/mm.h>
' t& V! e% C5 s5 W1 j - #include <linux/dma-mapping.h>
2 P' D5 f5 I) m% u" a$ C3 f - # [) h6 _; m# f& i, A2 Y/ Z
- #include <mach/memory.h>
% o6 ^# j1 V) o% H; A* A - #include <mach/hardware.h>, ^0 ]' }. r* o
- #include <mach/irqs.h>
$ q' A1 c# a0 {. U k - #include <asm/hardware/edma.h>! d# h' L" f+ v3 g u
- : j) ~/ d% A+ K1 ^
- #undef EDMA3_DEBUG
u. o7 a( H9 Y* z6 ^; j - /*#define EDMA3_DEBUG*/; F K4 E. {7 l3 {
& D' y- h/ C. x2 K- #ifdef EDMA3_DEBUG8 Z$ g, x) |+ h0 B) O; q7 W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 g7 s' ?- Q" L( H& I9 s" Z. v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 ^5 f% V2 i: @' F. B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 I) `- E2 k, Z9 |
- #else
) Y3 D+ T P2 y3 L; F( l6 D B - #define DMA_PRINTK( x... )
: l% j- B' G* ]: L! Z4 y& u - #define DMA_FN_IN7 n0 ^+ P4 s/ v6 j- X" L
- #define DMA_FN_OUT
4 l2 y, s7 V& G# m5 y: ^5 ^( N - #endif" H8 ~, [ A7 w ^
* v. z6 ?" W8 x& j& k7 B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 H: p3 R' g: }3 {7 f" A - #define STATIC_SHIFT 3
3 X5 G9 _5 C1 ^- s - #define TCINTEN_SHIFT 20% W: b: J/ ?! R Y; S6 v% N
- #define ITCINTEN_SHIFT 21; Z: C- J/ A8 i" N9 z) t$ B7 z0 m
- #define TCCHEN_SHIFT 22
, {# C0 K( L- w9 v1 c - #define ITCCHEN_SHIFT 238 `$ _% a: L- T( s5 o' I
1 r5 J' Y* Q3 ?' e+ z$ X2 p4 u- static volatile int irqraised1 = 0;9 H2 x7 z4 }2 B# z0 L1 O
- static volatile int irqraised2 = 0;
2 x9 q8 ?& V) t5 O$ ?' ]
8 }& J" F& r' \' y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z9 K, u# b/ R& q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ~; q- y. m! |! }% v- m+ M' g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 y# S7 u+ w2 L* v
' R- K# s, Q2 c+ W# C3 K/ Q- dma_addr_t dmaphyssrc1 = 0;
& }' l4 v1 ^0 c0 I. n! k. g - dma_addr_t dmaphyssrc2 = 0;$ v0 b8 F$ b1 c- f) Y
- dma_addr_t dmaphysdest1 = 0;& a3 P9 T5 k9 s! \
- dma_addr_t dmaphysdest2 = 0;1 S; X' X2 ~$ c0 U$ [, }. g
- T% N- e9 b# K2 u$ u
- char *dmabufsrc1 = NULL;: n5 o2 v! }* `; x) L
- char *dmabufsrc2 = NULL;& w$ q& z w4 n& G! f( P. W
- char *dmabufdest1 = NULL;( Z1 H. r8 y" x+ @. T R9 S
- char *dmabufdest2 = NULL;
0 ^5 |3 K" x5 d; ]1 } - " X& i0 G+ k- d6 Z/ Z* S& ]! N# p+ a p
- static int acnt = 512;
- j/ p( u) o, r: B: I) C - static int bcnt = 8;) x2 S. W& x, l4 ?
- static int ccnt = 8;
4 P" |3 z% }4 | - 4 p: D3 a& E i) G5 B
- module_param(acnt, int, S_IRUGO);1 s* R& h3 [$ W |/ x5 s
- module_param(bcnt, int, S_IRUGO);
Z4 W% H* \+ \- d& \- j) L - module_param(ccnt, int, S_IRUGO);
复制代码
' f0 A+ O! _. a8 w$ ?1 f
h( W. j% r' Z, R0 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 s( B' O/ T1 h; parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- x% q% v1 v: w- k' i) N6 h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# W1 F/ P& {$ {. p0 ?
d( s& d, A c1 W8 P) @( G( L# E5 _8 `. l. S9 N
|
|