|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . H: t k: Y5 a5 t- z
- [code]EDMA sample test application$ @8 Y3 Z3 e4 V3 R. s6 Y8 B7 k0 C) n& c' R
- /*5 T( {& [" E3 m
- * edma_test.c' Z, c# F. Y& {0 g" b7 D" Y! X* f+ B
- *9 M) w+ F, z. K1 r1 r5 |
- * brief EDMA3 Test Application
- Y9 o+ r8 s) \6 Z - *8 c- @3 O1 }& X8 L6 t
- * This file contains EDMA3 Test code.
) f* X- b' t% M( P: J5 X - *" d( t4 v5 `( J" v; p1 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* d! G( z7 \3 T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 ^, n/ G h: J+ \ - * TO CHANGE.* c' a! ^3 M# S5 ]) v
- *
8 M8 k% }5 i- t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; W9 N2 V* r* r# @# t# v
- */ b V- _! n# M6 M
- * This program is free software; you can redistribute it and/or
; E* \+ T# G! q1 R - * modify it under the terms of the GNU General Public License as, A! v, f7 g/ o& i; n! {5 b# J& _
- * published by the Free Software Foundation version 2.
/ f+ j; k5 d' Z" q, Y7 Q: E( ?$ u - *. f/ P, L3 z0 s6 n/ i- ^9 u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& D2 r% g5 Z$ B0 D; e$ a; Y( z
- * kind, whether express or implied; without even the implied warranty
+ x$ H x' n8 O7 w N% x+ Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ J+ V/ L* i c W" ^4 x - * GNU General Public License for more details.4 i, ^% O& S( {; s3 y: q
- */
: }9 j0 Z0 N$ k `& J% ^: }
" }* w" W7 G. E- q! g/ P- #include <linux/module.h>; `6 u% Z7 ~$ m( d! R
- #include <linux/init.h>. q+ F( L9 q; E- o
- #include <linux/errno.h>
% A( y& j2 V/ Q- P6 x$ D. N/ z* y: y - #include <linux/types.h>. b! x6 E" N8 f+ `% D5 R( s
- #include <linux/interrupt.h>3 G5 v) G; m6 U2 m# |8 E7 |
- #include <asm/io.h>
5 d* H" y- u7 j' J) l - #include <linux/moduleparam.h>* c7 Q6 y: G5 g- h
- #include <linux/sysctl.h>- V, ]" A9 [* Q: r' w
- #include <linux/mm.h>
# H* R6 k% ]7 C, X6 ^ - #include <linux/dma-mapping.h># Y4 N5 z9 s2 z
4 v5 R8 |/ E- N2 q- #include <mach/memory.h> u3 F8 R, {6 X
- #include <mach/hardware.h> {7 L* J- P$ B1 O$ A+ y! w- s U' S
- #include <mach/irqs.h>( j, E9 ?3 W) }' R6 ^! @
- #include <asm/hardware/edma.h>
- i+ v6 Z" M# T1 [, {" Z' o
$ @* I* B) f+ C6 a5 `- #undef EDMA3_DEBUG, S: U9 x0 t/ K; L/ L1 }8 e
- /*#define EDMA3_DEBUG*/
3 h5 H0 Z9 g( ^% K - ( f2 K$ B7 s5 [$ O
- #ifdef EDMA3_DEBUG
2 g& _" z: d; G: z8 z8 p9 z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' F* s1 [ ], i0 O7 j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" [" q* d5 ]1 N% }3 i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 J2 ~8 ]7 F5 J" y
- #else; G& [ \8 T, o! E( N. Z# P
- #define DMA_PRINTK( x... )
4 m" R% H, t# t" P - #define DMA_FN_IN- R& [ X0 T/ y4 K; o5 Y
- #define DMA_FN_OUT( e6 ~7 r( J2 j- u `/ u
- #endif
% X- n0 N& L+ \2 X/ t - ( `* `! t' r' t0 c0 i2 [& h; X6 c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; }% h8 z; Q7 \& s6 e; P4 L - #define STATIC_SHIFT 3% q8 P% i3 i# x
- #define TCINTEN_SHIFT 20
0 @/ J! M% g8 B j" g9 O - #define ITCINTEN_SHIFT 21$ m8 x9 @+ ?0 B1 f
- #define TCCHEN_SHIFT 22
* P. b1 A, z. i4 T7 z0 A - #define ITCCHEN_SHIFT 23
/ Z, ^: d# B! {6 t2 d/ }1 z6 v3 B$ U; [2 i
- i# J% v, E7 J5 b3 T! @7 K- static volatile int irqraised1 = 0;
2 X: z7 J. w( \3 `+ I' l - static volatile int irqraised2 = 0;
: J2 G; h2 m0 i6 y$ ]. A
) x7 C' ^; ]3 I1 L, }( I# q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
R+ f! A6 [# D; v2 G$ L/ r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" H- j1 ]# i+ S, r x; P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 `" @4 p7 h* U" V1 X7 D5 X j! m - - P+ T$ o3 f* ~: H' u! D% L J
- dma_addr_t dmaphyssrc1 = 0;, c% q4 u4 x; U0 P5 o# ^
- dma_addr_t dmaphyssrc2 = 0;5 J4 I7 w' W! N+ P
- dma_addr_t dmaphysdest1 = 0;
7 j/ k, S, U3 `) q. J7 _4 y) _ - dma_addr_t dmaphysdest2 = 0;; L' P: t( \; R. h: W+ L
- + {9 c W) f) r v8 X, m
- char *dmabufsrc1 = NULL;
- f" d, U6 R. n) _& w2 V - char *dmabufsrc2 = NULL;6 Y' D M" n: w N2 z" _8 E
- char *dmabufdest1 = NULL;
& _0 c0 o2 `. A( M! P# s) T - char *dmabufdest2 = NULL;
4 E$ T, F) i f/ S0 |: D2 r# l - 1 V2 F# G F+ m# T. H+ F
- static int acnt = 512;8 q; y9 i p5 L0 @
- static int bcnt = 8;
" R. [1 j6 _, I- k - static int ccnt = 8;
% ?2 N/ L! A7 i0 E - ' M9 Z' O0 `7 ]
- module_param(acnt, int, S_IRUGO);
7 D/ o1 i0 U9 V7 U3 D* g& ]! j - module_param(bcnt, int, S_IRUGO);, Y0 y8 c) |# V$ P
- module_param(ccnt, int, S_IRUGO);
复制代码
" v1 C3 E; u# C2 d) n/ f
" F7 @( D2 l9 E5 t5 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ P! y* |0 p u% J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& J0 L! f7 f; t, e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. V( i& L2 I- ]( l. I) s! e j% F) a9 N, F+ K
3 m& t! L% R2 H+ ~, A
|
|