|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 L3 b4 E7 u! y6 N& q1 {! d, D- [code]EDMA sample test application; D1 V x5 X g! L" M7 p
- /*
7 A1 O/ m6 U: F5 M& s* b. Z - * edma_test.c
' _& G! R" F, e; i. j - *& f" G8 e! K& U* A7 V
- * brief EDMA3 Test Application
' e( n( f4 Y& J7 |! g - *0 D2 a9 m! c4 C4 y& h
- * This file contains EDMA3 Test code.
' x* m" _4 x* T. L7 z* U; P - *
' E% v# H) k4 r3 `' F, N4 W% V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ Q3 [2 c. y4 q- u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 ]8 q* _& ? C
- * TO CHANGE.
6 v, E- `$ N" o - *4 Z% W3 }5 E; C: i3 a$ }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 P6 M" X8 f3 q3 v2 Q: ]
- *6 R& a2 Z' |( s
- * This program is free software; you can redistribute it and/or
& r! w: M/ Q) \) Q8 H1 s) @ - * modify it under the terms of the GNU General Public License as
/ C4 E+ A6 f$ ]* a; Q! `' b - * published by the Free Software Foundation version 2.
1 ?5 {% |5 k, ]& U9 w d" o8 q - *0 r: [' J9 S; v$ ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 I- G6 j6 ~' o% M! n
- * kind, whether express or implied; without even the implied warranty6 x/ }6 Y: u6 T# r: j- |0 |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 j9 i. o& J: r+ U e0 U" A
- * GNU General Public License for more details.
1 m8 Z' B4 T9 T( [0 ?8 |0 _( _% ^ ` - */
$ y! G: P. M; X C% k# x - - w" n; C& H8 M& T7 B2 h1 H6 m
- #include <linux/module.h>+ a& C6 } ?: f: A% X2 {& d
- #include <linux/init.h>
r1 a% {' g: l9 u - #include <linux/errno.h>. b* Y% g1 K. U0 A
- #include <linux/types.h>
, W' H m' r, P+ B/ z7 l. j8 d9 p - #include <linux/interrupt.h>: E7 |8 S$ E7 m0 ]0 ~
- #include <asm/io.h>1 x q$ L0 i2 u4 d6 S6 Q6 i5 C' j2 c
- #include <linux/moduleparam.h>+ u8 z: v: G: H/ l" |; t5 q
- #include <linux/sysctl.h>
* C- a+ z& J* Q9 }9 [+ p. l - #include <linux/mm.h>& Z1 r: a( n2 F% ^# A
- #include <linux/dma-mapping.h>% {* y* a& ?# V, b0 g" ]
: s: v/ |3 s0 y, @1 _7 @* }- #include <mach/memory.h># Z- ^9 ?% U( P+ z+ a
- #include <mach/hardware.h>
/ L' K6 i* I) p - #include <mach/irqs.h>
7 X3 j1 L; U9 \; k - #include <asm/hardware/edma.h>9 x$ w" f2 d( w1 u2 D
- # x0 }. U7 F/ g0 o; Q) u" g5 E
- #undef EDMA3_DEBUG
6 b9 v, t E3 h! P - /*#define EDMA3_DEBUG*/
% I2 k/ w3 p7 Z- p6 ^' Z' @ - 2 N5 w( y$ B4 g* @8 ]: s2 E. S, m
- #ifdef EDMA3_DEBUG$ i$ i# U) e( W% p' a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' ]- t- E9 E; }5 x+ {& d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 ]/ y; T) B: O4 r3 y* C V) \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) `. g& L6 U3 i7 z. |8 B' o' M
- #else0 j5 X. r# J5 X4 J0 q! q/ l1 N9 r8 m
- #define DMA_PRINTK( x... )! j G U% a8 ]0 K( `( N4 q2 K
- #define DMA_FN_IN
# `8 \7 h. ^4 c; }4 r - #define DMA_FN_OUT$ b }: V0 [1 G: [# E
- #endif4 O e- r% m" X8 z: c: e) ~
3 H( Y$ U( z" j0 M0 C1 |) O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- B1 f! I: q8 |# { - #define STATIC_SHIFT 3
' R; J" I) F. T+ F" q - #define TCINTEN_SHIFT 20
9 u& [5 N: E$ r# ]3 T+ S - #define ITCINTEN_SHIFT 21
0 |+ G6 h) g6 X9 G5 t: E - #define TCCHEN_SHIFT 22
% C c# H8 W# S) M! f8 Q& ` - #define ITCCHEN_SHIFT 23
7 k; C9 v$ U; [) ^8 F6 w
2 I! [* m$ t) P, ^. M) W* r- static volatile int irqraised1 = 0;. }' s$ y, l) n* C
- static volatile int irqraised2 = 0;6 [4 R+ t0 h Q! Q3 f& e/ j3 Y7 h2 t9 B
- , V& [+ T3 D" G& H: T! J9 O0 e) n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& M7 Z& B( ]# b' D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 U0 P1 {- o z8 R, R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Z. x8 O* P* @3 ~! `& Q, a
# ~$ `. p- g- e5 ?5 z) ~- dma_addr_t dmaphyssrc1 = 0;
2 P/ T2 B4 A, O- R8 B/ p( F: N - dma_addr_t dmaphyssrc2 = 0;
3 i1 q& v+ @6 @: J# ] - dma_addr_t dmaphysdest1 = 0;
. U. t7 J+ r7 N5 h. e$ W - dma_addr_t dmaphysdest2 = 0;
5 } l1 R+ c- }( M8 d: k, q - 0 D$ i4 O" F8 l6 M0 m( l, A' b
- char *dmabufsrc1 = NULL;
+ C7 T4 D( r, ^. U8 i2 @ - char *dmabufsrc2 = NULL; o, `! W% k1 l- Y `1 ?
- char *dmabufdest1 = NULL;
4 Q% H4 `2 A, f0 ]9 F& f. R - char *dmabufdest2 = NULL;1 U4 r; h7 e1 Y) J
- $ s( c2 _) e' }& v+ ]! j
- static int acnt = 512;5 H8 [+ e+ x3 s% q" v- Q8 C% L
- static int bcnt = 8;& u9 Q9 ^" V1 r3 f I
- static int ccnt = 8;$ b7 e3 c: R3 T& @5 R
- 9 m" s, D4 p3 d# {7 f6 r
- module_param(acnt, int, S_IRUGO);% i# h- u- g9 ^& S
- module_param(bcnt, int, S_IRUGO);
) d$ S5 `* T* l% _1 S - module_param(ccnt, int, S_IRUGO);
复制代码 8 G! p: G3 K: Y* i# \% C) O* {
) z5 N; A: X5 h& s3 P, M* v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* X: R% u' p2 D `$ h8 G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 [1 n/ K6 s j9 M2 ^0 J6 U2 o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 s0 O1 _) H. J( ?# ]% e8 N
2 p! _ z8 q1 {: L
; r. q, z! J$ {1 U3 ?/ ~8 d |
|