|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 G* k+ q/ N) J* g
- [code]EDMA sample test application
; r8 h$ m7 U) a1 n+ E& N6 o - /*: X& t" P# H& ^" h w
- * edma_test.c
' `9 d/ O) V8 g: c - *
4 Z! i' g0 q8 ?( }8 B - * brief EDMA3 Test Application# u6 |" c6 t5 {2 W0 C: B
- *" L1 {7 h: e( X) V+ y# T
- * This file contains EDMA3 Test code.) `7 y [" B: v; r. C
- ** j# a& h4 H! }' K2 o: f0 b. d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ D9 O3 z4 a: ?# | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 y$ o- c! y5 p% ?1 g& n; X" m - * TO CHANGE." F- J% \ ~$ L8 Z: T
- *
) p7 U1 _7 T( i" \% C1 L$ r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# |8 t. |( t8 C' }2 z - *$ r7 Y7 w, P# I7 s/ Y7 ^) N/ V+ u
- * This program is free software; you can redistribute it and/or; A+ D; e b) `, x- r1 k" P
- * modify it under the terms of the GNU General Public License as
( {6 s: e/ T! q+ g - * published by the Free Software Foundation version 2.
- p' t; x6 d: n: F1 R" Z( @ - *
6 B; `/ t* ]" x/ v! W7 f1 ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& }1 {8 c& A4 C( {& w" S }
- * kind, whether express or implied; without even the implied warranty
! ^0 t) ?) \0 s+ h+ P h d( k! z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; g9 [8 s( t; W( [3 a3 F, Y
- * GNU General Public License for more details.
. H2 J; v V. N3 v& X7 l& w - */
! T- E/ n" F# Z4 O9 S/ ]
# _. H% c L. s) N4 g- #include <linux/module.h># {- ~$ L6 ?& ?0 `, f
- #include <linux/init.h>- R& b6 o: t* T0 K
- #include <linux/errno.h>1 s& f+ t# l+ W5 X1 a' T
- #include <linux/types.h>
* i0 _8 s/ i2 j( s2 I - #include <linux/interrupt.h>
W/ U8 F$ u2 W: `' ^ - #include <asm/io.h>; D* C+ d5 w$ O- w6 d
- #include <linux/moduleparam.h>9 ]2 ?3 x4 `% E" T' `: D" ^
- #include <linux/sysctl.h>
0 Y7 L: v: ~ l5 |2 D p - #include <linux/mm.h>
* O7 ^/ t$ K4 p" B6 m: Y - #include <linux/dma-mapping.h>. T4 V4 Q3 K8 N: I0 Y* _/ ] e
8 Z: w; X0 r( m1 m; v2 B- #include <mach/memory.h>
/ N" d7 q! [6 } - #include <mach/hardware.h>
' b$ r8 a: n: R - #include <mach/irqs.h>
! P8 b# A+ Q! G/ y6 Y6 A' ~8 |& x - #include <asm/hardware/edma.h>
5 c6 v( W- h& a/ J# v/ E - 3 z) r- N6 D6 T8 z
- #undef EDMA3_DEBUG% z6 P3 M; L# c& l
- /*#define EDMA3_DEBUG*/
+ X1 A( @3 m v- h
/ @* D/ d+ \2 d, v6 Y) a" \- #ifdef EDMA3_DEBUG' s4 H1 D/ R" w" h7 V; ~9 m& I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! H' ^0 M1 B' y, k* M' e3 U& { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 ?1 B J8 ~ [9 g# t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& `: `2 B+ B- P0 w. Z3 g* x; D' o
- #else+ g2 u! Y9 Z8 \
- #define DMA_PRINTK( x... )
# b2 C% P8 z6 i1 e$ K2 H - #define DMA_FN_IN3 R& z4 J7 n9 E" n1 l8 F0 h& X
- #define DMA_FN_OUT$ q1 S: L g. t9 h3 Z- W2 E; y
- #endif
& ~, o9 g/ W5 G: r2 e2 i6 a - % {4 U6 m! V" I- L/ F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% ]0 h% j$ }9 Z) ?
- #define STATIC_SHIFT 3/ \, K' ?! b4 W
- #define TCINTEN_SHIFT 208 [0 h$ V9 x. ^. ]; o" G0 N% ]4 M1 {5 w
- #define ITCINTEN_SHIFT 21/ O; `6 V0 {9 F, x9 y
- #define TCCHEN_SHIFT 22
6 } I3 k, J0 g, J4 ~6 V J - #define ITCCHEN_SHIFT 23
; G( r" d0 G( ^4 j; G: x - + H8 K* Q0 O+ l( I- }
- static volatile int irqraised1 = 0;% k$ L- {* R( u+ b
- static volatile int irqraised2 = 0;
]' P: [$ b h, O2 c! y k7 N5 D - $ R" o+ s" m% ^$ t% e F& U6 d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" J) E% c4 ^7 I& r8 r% E9 O. C$ P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 D: }: V' j2 K( H" L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( `3 n! m+ N/ V3 E# J6 I) C- N
0 m2 n% w, w. r; N# c1 Q5 q- dma_addr_t dmaphyssrc1 = 0;3 ], o+ }8 w d3 w/ ^0 h% L$ F
- dma_addr_t dmaphyssrc2 = 0;
1 p1 y" h+ V& [3 s) E8 o* h - dma_addr_t dmaphysdest1 = 0;
. ~' E1 f) m$ {$ K5 I& {# Z - dma_addr_t dmaphysdest2 = 0;7 ~3 @; F: v7 A, m$ A1 X
- # u3 I3 J; F( W& f5 i' P
- char *dmabufsrc1 = NULL;; o: l# G* Z& O" Y0 V( x/ ?) b
- char *dmabufsrc2 = NULL;
{% e. T. B- w9 W w% S - char *dmabufdest1 = NULL;) o1 {. y L0 ^0 Q7 V" t4 t! H/ `
- char *dmabufdest2 = NULL;
% B+ k5 b5 n) a$ C* T - % }1 ?7 h8 s) S/ ]$ R
- static int acnt = 512;7 r+ l2 t. A! N- h1 J6 G
- static int bcnt = 8;3 W- y0 @; q% @# e0 n( e, O
- static int ccnt = 8;0 k; @! G1 |8 D, Z* w* V
( \- N( _ Q7 p E- module_param(acnt, int, S_IRUGO);4 v( P3 H5 |9 v. ^1 L' n$ S* L4 ]7 L
- module_param(bcnt, int, S_IRUGO);
2 w: A+ d1 L+ x: ]/ `7 j. \ - module_param(ccnt, int, S_IRUGO);
复制代码
* }1 z# R9 b, s) J( m Q
1 g- @* r, X8 l( X; ~4 _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* A$ v ?9 C/ j1 p. I6 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: T6 w7 G% e2 ?8 Y7 h, M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" }; ~3 f+ b8 d. O
9 h; X7 m- h8 m& B
, a) K! n7 M8 ^) C- {$ n
|
|