|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " h V0 ^5 C2 F
- [code]EDMA sample test application+ _, f% M) o) ]: Z* G
- /*
0 d/ t% L1 P! w5 L( \1 t - * edma_test.c
* g( _$ }3 y+ o6 [; ^7 Z. Y+ ? - *3 s8 G: Y0 v* U3 H0 m0 @
- * brief EDMA3 Test Application# ?5 c/ Q) [/ W7 e
- *
6 E! H5 C0 L6 n; Y7 ?5 E! \8 ? - * This file contains EDMA3 Test code.- d# u7 ^! h5 W3 K m7 O) H
- *1 a3 [7 X. e/ _8 d5 t" L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
k: d ?; x0 \2 m6 ?2 z- d. q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ [0 A3 I2 ?, w - * TO CHANGE.
9 [+ t7 X4 y# _. O0 } - *
9 w* J( |3 n$ Q( l3 Q3 F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' i$ i8 s3 x. A* G: D/ X) E - *9 r, i7 @# |1 k1 H6 R; f
- * This program is free software; you can redistribute it and/or- H) `" ?/ `/ Q0 _ ~8 I. H9 \
- * modify it under the terms of the GNU General Public License as! @% Z" R; @' {8 t. H! h
- * published by the Free Software Foundation version 2.
: f8 V. j/ ?, u - *# T! H4 j% e2 s2 F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( |; u' B( j: u# U7 D/ P/ o - * kind, whether express or implied; without even the implied warranty! p9 {1 V$ N& F- c& U6 S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( y: u# z4 \8 Z( m7 [/ j+ z6 O - * GNU General Public License for more details." Z0 u$ d- d, B, @* t
- */* t V d. u* E) [9 H* j+ f
- ! h: F& O: h" y8 R% I
- #include <linux/module.h>2 T1 M2 B/ H7 v0 A+ U/ j
- #include <linux/init.h>
( O! p" y6 j) X - #include <linux/errno.h>
0 O! U9 W X4 x0 c, S# ?1 c% a' P - #include <linux/types.h>2 g. B: \ _4 y) i
- #include <linux/interrupt.h>
3 L1 D# d y8 T4 ^- d, J1 y( z - #include <asm/io.h>
, [% z+ [% s" o$ y9 K) \5 Z - #include <linux/moduleparam.h>4 M" y4 v% ?. i" e" y
- #include <linux/sysctl.h>
7 n3 l6 y8 N3 S1 B - #include <linux/mm.h>
u' V5 v3 t0 b" b: ~: a4 m2 d6 a& M$ g - #include <linux/dma-mapping.h>/ s% w3 ]0 @ X8 |6 P( j0 }+ v
- V. o/ M% q+ D n9 Z! u0 C- #include <mach/memory.h>
# q$ ^$ n2 x# i% y7 ~ - #include <mach/hardware.h>4 `! t# \* l+ }( r4 f
- #include <mach/irqs.h>
6 |( J% u2 G4 I* Q: X - #include <asm/hardware/edma.h>
8 ^6 @- V+ v+ ^- O1 w. Y - 0 p' M+ ?( C4 |5 m
- #undef EDMA3_DEBUG* b, e* f+ f! h$ k* `/ F
- /*#define EDMA3_DEBUG*/
- e9 h O% h; K) c/ t
; K& c+ J. H8 W D8 R- #ifdef EDMA3_DEBUG0 k1 o5 Z( q; u6 i/ Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 l* _6 ^! D7 A7 Q# F9 X7 b! Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); {- }- M) ~* R/ J+ e( t/ c6 F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: ~5 g' x/ n2 [0 E8 U9 L9 D - #else8 P z6 M: T4 }% w$ t
- #define DMA_PRINTK( x... )! G5 b4 n# N$ ^+ C% |$ P
- #define DMA_FN_IN: H& F. R5 o" k) t% S/ ]4 Z
- #define DMA_FN_OUT
4 J% V: X4 h- G; |. W4 W! X - #endif
$ @3 @( m) R# m6 |5 i - 0 w" @+ O8 i, P n% u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): ~3 F) Y5 V% C: f' A* u
- #define STATIC_SHIFT 3
# c5 E# J3 a h0 [, ^/ c - #define TCINTEN_SHIFT 20
9 f. b# z! b1 {# U& v! L- x - #define ITCINTEN_SHIFT 21& A. `; t0 \ q. T
- #define TCCHEN_SHIFT 22) k. T6 z8 v3 Q: k
- #define ITCCHEN_SHIFT 233 d' g$ @1 n) |; R+ d# Z" Z6 O$ X
# W# _6 t, V, n- `4 j- o- static volatile int irqraised1 = 0;
4 P Y; ~9 M; E0 b% R - static volatile int irqraised2 = 0;
. n, L& @7 `9 i" { - # g6 N9 l. N3 W/ r7 v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 u" t5 p! n: P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ W2 E- D: o P3 R* t! I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. o4 V1 f5 z/ f9 Y8 s6 o4 } y! Z( w
- 2 p% k! G# b0 V+ ?* n
- dma_addr_t dmaphyssrc1 = 0;7 @' c' ?# Y# N% t
- dma_addr_t dmaphyssrc2 = 0;
0 R, y; F& I2 ^1 K2 x' F - dma_addr_t dmaphysdest1 = 0;
8 B/ O: x( v) P1 T - dma_addr_t dmaphysdest2 = 0;
0 v$ Y( u+ P( K6 m! g0 I
3 C* V2 L/ x+ b- char *dmabufsrc1 = NULL;5 G- w# j3 w0 D. I; [+ }( l
- char *dmabufsrc2 = NULL;
$ b, W& c# H+ \: s0 W) i - char *dmabufdest1 = NULL;
/ r8 L3 h, e, L0 x - char *dmabufdest2 = NULL;! X% ~" f3 Z% [' U5 J
- : {3 r& t7 y7 N5 I4 ^
- static int acnt = 512;
4 G" J/ x( F+ W - static int bcnt = 8;
& j; ?4 I- L r& {$ E; b - static int ccnt = 8;
4 d2 ?" _$ F. D2 L x
. ^# |2 Y/ v1 d) @0 `* V5 q8 l- module_param(acnt, int, S_IRUGO);2 Q% N5 s; d. R
- module_param(bcnt, int, S_IRUGO);
2 V. g0 U# U# D( R' F - module_param(ccnt, int, S_IRUGO);
复制代码 1 }" e. i/ S8 W. K) T2 {
- M9 o- P! N* d/ D2 c- q: M h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% y9 Z0 p8 K+ K1 [: K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' o r. [$ }! y2 c/ g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ x: D e0 b6 q0 Y V% x0 S
: L+ K& S* y. w" `
8 z/ N1 F4 X+ r9 O) N |
|