|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 V, {3 U& n- x* d4 ?
- [code]EDMA sample test application
4 K: V4 l+ u9 A3 u2 T& I - /*
( P) G! D0 e3 B9 o7 }6 k - * edma_test.c
/ M9 T7 Y) N( _ - *) X# A# D+ W; B# h ~9 C" r
- * brief EDMA3 Test Application2 M! K% Y7 O1 m) b. d: [8 m
- *
3 G4 l3 q9 e4 [5 _9 ^ - * This file contains EDMA3 Test code.3 s+ f/ m' i8 B3 p* A% |
- *# n7 D3 X7 [! a0 i+ V- j. ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% A3 h4 k, b; C: G: f& j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& e9 [$ y- q3 C7 q8 y' G8 D - * TO CHANGE.
( V& J8 n T* S8 i- ] - *
( n9 a( b1 \$ Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! F5 q4 l+ F$ Q; k/ P! |' d - *
# }0 _+ ^9 B9 x( b5 m - * This program is free software; you can redistribute it and/or
" `# w2 G" |' a0 x' { - * modify it under the terms of the GNU General Public License as$ R5 a; A" p, u7 ~" m1 Z* K
- * published by the Free Software Foundation version 2.
4 \2 C! H) B5 g4 U" P) f H - *, r* A' e1 |: Y6 P. T' X8 o; Q G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% h* }. Z2 \2 n8 E! C* ^
- * kind, whether express or implied; without even the implied warranty: G- q4 i9 F3 _1 Y; J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ ~0 m0 g' {- w* t( L1 E+ f$ B - * GNU General Public License for more details.
" k; ~& a y6 V8 Q- e9 | - */
6 V' p& b3 x8 I2 T
5 _" M& h N! N+ o+ y3 T- #include <linux/module.h>
( C [ o- c: B3 f - #include <linux/init.h>
" m0 t$ E3 L1 E - #include <linux/errno.h>
% h' x- C# ]# D% A: { - #include <linux/types.h>
& W- Q m" H+ D* y% s8 i9 r0 j - #include <linux/interrupt.h>% h- k- C* ?1 f5 n' o
- #include <asm/io.h>- D8 h; }: f9 ]! Z1 n7 t
- #include <linux/moduleparam.h>
% c8 j( k5 r4 t( F+ O5 H Z - #include <linux/sysctl.h>: A8 ]3 a+ b; L T- [4 y- _
- #include <linux/mm.h>9 T. n+ B7 X2 r+ q/ k$ M
- #include <linux/dma-mapping.h>
$ P3 c" a1 i5 g; X0 A0 }7 A1 e. q - M; T4 [# F' A* H' s$ r2 s$ L* b1 u* J
- #include <mach/memory.h>
5 `3 e4 x! T1 R( U; D - #include <mach/hardware.h>
, V, [+ I. I: x4 s4 R - #include <mach/irqs.h>; D, N3 C" B; c
- #include <asm/hardware/edma.h>2 X1 f7 F' u* l9 J* V3 `5 G
- ! Z+ e$ \, Q9 i% g# l6 T7 B
- #undef EDMA3_DEBUG5 `. _$ M1 ]$ R; E
- /*#define EDMA3_DEBUG*/
1 \! ~9 I6 N0 S( z
1 l9 k) z y7 i4 Z2 q) x- #ifdef EDMA3_DEBUG% Q0 h- _! n* V* G, r' O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 B! D5 S9 P( J1 R# c2 r# ^+ H/ F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 d. ?; S5 |3 j. c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" N; e/ i2 I# p& u X
- #else
5 M" N) C6 f3 J1 J( q - #define DMA_PRINTK( x... )
1 ^8 P4 {4 @7 A7 d - #define DMA_FN_IN
& r. J: A0 b E - #define DMA_FN_OUT
9 q M. X f( E6 [/ v6 V - #endif1 b1 j4 J. q& ]" r0 F8 o( F5 m
- ( y) b9 \6 g( B# X; g5 P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 D! s* `$ u$ ` r! T - #define STATIC_SHIFT 3
6 r, O- M" Q6 Z8 i* o - #define TCINTEN_SHIFT 20
- [ q3 \1 \% R" [" q, t5 B - #define ITCINTEN_SHIFT 21. g3 K$ w; l' f
- #define TCCHEN_SHIFT 22, Q4 T" X, @5 a; k) n' |( j
- #define ITCCHEN_SHIFT 23
5 }& S1 C; h: ~0 e5 i1 B - ( ]' O8 l8 i' \4 Z- J7 S- p/ C
- static volatile int irqraised1 = 0;; C5 }7 O' j. w1 ?1 y
- static volatile int irqraised2 = 0;$ ~' v6 b$ @. U$ i! b# {
- 8 P7 i+ Q+ a# e7 n) B. f4 A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: e: v/ }8 A' k' o+ ^; p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ c. r" [# E) z8 M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& G# d2 ?( z7 Y
9 L" }9 @( D! t! `4 r7 Y- dma_addr_t dmaphyssrc1 = 0;
" B N3 w' [" m( `/ o, M - dma_addr_t dmaphyssrc2 = 0;
% O0 j" D7 y! t7 _$ g6 B2 F - dma_addr_t dmaphysdest1 = 0;7 M S l( p* ~ H! {( l7 k8 S
- dma_addr_t dmaphysdest2 = 0;% C! h8 b. x+ Y4 j
- ( |% M5 d3 P3 V5 ~* e. G b t3 x
- char *dmabufsrc1 = NULL;
+ k( i5 W* L3 K3 R* U9 c5 @: j - char *dmabufsrc2 = NULL;+ h7 S O( `" R, b
- char *dmabufdest1 = NULL;( P. S" j* X. A+ A* g) z) e: [
- char *dmabufdest2 = NULL;
" t. _- w# g: p
( `6 H0 Q4 N% Q. e+ B) i- static int acnt = 512;
Z3 T4 ?0 ~' ~0 ^/ e: k* i( y) J - static int bcnt = 8;3 F' B& Z6 b. V3 z3 s0 x1 ]3 T3 @
- static int ccnt = 8;+ j. p1 \' U/ M5 v5 D7 O7 T% I: V. r
9 o& m3 u2 n8 }- module_param(acnt, int, S_IRUGO);( I& C/ T5 c7 ]0 |0 f t: `
- module_param(bcnt, int, S_IRUGO);
. Y6 ?5 {% e& G0 Y3 J* D3 G - module_param(ccnt, int, S_IRUGO);
复制代码
2 M( q% m% j3 Q/ j' W( V# W9 ]5 U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. X8 J6 D( Z$ g& w3 iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 r. T3 B7 k" G+ c( _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 \2 a+ a- E& I5 q2 R& h
# b/ Z3 h* \: f6 D7 q1 i( i+ y1 N% R0 @4 j
|
|