|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % d+ x2 S) [. d/ [
- [code]EDMA sample test application
! J6 M' E1 N K8 @* d6 u - /*
1 d5 N0 l2 r m# Q+ C7 i/ f - * edma_test.c
- h; r C1 f! ~. g( Q* Q+ j - *
* j" o$ V) Z2 {+ N0 W( D# h0 l& k' L - * brief EDMA3 Test Application
- C. v8 p0 E4 s2 O - *
4 C# a9 E6 [" R f/ H- S - * This file contains EDMA3 Test code.
+ K6 K& l) f5 L' X- @6 `+ I7 o - *
' t8 {8 a* ~ a% P( M, U0 e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) o7 a& |9 j9 L3 l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, L* _1 B B! ]
- * TO CHANGE. X1 T0 x( L6 a! ~% S1 ~: P/ [
- *! f* X2 I7 q) @. m M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. I# `9 n3 \" Z. |
- *
# d! O; t5 @4 O7 l2 J7 h2 G - * This program is free software; you can redistribute it and/or6 t0 Z% F- t6 w/ a; N) t% ^
- * modify it under the terms of the GNU General Public License as
2 J! g; \& Z7 B+ l - * published by the Free Software Foundation version 2.
) Y4 t4 q _9 T9 q - *1 E4 C! C# H3 J& R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* M2 ~8 x$ ~& @. ]6 y. C
- * kind, whether express or implied; without even the implied warranty5 U- k( Q- {6 r+ z5 {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 j ~" H; W; D* ~4 G
- * GNU General Public License for more details.( {3 q( q: b$ X9 c+ O
- */
5 y& u5 Q6 p* X& W1 B4 n7 g - 0 ^) I& H- k! v% V2 y8 `* v
- #include <linux/module.h>7 \/ `4 {2 `* G4 R3 }- d
- #include <linux/init.h>' x( g: _' l, L4 Y' ?7 [
- #include <linux/errno.h>
! b7 x! k- @ q( T E4 z( T - #include <linux/types.h>
5 {8 |) F' `9 o& v- A& d& S - #include <linux/interrupt.h>7 y" S2 K$ K& ]: _4 p
- #include <asm/io.h>
: A# z; o, D) E q- ?& K - #include <linux/moduleparam.h>7 C! @( ?% I/ e3 t1 ~! s
- #include <linux/sysctl.h> \# R( Z- V0 u! f1 s
- #include <linux/mm.h>& N' a( i# N/ i3 K1 w
- #include <linux/dma-mapping.h>
% k# t( [4 [/ N8 j - 9 w3 l/ n2 w) Q5 ~8 f6 O7 ~( C
- #include <mach/memory.h>" P# ]! g: e% H4 G: u
- #include <mach/hardware.h>
0 c- Y5 O7 {& V+ ~& U! J8 Z8 S - #include <mach/irqs.h>: ^; i$ [. H. D, b7 Y5 m
- #include <asm/hardware/edma.h>$ e0 q0 R2 v* u$ `7 v L- W9 X
- 2 P5 M& W$ o9 u1 h+ U4 w8 u1 a
- #undef EDMA3_DEBUG
6 H: E' P) x/ ^7 K! ? - /*#define EDMA3_DEBUG*/7 V& |% b5 d, _; N$ |
& o( n7 h" w, V# N0 n6 o8 t8 o- #ifdef EDMA3_DEBUG# S" \* O) u. I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ U2 Z1 a0 l2 y0 R' q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! w- v' \! n% r5 `; a3 a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 D$ U% m" y& ^0 u c1 U5 q
- #else1 l; Q) W6 q9 x# W+ u3 @0 b
- #define DMA_PRINTK( x... )$ _3 I1 r) ~' h- `+ J
- #define DMA_FN_IN
y9 Y; z0 \2 s' X! x, f/ a( O - #define DMA_FN_OUT& r2 S Z% T! I% T* q# y s) @
- #endif7 v0 Z, |# f, v0 `- e/ Y
- 5 f3 @8 X3 _& u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% H4 I/ G) p4 [9 L, l- @ - #define STATIC_SHIFT 3
0 q7 q$ p4 |: G) r* p - #define TCINTEN_SHIFT 20
! c1 j( r, D6 Z% r4 s3 v - #define ITCINTEN_SHIFT 21/ _# g' o9 G; _1 [ K1 S L9 w; u
- #define TCCHEN_SHIFT 225 C% `6 C/ G! M# h" \
- #define ITCCHEN_SHIFT 23
) C- G* C1 A% v" V! Z - . h( O, _: x: @3 D1 `7 {
- static volatile int irqraised1 = 0;
$ s7 J/ y0 I5 A: P5 W+ q5 X3 h - static volatile int irqraised2 = 0;" x2 E! b: s. l& S q8 A* B. r
+ k2 V, }$ j( |5 j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 S6 J- }* t9 F3 G/ J6 ^4 j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, c5 R- }4 @: J9 j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 U2 u) m% @" ^$ k: ~ - . m+ W5 o' y& `( y( e
- dma_addr_t dmaphyssrc1 = 0;
6 O. j' e% P# K$ `; } - dma_addr_t dmaphyssrc2 = 0;0 G; [! |/ D, j* ]+ w
- dma_addr_t dmaphysdest1 = 0;
4 a, l( X- ]) K7 M - dma_addr_t dmaphysdest2 = 0;
2 E r2 U* B$ `( a) T
$ W- _( c( L# J& s' p8 L- char *dmabufsrc1 = NULL;, p) p+ ~. V7 Y3 n0 D' a! i! h
- char *dmabufsrc2 = NULL;
3 V& f0 V$ X7 x9 |! d5 _ - char *dmabufdest1 = NULL;
1 l( R! T9 O" o; d - char *dmabufdest2 = NULL;
, o# R: [0 G! X1 E0 M h
1 V5 x) ^* e( |- static int acnt = 512;& q) f) O- E; ~
- static int bcnt = 8;
: H& r; J" I2 B7 R - static int ccnt = 8;0 `1 d/ @0 x9 P4 y) S1 r( f
- 9 }% o, g A* S
- module_param(acnt, int, S_IRUGO);0 g9 {, s- o, H, ]- [7 _# w V9 n5 f
- module_param(bcnt, int, S_IRUGO);0 s$ a* Q" o7 d+ C) p8 u
- module_param(ccnt, int, S_IRUGO);
复制代码 % E$ z: U; {$ Y8 a, f
' [1 M0 v- R# _, d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: k+ Z$ K; g+ U: y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ ~4 E8 Z) X- A& k) g1 b" _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- w! ]# a4 m+ Z t0 f U2 [0 h5 k k4 D5 P' Y' {5 x
* W" b A$ V# ?" @
|
|