|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( l2 P1 ?8 }% x3 b
- [code]EDMA sample test application0 ?6 T" ]/ ?3 ]9 e1 d" |5 }6 q
- /*
& [9 u; y1 G9 g - * edma_test.c% \* K8 t5 c! \4 s- J' a0 Y
- * G" l+ d2 h6 V) R( O4 e# s$ e
- * brief EDMA3 Test Application6 |% B7 \* ]9 V1 D" O# I5 d9 b
- *5 u' a; }1 S f" L; u
- * This file contains EDMA3 Test code.
8 K3 M: f$ E/ A! R: ~ - *$ P% g2 c# e% w5 B$ B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 x. a, `4 X3 b8 E& e- L' C5 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) g' B/ h6 ?/ A; N& l - * TO CHANGE.
& j0 m7 L: k4 b. X9 T n# P - *8 n% I; U$ r+ H4 J( X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 H/ q8 T/ ]: K0 z$ O( _% I8 n, ^ - *# I% @4 _# h% r# e- Y3 ^ f }
- * This program is free software; you can redistribute it and/or7 o9 k- S( K8 f a
- * modify it under the terms of the GNU General Public License as' c1 R$ X' I6 \% s/ m( w
- * published by the Free Software Foundation version 2.& u2 D) N/ Q: L0 O H8 C& L6 _# w
- *$ v6 p( l3 q8 v1 u/ [: \3 a: A5 W' F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# o- Z- y" S' p# w' p4 o1 q - * kind, whether express or implied; without even the implied warranty
% c1 ~/ r# B, d* e$ s- p# ^9 E* d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- q' x8 D+ Q; K9 q
- * GNU General Public License for more details.+ ^" i* ^: o2 T+ Q( D3 ^
- */+ ^* Z$ Y1 N" `7 _/ C& W
( | m. [5 C+ E' k, H3 w+ d* p9 c- #include <linux/module.h>, o4 H+ I3 z6 q/ W; h3 a4 M
- #include <linux/init.h>2 R+ T X3 c7 D
- #include <linux/errno.h>9 k! F" I1 G9 X# E1 [1 ~0 q" @. X
- #include <linux/types.h>& G1 r' F, h+ M
- #include <linux/interrupt.h># m9 [7 S1 b% a) g I @
- #include <asm/io.h>, A' s5 U( M5 u8 `* u g
- #include <linux/moduleparam.h>; y9 R- P5 H0 _* T3 x5 V8 j( d3 h
- #include <linux/sysctl.h>" }9 u; _ L) ]2 K( c
- #include <linux/mm.h>- ~9 U% c% g. }/ Q+ r$ \5 D/ L
- #include <linux/dma-mapping.h>( t1 J5 d+ x* o5 S z! x
; k; U* _3 a. T- #include <mach/memory.h>5 ~& Q3 ?2 o# |4 b: ]5 S# S
- #include <mach/hardware.h>& y5 @4 i+ b2 d" a3 B9 p6 p, k, G9 z
- #include <mach/irqs.h>
9 i. u: \: G- |: V7 p4 j4 Z; a7 j - #include <asm/hardware/edma.h>
6 V: O8 e1 D- f7 m( T% v, {
( G C- [# K* R- #undef EDMA3_DEBUG
1 W% p7 U4 L0 Z, R4 m) w$ L - /*#define EDMA3_DEBUG*/2 e$ r- N& Y/ Y: E
- - o. @8 l& ?0 t0 ~3 p( c3 @ L6 u
- #ifdef EDMA3_DEBUG
3 T9 n- }% c5 R5 r; @; M& a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 d0 \7 R- W) O# ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 U7 P, ^4 V, ]7 j8 I4 n, ~) H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 Q6 h+ Q/ R4 | - #else. k( q$ R0 V$ a \" p w1 G( Q% h2 b6 C5 o
- #define DMA_PRINTK( x... )3 M9 e; {! [; Z) i3 h) G5 b( H
- #define DMA_FN_IN$ I; f' q6 f$ u5 j
- #define DMA_FN_OUT* J s8 }" N4 ^4 \
- #endif+ g1 q5 T$ F6 H) g8 `& P
- 8 e, i6 @# p: ^: V2 t* `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 ^ @7 F# J& ~5 _" P* `
- #define STATIC_SHIFT 37 }5 r, n! u0 k" R8 t3 d7 ?7 \- y1 k
- #define TCINTEN_SHIFT 20
0 A3 \8 \7 ]" k& b) k - #define ITCINTEN_SHIFT 210 U' V" F4 e" G' Z8 o8 x7 g' c& h+ Q
- #define TCCHEN_SHIFT 22$ M; j7 E1 g* [) Y) s6 }% G
- #define ITCCHEN_SHIFT 23
& Z* U7 [! R( r& |8 |' Y
/ R0 R, i0 a6 v0 ~& S- static volatile int irqraised1 = 0;2 _+ y- j0 W: [# O
- static volatile int irqraised2 = 0;) g5 A/ D' B; ~5 o5 J3 ?. Z }
. r3 i& Y# s% a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 X) p4 j7 i1 f% E9 [/ C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' i4 V7 k, A# B4 e6 x) ^" E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ a: M: o! k2 N3 N* w
6 l1 F, y0 U r- dma_addr_t dmaphyssrc1 = 0;( D/ D# s; P0 T: e9 b# d' H& D
- dma_addr_t dmaphyssrc2 = 0;
# F T7 k+ h3 e8 V* V - dma_addr_t dmaphysdest1 = 0;0 V: W5 M5 h7 Y8 w
- dma_addr_t dmaphysdest2 = 0;) m; Z6 m* G" F4 l6 i, _3 Y( E
- ?/ b" T. u: C0 Q; O3 k0 Z- char *dmabufsrc1 = NULL;: u9 K) h: }4 ^4 Q _ m, E' F( P
- char *dmabufsrc2 = NULL;
& G9 g& q1 A8 s# {% D" z# ] - char *dmabufdest1 = NULL;
* k, w4 d$ ]7 g$ L- a - char *dmabufdest2 = NULL;' b Y+ R/ K! Q( Q$ I8 d1 t7 D9 `" M
- " v( q( Y4 u z7 X& F1 t
- static int acnt = 512;* @( M" R' M4 V g6 Q2 ^" F
- static int bcnt = 8;
0 J: E1 h" M. n! o2 u/ c7 z; i - static int ccnt = 8;6 o) N% b8 P. N0 N9 ]1 ~
- / l$ f. }9 A* p7 ^# |4 k
- module_param(acnt, int, S_IRUGO);
5 O2 z0 }7 a0 o, L& E" r - module_param(bcnt, int, S_IRUGO);0 P0 f1 u# ~8 F' V8 y
- module_param(ccnt, int, S_IRUGO);
复制代码
O7 |% N8 r" |- N3 a1 e1 S$ @7 Q, P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* e$ f' T! _1 ]: p5 F( V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 `; G& Z# w1 K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! ^* n5 K: L) H8 S7 i
, P3 L, b1 Q. y: j( v: h' ^( x" R8 n( C) X# V$ h* |
|
|