|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 n4 a/ G* y; v% K- ]8 [+ j; P
- [code]EDMA sample test application
6 t; A& g; ]! b - /*
# f- M$ j6 I" a - * edma_test.c3 r) }+ I I, [* A, s$ _
- *! R6 T3 I# h% k8 G
- * brief EDMA3 Test Application
4 y4 t `5 N3 k- ~: x8 } - *" k1 c' ?* S& k; \- J
- * This file contains EDMA3 Test code.0 q' O& s5 X# z) v" A( Q) o3 @$ C
- *) V+ J+ \4 E! P! ]+ _3 h$ ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
w) ]$ a- }. j* U; [: Z+ ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 y7 @- ?; }: ]- Q2 k1 }
- * TO CHANGE.
; X5 a% b. ?# } - ** Q$ Q$ B$ D! }5 q) j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( A# G" D* ?+ Y( e8 n7 v
- *
3 {: X: X8 E$ l5 T% {3 x Q - * This program is free software; you can redistribute it and/or& @. F/ K6 Q2 |% X& V3 P
- * modify it under the terms of the GNU General Public License as9 e+ i8 X8 r, O+ w; z5 x
- * published by the Free Software Foundation version 2.1 B' w7 T7 Y/ {9 [/ P ], z
- *: l- F: r. G; K2 ~5 M L6 F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. K/ Y3 P0 b( x5 F) S" @
- * kind, whether express or implied; without even the implied warranty) n; a8 K; q5 Z. f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& l0 z6 h& {, k* D+ e
- * GNU General Public License for more details., n C Y* E. V" {' a! R7 L' q
- */
( H& ~3 @% F% _5 t# I- q' r
! o! W9 w! x4 D, m% i3 f- #include <linux/module.h>
* a2 W' N6 i; a, n - #include <linux/init.h>" a; A; _) X% S6 k# K
- #include <linux/errno.h>
) C% A7 r' B3 S. T& N. H - #include <linux/types.h>
1 W) u! T q9 T+ w - #include <linux/interrupt.h>
9 N' K% y M7 b0 J( s2 W - #include <asm/io.h>+ g3 |8 [6 z$ K7 o0 I
- #include <linux/moduleparam.h>
4 ^3 m$ k# i' [* e - #include <linux/sysctl.h>
/ J; K- G" F4 G- V - #include <linux/mm.h>
& p( {+ R9 t1 J8 i) J/ }& e - #include <linux/dma-mapping.h>
% D/ J2 z' `, o! ~6 R x! m8 l* X - : A* Q* H9 P8 L8 _
- #include <mach/memory.h>
! c( O/ ?! V6 U5 v; |: t - #include <mach/hardware.h>. F. V0 j. Q$ D1 n0 P; m, x) t
- #include <mach/irqs.h>
0 B. l0 W2 F. L - #include <asm/hardware/edma.h>% H: R, B+ n' s" O9 Y' a
$ ~) s% Y: D8 H7 z; l- #undef EDMA3_DEBUG
0 h2 J+ A- i, s - /*#define EDMA3_DEBUG*/
- N- O6 m7 a- I0 B, N" a2 ?1 g
, Z3 [: V* `& H7 A, I" j' w6 N- #ifdef EDMA3_DEBUG
5 n9 f8 N9 p& u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( o7 W. q& g' o& h% \9 t* d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; i: b; A5 [! v9 z' a$ p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ d5 C( O2 \) m$ T9 G
- #else' d) b* ?' h0 D3 x b+ K
- #define DMA_PRINTK( x... )
/ S. t/ }- y! ] - #define DMA_FN_IN
5 z5 J% J" P" M3 s8 A - #define DMA_FN_OUT
+ S' L/ O) y' w2 B' o1 m: m8 k - #endif( ?0 G0 w2 l1 F' g* r. Z" z
- ! s- F: ^9 v# Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% |+ O2 \* i M, h8 L5 s/ n) r$ ~
- #define STATIC_SHIFT 3
: r( H9 ?7 R% t0 S; F - #define TCINTEN_SHIFT 20
/ V9 ~" T$ m5 n G6 k - #define ITCINTEN_SHIFT 21
K9 x. b. r+ ^% U* d - #define TCCHEN_SHIFT 229 q; G" r [# ^. M
- #define ITCCHEN_SHIFT 23# x* w; }" O9 W& ~0 V
- ' t- ]$ z! P& _4 c2 |
- static volatile int irqraised1 = 0;
2 `3 J, K ?8 P# X* k" U) g8 p) R - static volatile int irqraised2 = 0;
% \( I$ ]: ~# e2 _ - , B* _6 _+ q3 a5 \' q P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ?. w, {% b$ v" s8 k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 c% o& i9 h) @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ {" u( [( D3 ~! a, o" q
8 ]3 k1 n9 E2 A: f2 E- dma_addr_t dmaphyssrc1 = 0;
3 L. m, z S0 [. ^0 O `* Z - dma_addr_t dmaphyssrc2 = 0;2 R5 s2 ^6 N5 N7 X) ]
- dma_addr_t dmaphysdest1 = 0;
' v& g; Z( e8 p- {6 Z/ r - dma_addr_t dmaphysdest2 = 0;. {+ K M* I+ @2 S6 u7 A
- , D' c2 t* F O7 x7 `( ]
- char *dmabufsrc1 = NULL;
$ P: [3 `( ^$ S3 z' n - char *dmabufsrc2 = NULL;1 V5 ]! |9 x. A( y; \
- char *dmabufdest1 = NULL;( K2 |+ z8 y% }& i* J. Y% e; q$ d
- char *dmabufdest2 = NULL;* z3 @! b2 Z5 K+ x7 E& i% ~
2 D% y& Q6 v* `3 A! Z. e- static int acnt = 512;. q8 B* }7 H; M
- static int bcnt = 8;- c/ n+ g, F5 Z _9 \/ Q
- static int ccnt = 8;
" ^5 \9 r1 a5 q. y7 ?
5 v2 B$ j# |( l* u# l0 @- module_param(acnt, int, S_IRUGO);
. }4 w4 a. a1 V$ ?2 m/ q: v+ t - module_param(bcnt, int, S_IRUGO);8 n7 G9 E1 V/ \, O! R
- module_param(ccnt, int, S_IRUGO);
复制代码 ! k$ F6 v; I9 l, q# W$ ]# ?4 m- P
3 Z% H( e/ q' o6 s0 `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* v N D8 ^- m1 @6 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ R) J) F7 b( s2 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 O, N9 V8 N) I7 e8 k
& W% J2 `" B8 |
0 S- I+ u* e3 R# S |
|