|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 p+ E- v6 i- F$ n& d# \9 m1 K
- [code]EDMA sample test application; q& D4 c' V0 S1 A% f8 I) q
- /*9 z1 G. Z- [5 @. X' Q
- * edma_test.c0 C! }# j$ q) b) ?( l* o2 a
- *
& ` m: U- x8 v9 K0 Q) b* b# e5 w - * brief EDMA3 Test Application
" R- ]) S1 o$ @ - *% j- f& ~+ N1 A; T' C2 h/ |( R
- * This file contains EDMA3 Test code.% L% t& k6 r4 `9 i" y
- *& u& \0 x- c' W( Q" A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 [9 o1 e9 k9 D; r" S- ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 p+ y2 B) d8 X( F- S
- * TO CHANGE.
1 }6 M4 b" E0 z+ Z9 r4 I; c - *1 r4 g. r& R3 \* F, S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 u& Z. |: w- e% U/ f1 X3 Q - *
0 E2 _) }$ V+ Y1 A+ |* k - * This program is free software; you can redistribute it and/or# b8 b+ l, X5 K
- * modify it under the terms of the GNU General Public License as* ?0 X7 e& a; B$ p. Q1 l0 K- |8 l& Q* j, ^
- * published by the Free Software Foundation version 2.0 O. A: X9 F/ K
- *6 t" T1 }: i2 {; G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; I1 F! y( W3 B# h* @6 c7 \) q - * kind, whether express or implied; without even the implied warranty
, d/ g0 B& \( Z: s P5 L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, T* ]0 Y5 |' ^4 @! J8 p* N( | - * GNU General Public License for more details.
# S$ c/ r4 c+ u1 Q7 F2 J" b1 M - */
% v/ O' {9 o- b+ I
3 B n) O. Y* H, H/ t- #include <linux/module.h>
* i8 v- b/ [% c - #include <linux/init.h>+ `- w" U1 T; }& s1 v x
- #include <linux/errno.h>
+ g# \$ @( Z# I; E4 C( y* X$ W - #include <linux/types.h>
) l0 D1 N3 S- ~" l$ R( Q& N8 [1 } - #include <linux/interrupt.h>0 N" @% X: _% _6 z( B
- #include <asm/io.h>
4 ]9 X, B ]! @4 q' c- D8 T - #include <linux/moduleparam.h>
% w0 _- k- f+ |. ?- E; |5 C) B - #include <linux/sysctl.h>
N# J/ ^, D/ Q9 m. F9 Y+ z - #include <linux/mm.h>, c, f: b2 T/ e5 z4 R6 r& W& N
- #include <linux/dma-mapping.h>
# K4 J$ A# r5 l& {' q. ^ - ! [, v/ P0 ~3 Z- h! }1 M
- #include <mach/memory.h>
; W: D& K, E* l9 J8 M& } - #include <mach/hardware.h>' D; q- V4 z# ?( U& r
- #include <mach/irqs.h>7 S. C2 u+ s) n; A- H! D
- #include <asm/hardware/edma.h>
1 ?. J2 P, F5 [ [
( _1 }4 A4 D* E- #undef EDMA3_DEBUG
; E3 |3 @+ n4 e0 e - /*#define EDMA3_DEBUG*/
6 d" s7 }. G' I) P- j* q/ o8 l
% g2 G( `! `7 S2 o# h- #ifdef EDMA3_DEBUG3 H! [! H5 P0 Q: ^' u4 d$ `) _0 B! |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' C% m# N2 K7 Q/ ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% g0 }' {$ V, k( `& g4 R3 E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) B2 G& `* m6 A* [
- #else
2 ?$ P, T8 O2 p4 Q8 ?, m& l0 u - #define DMA_PRINTK( x... )
" Z$ z0 T" e! n - #define DMA_FN_IN
W3 X; c) h9 c- S$ n. u - #define DMA_FN_OUT" _( L/ n& W, s8 m: A( O
- #endif9 R7 t$ C7 I! U1 z, y6 f- } V
/ x8 Y7 x# N& g+ d+ _6 `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# `0 m$ I; b+ R# ]0 `
- #define STATIC_SHIFT 3
2 X& y8 ?7 R' T- l - #define TCINTEN_SHIFT 20
% @$ I6 ?+ {- f9 f# l - #define ITCINTEN_SHIFT 21- M8 J3 z2 y% U/ U1 { L8 p
- #define TCCHEN_SHIFT 22
) l8 B9 E% d9 N6 I5 v" L - #define ITCCHEN_SHIFT 23
( b" X y5 v# h2 e1 u3 K - . G6 u6 M* l. P
- static volatile int irqraised1 = 0;2 o. k% o; N, h" K
- static volatile int irqraised2 = 0;& {( w, b8 H9 u; ?
- / P8 h. a7 u& d' z6 }- J c" [# F0 _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); Z2 G& Y6 C1 ~& C/ s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, I: r4 }5 S- A, l% v/ a& o( R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" J! h, z1 U# v1 N
# G, ]0 F" W5 _/ b1 W. ?- dma_addr_t dmaphyssrc1 = 0;# `2 ~( c: j ^0 D/ w% U5 w* P
- dma_addr_t dmaphyssrc2 = 0;3 k W# B3 I* e5 x; \
- dma_addr_t dmaphysdest1 = 0;
) [5 R) O# K ~ - dma_addr_t dmaphysdest2 = 0;
1 y, P& H o' o$ ]! b
9 ]$ J* s( N; W: [- char *dmabufsrc1 = NULL;
/ H* Z9 z4 y5 Z7 F$ W/ k - char *dmabufsrc2 = NULL;
k) k5 c: a. Z) W: N @7 Y - char *dmabufdest1 = NULL;
" o1 [% t0 F1 n" Y3 B: n, _7 P1 r - char *dmabufdest2 = NULL;
" H! f' t) j1 D! ~" b - ! e1 W) e D: z- X, U
- static int acnt = 512;
$ T& c8 v; F8 Q - static int bcnt = 8;
+ }% `6 s% u# `" T - static int ccnt = 8;
- O5 f6 l7 V- q, A y: R
" j: k0 B) Q: y$ G+ ]0 h- module_param(acnt, int, S_IRUGO);4 z1 N& `3 ]: C4 C j j
- module_param(bcnt, int, S_IRUGO);
1 a3 D/ s1 j0 q8 T) r/ o, _ - module_param(ccnt, int, S_IRUGO);
复制代码
; N, ~$ j! @7 x$ z
* l- a7 l. D# v0 I& ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 `) c7 w" j0 C) J9 K# r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ L0 |; s9 l8 O* z P) l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, ]0 D% X: ~& z( D5 M
! f$ m8 O( @3 s1 u
8 Y) U3 \! }5 d5 D. i
|
|