|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, W8 m! V& Z% ?# e1 C- [code]EDMA sample test application o, J9 ]8 n0 j( c; I4 B
- /*! }: U8 }4 M# E9 a1 f1 S1 C7 M
- * edma_test.c. {7 p, {1 T4 ?
- *
$ ~- O& J. R6 a4 m, W- k - * brief EDMA3 Test Application
. P" W$ j% \; ?) \ - */ L4 [% e( C( s3 U/ c- M
- * This file contains EDMA3 Test code.# i8 ^2 M h* \* A
- *+ M6 s+ D, C+ ~; G* m* n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 z6 Y" E0 ~9 b4 z9 H! q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 ~% r% h, R9 A6 y
- * TO CHANGE.* b1 \. X4 a* p) p
- *, i; F; Q9 ~8 ]) p6 G! t) {) ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! O ?7 J- G3 @" P
- *
: r7 ^, S+ H, I& \ - * This program is free software; you can redistribute it and/or7 c; i+ A5 J5 V! @- ~5 ~
- * modify it under the terms of the GNU General Public License as4 r$ P8 f! }1 @, s, R8 j" _
- * published by the Free Software Foundation version 2.
. {% P: `+ B y# d - *
; A+ P" N6 P, k! }/ P, e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) j; M, O0 k2 |3 u* z' w/ `& J - * kind, whether express or implied; without even the implied warranty1 O; l3 {$ B/ y3 o1 b1 s- P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' A) Z N" c1 U: l4 v2 \$ t, V
- * GNU General Public License for more details.
3 ?/ J. A$ m: y+ n - */
6 {1 ~$ G: H+ y
9 \+ Z( d6 b! b9 |3 t; e- #include <linux/module.h> k3 F6 x1 b+ e
- #include <linux/init.h>' p! ]: @% u4 c# Z, Q
- #include <linux/errno.h>' A# I* i& r+ s v( o: c3 s
- #include <linux/types.h>3 G, }/ Z8 ]( ~+ c% a+ d9 G/ W2 c
- #include <linux/interrupt.h>
. _. k. v* n. J8 X5 |4 c* J3 t - #include <asm/io.h>/ o4 Y d' q# s2 X% k: ^
- #include <linux/moduleparam.h>
6 y: l& x& T8 V5 u5 |! O5 N - #include <linux/sysctl.h>4 I4 Q. O: M( s4 s% x6 u! n
- #include <linux/mm.h>
" z. I* A# g4 ]% x- ~ - #include <linux/dma-mapping.h>) \/ L; d$ I# z& v1 J4 s2 s+ L5 V
- / e1 B, T8 j' v. `; T8 ~, k$ r/ h) ^
- #include <mach/memory.h>
9 o% n6 P8 u$ A6 T. | - #include <mach/hardware.h>( H8 F# Q& \; }+ q- p% S; @- P
- #include <mach/irqs.h>
3 w* \& _4 [ _, A. R# f - #include <asm/hardware/edma.h>
8 Y% l; w3 A6 z5 m$ d
% M0 c/ N. |5 H. H( i P9 a; X- #undef EDMA3_DEBUG
n% s6 v2 [4 X1 z$ S5 c" x4 F - /*#define EDMA3_DEBUG*/
4 k) x- y9 A0 i# l) L3 K5 ~ - , w- S: p( B4 r1 M( W
- #ifdef EDMA3_DEBUG
* H$ B9 {; j5 _+ u' t7 y/ }$ c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& R, R+ { K* g0 k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 b1 i6 \" C. K6 w1 Z/ R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 o4 {0 q9 O2 c1 `0 X; y - #else
8 G( ~9 h" u8 L2 p& k1 t. O9 L - #define DMA_PRINTK( x... )6 B9 L3 O+ H) Q% a, t( t: G q
- #define DMA_FN_IN: `1 `+ @1 w0 `2 a: F6 Z$ B
- #define DMA_FN_OUT
& }+ z9 n Y3 i; |! j - #endif
3 Y3 {4 F1 S* h+ t C
' `5 o, }. ^7 O$ e3 _$ ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768): s8 P3 G9 o* U! u3 J& I4 r
- #define STATIC_SHIFT 3: ]. ]; c: [/ [9 K
- #define TCINTEN_SHIFT 20 n5 b# `' A% }& r' s/ }
- #define ITCINTEN_SHIFT 21
$ {) W$ e6 c9 ~/ r1 o; x, N) X5 M - #define TCCHEN_SHIFT 22
5 a3 }" N0 J* [! G M, e# Y - #define ITCCHEN_SHIFT 23
( w" ^: s% U* R2 p
" i: Q. a9 X7 \; B/ h- static volatile int irqraised1 = 0;* B& Z! P. D# s$ I- |% o$ _
- static volatile int irqraised2 = 0;; x8 `9 |! { U( o1 x
- $ l6 u' d: k5 m- \5 J1 b! J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# N+ L5 Y1 B! V+ A0 J0 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 N! b3 s( T% b7 ? S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) a+ o% b% X* V6 C6 p
- ; F9 q4 |. |6 J
- dma_addr_t dmaphyssrc1 = 0;
0 W& F7 Y; {! J; {$ i) g; T8 N9 N - dma_addr_t dmaphyssrc2 = 0;. t( H2 ^: ~' _/ K' ]
- dma_addr_t dmaphysdest1 = 0;# S, b% Q2 r3 G; Y: R6 S
- dma_addr_t dmaphysdest2 = 0;- M1 \, r. T1 d$ S4 b! W1 ` r* a' r
- + J3 I3 c5 W+ P
- char *dmabufsrc1 = NULL;/ R4 b" ` F' N2 |( c, J6 s; P& O; p M* M: E
- char *dmabufsrc2 = NULL;
8 M( [1 G- L" F - char *dmabufdest1 = NULL;
" f% c, a" R+ j4 J0 d( a - char *dmabufdest2 = NULL;
$ B# z- o0 V/ M! C6 E& U! D- m
6 \7 b1 @+ ?9 Z8 a& x5 d- static int acnt = 512;/ X& s d& k) b; ~- p+ ?7 u
- static int bcnt = 8;* E% s. z5 ~8 K6 r* z/ N+ F# s
- static int ccnt = 8;, a- y- `* T2 }! ^; T; i
- . g& H2 K: Z: ^5 V5 U0 Z2 ~
- module_param(acnt, int, S_IRUGO);- E( G# E7 I4 `( _ r& Z. X7 Z) C
- module_param(bcnt, int, S_IRUGO); Z4 v4 r( J+ D& G: b
- module_param(ccnt, int, S_IRUGO);
复制代码
* d) U) Q5 `- ~0 U/ S; t3 Z
' P! Y* L: J/ V7 K g0 m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 b6 Z+ Q: X# H% X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. h, m [1 b+ [8 E* n( H# y B9 R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 B6 h- y8 C! Y- S! T1 C4 p
: B! A0 x# u7 t8 B
$ [- b' h. X+ r. j ~) r
|
|