|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% y% B8 O( L2 v' q3 d- [code]EDMA sample test application
, g, P4 \% F A7 I9 a - /* \1 d6 F, Z$ a% \, L0 C
- * edma_test.c
* I/ i x" x- Q/ i - *
* W: d! z3 Z9 S1 B! k - * brief EDMA3 Test Application
! y! M2 [( L1 n; G5 ]" w, s - *
4 k) W4 [1 F6 \# S - * This file contains EDMA3 Test code.
. V5 h2 D: e* y# X3 o( Y1 | - *2 z# ?3 v$ l% b1 _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- l U2 K& B5 u5 N; B- f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- Q: _6 I6 V y1 i8 x' ?- J/ @3 B - * TO CHANGE.
* H9 i7 R, c! x' ]% O7 v6 S - *, f0 X. r9 B( ~7 i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% Q* N' D3 x6 t/ Y! G! x- K( t
- *
( C4 o y( |3 X0 f% `* H2 l - * This program is free software; you can redistribute it and/or6 g7 @9 x( l* H% _) k+ Z
- * modify it under the terms of the GNU General Public License as
/ B* U5 }2 ^2 B, ?- g8 O - * published by the Free Software Foundation version 2.
* `& f0 k' i3 N! Q! U8 a7 u5 i- K$ g5 J - *
+ H% `2 c- E4 Y* l* S- @2 c' E7 { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 k! h1 T* r1 W+ s1 w) R - * kind, whether express or implied; without even the implied warranty
' _' r0 O1 |) N! m* g+ ~( \ ]: G, k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; c) u+ F: H: u. C - * GNU General Public License for more details." [* N: T; \) ^# N- K
- */( x5 c: s1 W& `5 U( S! d2 x+ R( Z+ l
- 3 B8 }. q/ H# ?3 H( z5 ]
- #include <linux/module.h>
9 X8 M9 T% k2 X3 b6 a; T - #include <linux/init.h>
) R* u9 x) t' x% u8 B/ ~ - #include <linux/errno.h>: D' q4 L# ~, d
- #include <linux/types.h>
& L7 i: J1 |: c: Z. G - #include <linux/interrupt.h>
/ w, T& Q, i( |& W/ N, H% V( Q - #include <asm/io.h>0 ^- T6 Y5 N; X
- #include <linux/moduleparam.h>6 v1 K1 B s8 _; M
- #include <linux/sysctl.h>' n. I! K+ d/ r% f/ N& t, j+ a
- #include <linux/mm.h>. l8 \5 i/ c, c! u2 ^
- #include <linux/dma-mapping.h>
9 Y0 s: X# K n# Y1 b - + {6 t' @8 H+ n( v; g
- #include <mach/memory.h>
+ B s9 w, h P0 Q2 d! b - #include <mach/hardware.h>* o0 Q+ H- `5 P1 `2 Z: y0 S b
- #include <mach/irqs.h>
+ _6 D2 w, g- B0 u4 Z0 s - #include <asm/hardware/edma.h>
4 d6 N, d8 m m) y: \, a M. i
: b6 D% {4 i% b% @2 s/ p! d; H# Z- #undef EDMA3_DEBUG
* z+ s w( N9 b6 ~ - /*#define EDMA3_DEBUG*/2 _: K& T) f1 X" k: X9 T
+ o0 B* F0 [2 B; B) O: V- #ifdef EDMA3_DEBUG, D, f4 M. B/ t8 I1 F. L( u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ D. X: i7 C# b: _! G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* H% p; F2 S5 w; J" R# e% d/ ]2 H1 G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. H* u! }$ k9 ^8 p# Z - #else
, R2 K: z$ G4 R/ {9 @+ [" v - #define DMA_PRINTK( x... )
! a) S b4 b9 ^2 B- s% I - #define DMA_FN_IN
4 J0 |4 e, O4 B; h - #define DMA_FN_OUT: z! _- a, @9 J# L+ ^! b
- #endif
' B/ }8 I; {1 |5 M1 [" q3 E3 s ^ - 2 p6 u% U! y: Z) h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) p, w' p( e' ]& Y3 @1 s
- #define STATIC_SHIFT 3
' P* |8 c! Q& ]+ p' T- N - #define TCINTEN_SHIFT 20
7 P5 H5 o' @1 B, J( f# h6 _ - #define ITCINTEN_SHIFT 21
1 @6 s: c L, j5 M. Q, C3 N5 R9 ^) N2 m - #define TCCHEN_SHIFT 22( w" Z7 I6 j& _0 c: r3 R- Z
- #define ITCCHEN_SHIFT 23
- O7 D1 t7 @& Q; {& R0 k& \
$ c% _. R9 c3 h, e d- static volatile int irqraised1 = 0;* Q6 t" N% U1 b4 @% K
- static volatile int irqraised2 = 0;
7 T: i* H, a$ R }) \ - 9 t" O" @3 u1 J) t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 `( l, n0 J3 \$ m7 |1 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a# h+ A8 ` x1 J" Y% w. O/ p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; N3 j+ e/ O0 M2 r - % z/ p' m0 Y/ d
- dma_addr_t dmaphyssrc1 = 0;
) H; H5 @7 ]# [5 E - dma_addr_t dmaphyssrc2 = 0;
, u! r# c, X8 e1 y' M8 [ - dma_addr_t dmaphysdest1 = 0;1 K+ S' s+ ], D- b3 H, J
- dma_addr_t dmaphysdest2 = 0;
/ H: f/ |) j9 J, d3 g! r* L - + w' G8 W- g9 o! g" l( g0 F7 T
- char *dmabufsrc1 = NULL;
5 x" Z( r8 E$ V# z9 q - char *dmabufsrc2 = NULL;' R y3 m! D) \ z! ^% u: O
- char *dmabufdest1 = NULL;
7 s# {, _6 D: |4 o - char *dmabufdest2 = NULL;
! G' u9 Y3 h0 F% s - , j/ B4 ]+ i5 u* s
- static int acnt = 512;
# y5 p A( d/ H8 i% B2 s3 z8 h" l - static int bcnt = 8;
4 q( `* H8 A4 s0 A% w3 c - static int ccnt = 8;: ^3 Z" j2 x" c. t" I+ u4 O
Y7 Y7 A/ i5 J5 d7 e9 _- module_param(acnt, int, S_IRUGO);
3 j! Z+ a6 o5 Y& l - module_param(bcnt, int, S_IRUGO);/ Y9 a$ n* v5 i. O/ r D9 O7 m4 d3 U
- module_param(ccnt, int, S_IRUGO);
复制代码 5 j$ l _% f9 ~" g$ a; {
3 k+ l' L, z) Q/ v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 j3 [/ }* w8 V$ e M! Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# i! e. k" U: s. U* O; |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 R9 d8 w* p/ X9 K! \) r
7 X" ~2 \, h$ l! m. o6 G8 d: B6 o
6 F+ L' Q2 r; s/ P
|
|