|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 H, U* G2 Q+ l3 S$ E$ Q% v
- [code]EDMA sample test application
1 f3 k0 z4 |5 \5 o" Z* [8 |1 p - /*
4 e7 t% F: O6 E- W$ I a X: l0 ^ - * edma_test.c) _2 B4 Y- T- P3 u* Q! X
- *' K' Z5 L' Q3 b M
- * brief EDMA3 Test Application
" n& G; j: Z; _( ] - *( ?6 C/ C" d6 d2 k* P% U
- * This file contains EDMA3 Test code.
% |7 g# `; e _8 |9 k - *
# n7 Y) H$ Q# u- @0 I3 C" a$ ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 g4 l7 x( L% X. r! G, V) l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 D# m4 O% Q5 ] V2 O) Q5 Q2 D$ t
- * TO CHANGE.$ b* |1 M+ T5 s/ h+ t
- *1 H% x0 b) s9 q O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; }, S, {2 M6 U% k6 u* U
- */ v( ?# v7 q: u( p* o
- * This program is free software; you can redistribute it and/or
; ^" o- A8 L" y+ u5 G - * modify it under the terms of the GNU General Public License as
# m) B3 Z; h) V2 s$ s8 X3 y - * published by the Free Software Foundation version 2.' R$ M& Q ^, |. i8 l
- *
& B$ S: a' d: n5 C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ q% R" C3 b9 c! Q" f& i
- * kind, whether express or implied; without even the implied warranty
+ @6 h, ^3 V3 ]) S% B9 A* ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" z- F3 x8 I% j. ~* D
- * GNU General Public License for more details.6 S( G' y! D" ~3 @5 Q
- */
: Y8 o) b1 N! n/ c- G) K - 7 j7 ?. }3 {8 W* [2 u- z1 \
- #include <linux/module.h>6 s# y' Y; R$ R$ P5 Z
- #include <linux/init.h>, P& p- Z' D' [ a5 u( Q" S3 u
- #include <linux/errno.h>
& A8 R4 _4 {2 g7 p$ J! Y( v7 j* j- _ - #include <linux/types.h>( m- a% [2 G) @
- #include <linux/interrupt.h> V8 j8 }3 M3 @ g+ V$ B/ m+ T8 U
- #include <asm/io.h>* S, ]* }1 W& {' H
- #include <linux/moduleparam.h>
8 R, B* H3 t5 E F6 l8 E, u2 [ - #include <linux/sysctl.h>
& y/ @' @. u# n6 Q+ F/ y$ e5 w1 J - #include <linux/mm.h>( E; i8 U3 I& W4 E& G% _0 k
- #include <linux/dma-mapping.h>! b T6 n# s" S# F
- 5 Q& V! |+ J2 z6 l! I) X
- #include <mach/memory.h>
2 }- U4 z5 X+ F2 d* n; \ - #include <mach/hardware.h>
8 `' [3 R+ u$ e( F$ w% m - #include <mach/irqs.h>
" Y* V/ Q J- ~' q8 z! d - #include <asm/hardware/edma.h>; Z# h O7 q# k/ Q: g+ q
G. b- r2 m' W6 V6 ^. ~' R6 G- #undef EDMA3_DEBUG; e3 X8 P# E. G
- /*#define EDMA3_DEBUG*/% ]' V. h" _ D; Z) J( z0 o7 l
- 7 f0 P U% U5 m- A- a, S8 C* `' e8 }
- #ifdef EDMA3_DEBUG
, t w2 {7 O* H) @ U( }3 D - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& ?+ G: X! |, V" ]; k( l1 d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ p: P! U; p! X" L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 s( u: d: f' ?/ m0 u" W
- #else
' J! ]3 F( j: H - #define DMA_PRINTK( x... )6 ^2 w3 g* v. N: p
- #define DMA_FN_IN4 W- u1 W- R* ]! g0 r
- #define DMA_FN_OUT9 u, T0 D$ y, ?. y, r, `8 X# Y0 C
- #endif
# Q: n9 q/ x( L) Q. @3 B6 H
! o9 U* P- \0 U$ b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 {% M6 t5 r7 l3 g" K* L0 Z - #define STATIC_SHIFT 3
4 {( D( d8 K- A& B; n# Q - #define TCINTEN_SHIFT 20
! J8 t; V6 l2 Y - #define ITCINTEN_SHIFT 21
) T% _ _: T7 a4 v$ @5 G4 ?/ x0 X - #define TCCHEN_SHIFT 223 M4 e2 z: U: ]8 N
- #define ITCCHEN_SHIFT 23
9 K; @2 h3 e } s1 f+ b, U - 5 F# J, |/ M+ n* \- g
- static volatile int irqraised1 = 0;( G1 @4 a+ ^ R$ R$ t
- static volatile int irqraised2 = 0;
1 B7 a- j6 @6 ?5 O: C/ m1 m3 X - 9 i3 ]% m+ \1 |. C* v2 _% b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: X' r* ]7 I/ Z, f. [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
H5 }5 `$ E2 X8 Z x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. i: W1 w2 [9 z# Y6 e4 D
: i6 ~ B7 @, a# e3 H- dma_addr_t dmaphyssrc1 = 0;
" z6 o1 w0 F/ Z+ t f; W; j% N) C8 \ - dma_addr_t dmaphyssrc2 = 0;# M4 [7 r* m7 `# w1 S, n
- dma_addr_t dmaphysdest1 = 0;
* R/ j% t' Z; b# }! `. U - dma_addr_t dmaphysdest2 = 0;
6 d5 y8 f5 S# T3 f
; u* a, ?' q/ s8 |2 ~( P2 n- char *dmabufsrc1 = NULL;
( ?/ }- y" b; B# T. n+ Y/ E/ z8 }4 K4 c - char *dmabufsrc2 = NULL;
9 e* n- H2 W, R: O, h+ j) i - char *dmabufdest1 = NULL;# q- F8 z# f4 ]# d
- char *dmabufdest2 = NULL;
7 _5 ]$ v6 N& @9 `4 a6 ?3 t" R& Z! V
" {( p m/ i1 J8 ^% ? A- static int acnt = 512;
" D& y( l3 x# n, C* Z2 V8 E - static int bcnt = 8;/ N: I' T% j+ ~, x$ m( u5 }
- static int ccnt = 8;7 {% ~ S/ L' v, e+ y; V* C
- : i; E) U! V% p
- module_param(acnt, int, S_IRUGO);
1 P+ a& g3 v& ?$ { - module_param(bcnt, int, S_IRUGO);
" P0 w3 W; e5 c9 e5 q% l( v3 W - module_param(ccnt, int, S_IRUGO);
复制代码
$ U% `. @6 |% Y' e ]. E, `2 z" E0 @) @# k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& m! N5 s4 J+ o& {" D9 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* @4 M( t" `2 I; w0 P d- O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 S& d- U. C7 N
+ e; \: T7 T7 _ n: t
9 r& c! H6 B! L u
|
|