|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % \' E4 S! I0 z2 v6 ^- P/ z
- [code]EDMA sample test application
8 y: ^) }& x3 s- @$ r$ n - /*
. ~, Z% I: P) ~" P' T; g - * edma_test.c
1 P7 M" o6 D- b. k; X$ Q) ^/ o - *
, R# L# X+ U2 |" L+ Z - * brief EDMA3 Test Application
% [) E" ^: s [' l( s3 k) W, F$ R - *4 y2 q. `0 V8 P) z
- * This file contains EDMA3 Test code.
) K8 N/ }& [ \: k, F4 E( s: k - *
0 Z' t$ K$ k: k G/ ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& a6 ~8 G4 ~- q, q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# H, e7 B# r0 @# ]6 @
- * TO CHANGE.* c) s, e% r$ I# D. K, _# O
- *
; s* E0 T* G8 c' S4 s! i4 I& J! R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 \4 S) ~$ l: O - */ a8 Q _0 j2 I9 ]. T
- * This program is free software; you can redistribute it and/or
5 i. m! c' S; l% p% v+ w. `( W - * modify it under the terms of the GNU General Public License as
* p' Y5 p: {$ i, X - * published by the Free Software Foundation version 2.; P7 J) @5 }" @( y$ F3 @/ ^
- *
5 K, n" B- F) ~4 |0 j9 z6 H, h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& E' s, x0 X: j$ Z! J
- * kind, whether express or implied; without even the implied warranty
) o% x U) |* D9 O0 R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) ~# A! f1 f5 o/ N - * GNU General Public License for more details.
; K6 D2 u0 e+ ?% Z2 Q: i+ L - */
/ j$ L# O, u9 \ - + M* i; D* h4 C& w, T
- #include <linux/module.h>9 P4 B* u6 m) C
- #include <linux/init.h>
/ d1 h7 H2 ? w! l$ M4 I - #include <linux/errno.h>
' L1 e; w7 Q* t8 k: a6 s - #include <linux/types.h>7 C9 M& ]3 S: o- X; f' b0 N9 R
- #include <linux/interrupt.h>
- ~7 G$ K% k% _! G2 ?; L# M, G) z8 H( R - #include <asm/io.h>
* P3 y$ U. O* p0 L+ ?) O0 S! d - #include <linux/moduleparam.h>6 B: e" w1 t1 k @8 B9 B* w% @
- #include <linux/sysctl.h>
6 ~6 O4 ]! O/ W$ u - #include <linux/mm.h># h; H z2 N o m0 D1 W
- #include <linux/dma-mapping.h>( A' U. w8 c! J1 A3 X) L
' N4 t0 ~8 _' m- #include <mach/memory.h>
% F. L/ V# P( _1 V - #include <mach/hardware.h>
: [4 O+ q0 j! } - #include <mach/irqs.h>
: h0 @" I1 @! L' I - #include <asm/hardware/edma.h>: I" i7 n$ Y9 z* a+ g7 l4 E! K
- - N2 J+ O- J/ _9 r7 ~( W; b) a
- #undef EDMA3_DEBUG
& K& r6 y2 _, y' ]" S& c" ? - /*#define EDMA3_DEBUG*/' m, M4 K, X8 [0 V
- ; u5 O. S4 n! V9 I/ W
- #ifdef EDMA3_DEBUG
' h6 U; }9 L" C, \; B3 w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* m! M, Y: n6 I/ L0 r4 [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! C3 U1 N( L+ G0 e; m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 i" a& \. Z! F" {) `
- #else3 b9 O1 K8 d" v+ ?
- #define DMA_PRINTK( x... )
& t; X2 ^+ u" F) t - #define DMA_FN_IN% L4 P! `' ^# T
- #define DMA_FN_OUT
! F/ [ u) {# A - #endif8 Y( ~1 k/ ?; ~6 S( a" s: k3 O! a
- 4 \( q; x# o+ s* Y) ]4 d& f1 i1 }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# J9 _& k- \5 ?
- #define STATIC_SHIFT 3
- O7 N1 o) q! g9 X - #define TCINTEN_SHIFT 20
+ T1 z0 w+ s$ Q4 v, C& M - #define ITCINTEN_SHIFT 21
4 m; K* M4 L6 h; [* e2 N - #define TCCHEN_SHIFT 22
/ \7 ]7 n6 Y( ^0 i. g: F0 } - #define ITCCHEN_SHIFT 23
# `: g1 ?/ D2 u# q+ v - 0 ?4 S. w: N" {, l
- static volatile int irqraised1 = 0;! l m, B, X6 _5 R$ ~( L+ o
- static volatile int irqraised2 = 0;: @" s) V4 h }, o* A9 b1 A
3 p: w( Q3 j, ^0 |8 B8 F! m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 T) j q7 D7 `2 d, R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ~' l- Q4 X" B: q) k# w( n: {' X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ B3 f7 q6 `9 _: ^" t
- 3 p7 ?8 u1 t, l8 a% C' Z
- dma_addr_t dmaphyssrc1 = 0;2 Y1 M/ O4 P$ u. _2 ^2 V) B
- dma_addr_t dmaphyssrc2 = 0;
# R( _7 f7 A0 y& ^3 H, e - dma_addr_t dmaphysdest1 = 0;, c9 l% d+ Q5 K& a' h8 N" d
- dma_addr_t dmaphysdest2 = 0; a3 V/ L& h" [/ ^; R
- - c& n1 [* s4 Y. L% j! c8 V9 B" o: h
- char *dmabufsrc1 = NULL;
- m9 W; E" t: I% {! K- z, l - char *dmabufsrc2 = NULL;
: e; b' z- u$ ?/ A, e - char *dmabufdest1 = NULL;
: W8 J! |4 A5 a" K4 L s - char *dmabufdest2 = NULL;$ ~- ] p1 O& q7 U1 B4 @; Z* G6 p
% U: S$ x& B1 T# R5 ]5 g- static int acnt = 512;" X e+ u( r* W4 h O: f7 b
- static int bcnt = 8;7 I- Y& G- |! Y; N$ k; F
- static int ccnt = 8;5 @' V7 K& ?* k) ~' y, V( `& U: @$ _
/ G# s, U k, e- module_param(acnt, int, S_IRUGO);
5 v/ U; G) z2 n0 x- r9 u o. I - module_param(bcnt, int, S_IRUGO);
# X I$ p5 ]" m! p9 Z - module_param(ccnt, int, S_IRUGO);
复制代码
& q$ K2 E- p7 I2 C* ^2 e$ J( }/ @( ?+ u* H4 o4 e7 W* H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 F1 s8 O: r& b. C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 s6 x5 j, K" C( d4 W8 I0 t& Y; h8 X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 s2 k9 d7 ~% s/ I8 ^$ x x5 F2 m* D/ B: J
, [, n9 l* R( Y0 |8 {5 ?7 K
|
|