|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * I; N! V' S# g- w6 ^6 W
- [code]EDMA sample test application/ q/ G. t/ a( `0 \# c2 a4 J% }
- /*) _) \4 [9 }5 {2 [5 F
- * edma_test.c
0 a% Q/ r; `! G - *
& G4 T+ P1 d8 ~' g, R9 b/ d( _ - * brief EDMA3 Test Application# a O" d- z$ x+ w) @3 W& _
- *0 X4 b9 `. t- a, A& ]+ V9 |/ k) ?
- * This file contains EDMA3 Test code.
2 i, L8 `: a+ n0 D* L& l - *5 P2 Z1 R) L. \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* A8 T r, }! S. ?% W) P& _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% U! c% |% a. Y( v1 K5 E0 E
- * TO CHANGE.
/ Z+ t. l$ K3 q0 t0 |5 ]. W - *
: q( d1 `+ F y: `7 t9 k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 S6 S/ B9 p9 O4 h6 C& U) i2 A! q1 g7 k - *
i9 R! h+ d) _7 y9 b4 q+ I% \ - * This program is free software; you can redistribute it and/or
1 W Q% @* {" F- r - * modify it under the terms of the GNU General Public License as
! H/ Z" `# z( |$ t - * published by the Free Software Foundation version 2.
2 Q! q& B1 g$ A3 I/ u1 A - *
0 _0 R% L9 g4 V6 \6 b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- ?5 |4 e+ K2 a4 K8 I1 b! I
- * kind, whether express or implied; without even the implied warranty9 m. c5 s0 K; R6 g }$ C! t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& D4 v1 S8 L& x& S* Z
- * GNU General Public License for more details., c `: P' ~5 `1 ~
- */
R- O3 D1 D9 s* g$ Q7 y8 p - : N4 {8 l/ z0 P7 }- j$ _
- #include <linux/module.h>
W. r$ y: ~+ R - #include <linux/init.h>3 I3 t, e0 s9 C/ Q W( d
- #include <linux/errno.h>
% R3 y$ A' t1 |. a$ Q$ u$ u - #include <linux/types.h>6 X7 O/ h# p5 P$ s' n/ q# S
- #include <linux/interrupt.h>
. { i8 U! k& {2 M - #include <asm/io.h>
, p1 y+ r' F- p3 y# _0 o8 f* m - #include <linux/moduleparam.h>% g P( `! ]5 h* K* p6 m0 f6 X
- #include <linux/sysctl.h>: \ l; S8 Z7 c* X
- #include <linux/mm.h>/ d% X, M/ S0 H+ H# t' T
- #include <linux/dma-mapping.h>
+ T. L* y. n3 k6 J& d9 T! X0 y( c - " [* i/ i& G/ H- n5 n
- #include <mach/memory.h>
4 c" s( u2 _* N5 E* _7 f H: u - #include <mach/hardware.h># S' d) s2 p/ s1 D8 A/ q
- #include <mach/irqs.h>
, l' q, m1 P7 _4 k: E, J - #include <asm/hardware/edma.h>; A* _/ L5 w9 L* F! k! o4 z$ Y
v. q4 E4 a$ g1 J- #undef EDMA3_DEBUG# S9 A4 s* O2 K( a0 b$ O, i( }
- /*#define EDMA3_DEBUG*/0 g' \2 l1 M/ k
- ( g5 ^. w5 Q$ {: E. Z. y7 U
- #ifdef EDMA3_DEBUG
0 n) n9 w$ W4 P! f$ h* z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ I% T4 I% N' ~- g+ {2 i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% y0 ]/ C8 t+ V t9 `7 k1 @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 [ p4 ], ^" r. b5 H# I
- #else
0 j9 B$ i& Y J8 [% h9 z - #define DMA_PRINTK( x... )7 r v5 W0 Z0 \5 `' Z9 q! }
- #define DMA_FN_IN
6 A6 n9 o5 l; [ - #define DMA_FN_OUT
" x& {, Y' l E. T9 b T1 W$ b - #endif
9 i) i& I2 ]1 ?7 l' f! [) ?
: n8 a. P; f+ @! ?/ ~( Q- N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 S6 g3 ]! g# _& M - #define STATIC_SHIFT 3
5 g6 N1 ~; E" b) G2 w7 f - #define TCINTEN_SHIFT 20
, w( {7 y# s" p; B0 d* p; Z - #define ITCINTEN_SHIFT 21 r' f8 f4 |+ v4 p. x0 {
- #define TCCHEN_SHIFT 22& n) R) ?: I* K6 o0 K8 h; `+ h$ |
- #define ITCCHEN_SHIFT 23
8 ~; e' F, h, h8 C/ Q - + K! I6 V3 i! a, e# h) Y
- static volatile int irqraised1 = 0;
( D9 i$ y: H6 x9 o) L: t! ^ - static volatile int irqraised2 = 0;5 M" o2 t/ x; T( U2 D. {! E
- R$ _0 l2 s4 u4 O' j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 v% ^8 d4 v0 Z' G& P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Y& m, i6 O# p, M: ^( }" G/ J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ |' w' P r% f# a( ?
4 c4 R' O) I8 `% X- dma_addr_t dmaphyssrc1 = 0;
; U1 K! C; B1 l8 s$ n/ o - dma_addr_t dmaphyssrc2 = 0;
, J& E9 k0 ^8 h4 D1 {& z' R- o - dma_addr_t dmaphysdest1 = 0;
& |. t0 C# R, U9 i0 i - dma_addr_t dmaphysdest2 = 0;$ p* t- Q1 B5 S# j+ c
% D; P5 f! P! x" a+ v( S) a- char *dmabufsrc1 = NULL;, @+ n7 a8 w: E
- char *dmabufsrc2 = NULL;
8 b6 [' P+ J& u, ^5 i2 t - char *dmabufdest1 = NULL;
4 T! |1 N4 K% K% Z+ ]5 z& M - char *dmabufdest2 = NULL; A8 k h0 f k. ?# r; N
- 0 j3 k; M0 {" u
- static int acnt = 512;
$ Q9 `/ V5 f2 m8 d- F* ` - static int bcnt = 8;
* R& n- o1 K* X - static int ccnt = 8;3 U1 t- w6 C* ^ H/ H
- 8 ^6 g# |; `( M
- module_param(acnt, int, S_IRUGO); N G9 h$ v+ R8 K% V6 ~
- module_param(bcnt, int, S_IRUGO);) @! [2 h! r: k% S
- module_param(ccnt, int, S_IRUGO);
复制代码 8 M' [0 j/ S; ^( [- q: x' B5 ?
6 ^' `9 W9 H+ S$ D9 I A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, x& ~3 z t( S! R+ d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 M( l$ }& \' v2 D& D: x }, @/ {+ `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 ]0 L, x5 \ i* D( p5 j* E m
$ g: V7 `- }1 a" H; y5 \: v
( k; e& c* \! H1 f* j$ S |
|