|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 i4 I6 i5 S z* _! o" y4 I; P- [code]EDMA sample test application
! g3 l# Q5 p. t3 Y8 S1 t6 h - /*
. t" c6 K% r' q' @+ H* C& z! X - * edma_test.c
6 r4 i. ~1 Z a) g$ o. m" h - *
! J3 y& z6 F C# x7 w( n# y! b - * brief EDMA3 Test Application
8 r$ ^1 h) e4 ]9 C - *1 c0 k) z' r2 d9 G
- * This file contains EDMA3 Test code.
M$ G% I, d+ M. x2 a/ ?/ ? - *
. ^& c+ P0 b) T) X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# P% k( E6 F/ N) W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: u( X- B8 A. e5 I' v5 S - * TO CHANGE.7 r: r" K) s" @/ l
- *1 t: x6 n& D3 N2 b+ j. E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 J& e/ u" [% ?! B7 s" g B& s - *
y1 c V$ E7 q& k8 n1 K' a - * This program is free software; you can redistribute it and/or) T" `& D; q' t/ q$ W1 z0 l
- * modify it under the terms of the GNU General Public License as) P/ w! X' R! d n2 h. l3 M
- * published by the Free Software Foundation version 2. Y) I4 b* p7 q- ^
- *& J( h. K7 H$ c, \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ x4 l4 {) u( a7 ]8 X( ~* e - * kind, whether express or implied; without even the implied warranty
$ I" V; u" F0 d/ @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 \& X" P; W: s4 P
- * GNU General Public License for more details.
: t/ a1 c5 r5 u$ S% P" b - */" l( k" ~- q! i3 B. o% I1 r, I7 p7 `
- " N# N. Q* t" }, j& Q: k3 `) n
- #include <linux/module.h>
2 v N& n/ m- V+ \4 e - #include <linux/init.h>" X; i6 N! Z9 ~9 y8 w- U4 t
- #include <linux/errno.h>, \$ h% N4 Y( W/ U( G2 m
- #include <linux/types.h>3 @5 l" s6 @) W/ S- n
- #include <linux/interrupt.h>
7 n* T" k }* A4 `( c9 Z6 { - #include <asm/io.h>% z! j5 h$ _3 \$ x) p
- #include <linux/moduleparam.h>- r' n' N# K+ }. W; e
- #include <linux/sysctl.h># q9 f6 }! S, |( o. e' U1 l% F$ o, x
- #include <linux/mm.h>: _! Y; ?6 _- {, E
- #include <linux/dma-mapping.h>8 H3 S7 @, o& {& G: b
- 2 c I( B9 T w$ @& }
- #include <mach/memory.h>
0 n# @; h2 R0 l! S q( }7 ^ - #include <mach/hardware.h>
; I1 S, \0 E) g2 X - #include <mach/irqs.h>" L) B/ ]1 q' D3 @
- #include <asm/hardware/edma.h>: |( D' q7 a- E! g0 E
- $ j$ L6 u- i/ o+ A, j6 D
- #undef EDMA3_DEBUG
z$ N% Z, l* K" f( p7 U7 g - /*#define EDMA3_DEBUG*/- w/ S, M5 n- }" \3 V8 t
0 c/ k) k/ R& C9 }: S& Z- #ifdef EDMA3_DEBUG3 K" s- l3 Q8 H9 e3 a6 T/ ~( Z$ x) ?5 c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, H, [" h, g. e2 C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 W$ @1 |2 h' S7 l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* S! b! B: L; `6 M& H$ w$ t3 F! P! o - #else
; U- l$ Q8 d5 Z1 X; T% g3 u+ X - #define DMA_PRINTK( x... )
& `6 V& H; {4 n* w - #define DMA_FN_IN+ s: J4 ]5 M8 D. z! y
- #define DMA_FN_OUT5 f5 g4 o9 M. m) T2 }& S) G
- #endif6 [8 H5 R8 w) h* {
) p" q" f1 t6 d# H. ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; f: K i2 o2 I, A$ d. X, E - #define STATIC_SHIFT 3
4 ^1 X# f* s. z0 o- u - #define TCINTEN_SHIFT 20+ V- l# ^# y. V' n0 @7 i. t1 Y
- #define ITCINTEN_SHIFT 21
. x( H: w1 V+ x' t% L+ Z7 d - #define TCCHEN_SHIFT 22
; C9 j* h. V8 z! { - #define ITCCHEN_SHIFT 23
% m: k) _! W8 x* x+ j; Y# \ - 9 @' L: b$ g0 |2 D" o' Y
- static volatile int irqraised1 = 0;
5 s8 v" l$ W5 `0 r2 K& I - static volatile int irqraised2 = 0;
* \: ^ b) p$ \. l$ R! B: I
8 h9 K: v. T: e2 g. ]3 v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 F: s4 g6 P0 \+ f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; ?8 L e" K7 q8 n6 a; ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ }8 J: j/ ^$ k* ? - $ h2 r) b% c( D7 m7 Y, C/ S2 G
- dma_addr_t dmaphyssrc1 = 0;
7 A. [' k7 U7 R; Z - dma_addr_t dmaphyssrc2 = 0;
0 X1 M3 z" w- E! ]8 ? - dma_addr_t dmaphysdest1 = 0;
- _% h/ {9 i8 U A' i# u* M - dma_addr_t dmaphysdest2 = 0;
7 F$ b {4 _/ q
+ \. i3 D- A7 b, q6 U- char *dmabufsrc1 = NULL;4 D+ w( E* q* F1 N* j
- char *dmabufsrc2 = NULL;4 q8 A2 d$ _4 _; O' C: t. Z8 |
- char *dmabufdest1 = NULL;
4 _6 o+ Y; M. {4 M- E6 v - char *dmabufdest2 = NULL;
* |/ \& I, G: h) {
8 q5 f3 w7 z3 f( e4 Y8 c- static int acnt = 512;7 h }2 O" u* D7 v1 n
- static int bcnt = 8;
+ r' y; f4 O1 s; f' | - static int ccnt = 8;
1 U% \% z! D* i% U" d1 B+ x - ' X! `; f* z3 r: L j, `$ p: c
- module_param(acnt, int, S_IRUGO);; s/ |0 b4 w& g
- module_param(bcnt, int, S_IRUGO);6 O7 y. ]- F8 U
- module_param(ccnt, int, S_IRUGO);
复制代码 6 s/ s/ q& U9 n$ {
5 C6 w1 {/ j( x J5 h! O! ]) K4 W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 s2 v5 Z" C$ q- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ O; b! s( Z' }, M1 P& L6 e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: n' R5 y+ y2 N' K9 v) R
6 Q6 z" K2 @7 H/ z% _: {
- R% R$ d1 `( w) h; W2 l |
|