|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% }6 @9 m, B: O1 d0 R6 E- [code]EDMA sample test application! P; ?+ O- O d1 o2 | N
- /*
- J4 A( O( t4 H' {# V1 p$ h - * edma_test.c
2 W5 z- t2 x) ~# y2 e - *
! s% V* a! L& L2 t3 F - * brief EDMA3 Test Application( q _, |! t9 X; m2 u ^
- *7 |& s7 ~3 t% X" y) p8 X
- * This file contains EDMA3 Test code.! Y, a$ r! A8 R% }$ Q9 v( f8 U; k+ o
- * c& y. G# z. g& q Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
O0 ]- b' I+ O" O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& B. Z9 F) A) t# k
- * TO CHANGE.
% w8 q5 \4 B9 I. V1 ~ - *
9 l, f% H$ A4 j, F( m& ^0 \, f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 K2 _6 J# s; p - *
. E. [6 F' N- D3 n; W! A6 y - * This program is free software; you can redistribute it and/or
3 q4 Z p& x2 j: `$ H, l1 l - * modify it under the terms of the GNU General Public License as# P' Y/ I" H# ~4 ^ d k
- * published by the Free Software Foundation version 2.' q6 W& z& B! m$ E, k
- *
% S. \: b4 } g2 J% K6 D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 z) D" F( U* b, ~, t2 x4 f
- * kind, whether express or implied; without even the implied warranty
R5 {) R1 ?8 F0 a3 O4 V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 l, _# i: r, {
- * GNU General Public License for more details.
3 |: `/ V8 ?; h/ V% K. R - */% D1 |6 ~$ I' t' i9 q
- + C0 F( Q' t5 w
- #include <linux/module.h>5 Y$ ]- h- x& Q
- #include <linux/init.h>8 V/ N; y) Y( P* C; }
- #include <linux/errno.h> }& Y7 h$ I3 y, a
- #include <linux/types.h>
. Y% o* T8 Q& [7 Z3 O - #include <linux/interrupt.h>6 ~8 t9 D& N1 c! I+ A% w
- #include <asm/io.h>
: g" V2 Q. n" |# A5 H - #include <linux/moduleparam.h>* o$ e) h8 T: i2 ~
- #include <linux/sysctl.h>; w. j% Y8 A# s# @
- #include <linux/mm.h>
) X5 l% @' t3 C- O - #include <linux/dma-mapping.h>( g% a/ y9 E% ^4 T/ M7 ]" {
1 T |! c, k! R- #include <mach/memory.h>
$ ?/ i5 e$ P" ~4 j* ?+ H - #include <mach/hardware.h>
- n: a8 N' o6 w& W - #include <mach/irqs.h>5 l# {* E4 L6 L, _ F4 h
- #include <asm/hardware/edma.h>
r& K/ u& t: L# h
7 U, @# ~! t! w4 O- #undef EDMA3_DEBUG
( o9 \) g: I. |% P; R1 ~ - /*#define EDMA3_DEBUG*/$ e7 I b- g/ H3 ?& _! M% X- v
$ U2 h( N* s) R- #ifdef EDMA3_DEBUG
4 f/ F% L5 {2 A1 S/ Z! a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 B) n" o2 ^, {9 h2 v% L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# g" P' v- B% r% o4 p) i% S- } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& Y$ n0 `7 Q! s5 ~. i
- #else
- f; L; K9 Y9 T - #define DMA_PRINTK( x... )
5 u) q% r R/ E8 @ - #define DMA_FN_IN
2 D$ M) t8 r8 ?/ C# \6 p - #define DMA_FN_OUT. C3 o; g! I, T! G" U1 L
- #endif
& H7 W: s9 [. |# f0 S) K4 @$ T; f
( u4 E* [2 {# g2 o7 w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; q& C) C2 ~/ ?3 L x$ Q% \ - #define STATIC_SHIFT 3+ \% s& Y# o+ A2 |$ Y
- #define TCINTEN_SHIFT 20
/ B" h. K" k0 A: A# U8 Q - #define ITCINTEN_SHIFT 216 @5 ^+ ~% \6 s4 b+ c
- #define TCCHEN_SHIFT 22
V0 r) h0 A, D0 D - #define ITCCHEN_SHIFT 23
, x( h4 c/ z+ d2 ?* X$ Q% [
0 t0 r! [/ p4 G) u2 _1 q- static volatile int irqraised1 = 0;& B& A$ j7 }# b/ Z3 Y3 l
- static volatile int irqraised2 = 0;
3 o' W7 Z) }$ o8 u! ^: I4 P* [ - & q9 C4 p0 | k" j: k& b( a2 q# e2 v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 E/ ?7 f e+ E R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" K/ o, v' _3 ]/ J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 h0 H7 p' o- x0 U
5 [+ R) ^( }& u4 C* `2 U* y- dma_addr_t dmaphyssrc1 = 0;) u4 t2 W+ S& k7 G: n$ z3 I
- dma_addr_t dmaphyssrc2 = 0;
- X) H3 t! D2 j6 [$ G - dma_addr_t dmaphysdest1 = 0;7 c& q5 k% t, M' d- ^
- dma_addr_t dmaphysdest2 = 0;
2 i1 w9 |# p6 ~9 i
7 G: P0 L0 r& p3 W$ B& Z- char *dmabufsrc1 = NULL;
! ]. L& e- z- T7 n G8 {" Q5 `( j - char *dmabufsrc2 = NULL;
8 j/ a) V: Y5 i8 j: |" M - char *dmabufdest1 = NULL;
& l( Z& Q e* _/ [4 v; w5 Y2 ~ - char *dmabufdest2 = NULL;
% W, V# b5 D$ g0 q; g# c
( V7 k* t1 \; n( T0 x% Q; J$ E- static int acnt = 512;
# d9 m% D8 ]3 Z G5 j$ o/ ? - static int bcnt = 8;
! q9 }( G+ n( q7 L' Y4 J( | - static int ccnt = 8;
3 v: g6 H! j( m+ q7 b" P5 { - 1 T# ]' S# l& g; \9 T' }( \
- module_param(acnt, int, S_IRUGO);
: U4 m5 Z- h8 k8 v - module_param(bcnt, int, S_IRUGO);
3 K# F H, i0 w' r& I4 V - module_param(ccnt, int, S_IRUGO);
复制代码
+ H% H2 {( I+ H; ~6 b/ E
8 S- M! i" r- q/ c: | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ j( ^$ s+ @ }3 l% ~% o( N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- @; n% ]5 g: x+ p& n6 G' ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 F. j4 S( e4 v4 a
2 G3 e/ A: y# I1 A
2 c5 k1 {' \( d5 A% o$ Y |
|