|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: q, u( {$ z" O' V- [code]EDMA sample test application( |" Q: \7 F& u( {: o8 t7 \
- /*
/ C3 ?+ G& z9 A! P' W+ T; X - * edma_test.c
# P: J$ { C. m8 L" d - *
% ~/ P/ Y6 c* U3 n% M% v - * brief EDMA3 Test Application
( c8 J; ~" g7 z% N1 M# o- P/ y - *+ ]; l' e7 R5 k/ o
- * This file contains EDMA3 Test code.( Q& [3 s7 R6 B8 w
- *5 A j( i B: m, {+ C( S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 X) s1 T: h J: w7 U: \( Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; q. `7 ?1 v2 T: z% `* i - * TO CHANGE.
# p" [8 c! I7 C - *& M. j% Y# l* h0 \) s. t% @# c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 P! E! Y4 C, c - *
5 H+ T$ R3 K) P( R! j, q; W - * This program is free software; you can redistribute it and/or
2 |( [# M0 I& R8 X I2 g - * modify it under the terms of the GNU General Public License as
) g8 @+ e+ M# D: [" s) _6 F/ ? - * published by the Free Software Foundation version 2.% ?" q4 g/ Z( {# {6 N. w2 t
- *7 _3 x4 g$ D1 W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 ?7 s, s* J, u8 j, k* o8 r4 j* e - * kind, whether express or implied; without even the implied warranty
& a/ m) {) F1 r" I) A( N" C9 r5 U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 S/ S4 }# _6 P9 s. b
- * GNU General Public License for more details.
) U7 l: U; x0 P - */
/ t1 ~8 v3 p0 N0 D
6 m; f" J; g' F, I$ c- #include <linux/module.h>
( \3 k$ z7 i) n: J$ ?/ H& M r - #include <linux/init.h>5 B' r% Q- _7 t3 L. ^: G$ |# T
- #include <linux/errno.h>; ]& t/ ^, V4 |) f1 w @ A8 `
- #include <linux/types.h>
1 ~9 {( c @- ~/ c& s) J) R - #include <linux/interrupt.h>
4 s) u+ G# M$ O. b% P2 { - #include <asm/io.h>. k' m2 x% ?, l
- #include <linux/moduleparam.h>1 @5 I& i. |4 j( v
- #include <linux/sysctl.h>
7 y4 s- p8 R* U4 t - #include <linux/mm.h>
- p9 N! i9 T) C/ s( F' [- h& t - #include <linux/dma-mapping.h>
* ~$ x+ H$ z5 Q4 F, O - 5 W) M' v) I& I: {7 n* a) ?& x
- #include <mach/memory.h>! _: c( M! ?" o6 @, B; `
- #include <mach/hardware.h>; |; u" I, o0 r T- w$ A
- #include <mach/irqs.h>! ]0 g3 p: e/ R2 h9 f4 ]1 F+ ?! r5 R
- #include <asm/hardware/edma.h>' M0 [" O+ V. F; R! ~# D' V
- . C$ q/ Q- d9 D7 v/ c$ m
- #undef EDMA3_DEBUG$ b7 \& v& p! u+ ?# u0 D/ `+ a
- /*#define EDMA3_DEBUG*/
; s3 M9 ^9 b1 Y2 h j - # x5 V7 B& b% M* H
- #ifdef EDMA3_DEBUG+ s& C- b6 {- {, E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ ^* z; o0 }, ?2 q" M# F: F5 ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% h; J( `7 U r; P7 E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" Z4 Z8 j+ l4 [( R @8 p - #else4 b7 Y y" C+ Q! n
- #define DMA_PRINTK( x... )
) ]0 y9 V* n( A2 {6 C% e - #define DMA_FN_IN
8 T& y2 f( H& G4 ]' A - #define DMA_FN_OUT
/ `( o% P/ }! ~; l$ f& {$ e/ X, d - #endif5 r( P+ b3 P) a8 x* F
- L/ D8 F, `( c+ d, S2 x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! j4 O; L' ~! x6 D. c K5 Q - #define STATIC_SHIFT 3: ? G0 `: J4 j1 H7 O& k$ U
- #define TCINTEN_SHIFT 20
! h& F1 K: e- z9 P% v) I - #define ITCINTEN_SHIFT 216 p9 C. I& S8 P$ b" S( L% W
- #define TCCHEN_SHIFT 22, e# B% \: g9 I! K3 O
- #define ITCCHEN_SHIFT 23
' d. s. Q% B5 D% Q* i - ; m4 [2 l; U; g+ m1 N) d
- static volatile int irqraised1 = 0;3 A. y# O3 X: R, k' J) e
- static volatile int irqraised2 = 0;8 _3 j- b/ s3 r+ _$ j# \" m+ ]" n/ r
, @, y$ P. q/ p+ O. s' w; F' ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ j& d7 P$ k# \9 f- Y5 O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& o& j; u2 t8 O# s! V( R( N4 d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' ]0 D! o: b5 n7 u2 k5 t
- ' {) g/ d9 R, N( h- [0 T. o/ o
- dma_addr_t dmaphyssrc1 = 0;- S; X% y3 `/ r3 p e( i
- dma_addr_t dmaphyssrc2 = 0;
7 T3 N3 |0 V) _3 h9 i! F0 R6 S P - dma_addr_t dmaphysdest1 = 0;
# B0 `2 U* n- Q8 o* H# ] - dma_addr_t dmaphysdest2 = 0;
, R: n9 ] |/ w( `2 ?5 [* a2 n% S
% e& G; c+ U9 `, A- char *dmabufsrc1 = NULL;5 n. {/ e! Q3 z. _, |4 w. O
- char *dmabufsrc2 = NULL;
" j* a& a5 S. Z/ T; R0 ~ - char *dmabufdest1 = NULL;
5 Z* E# q: Z! X" i - char *dmabufdest2 = NULL;
& H* x5 g, i' K! u9 j |7 D - / U$ x4 Q3 e. ?, N/ C* d
- static int acnt = 512;7 y) v0 \& t7 c ~
- static int bcnt = 8;
. u& R# h7 i% p/ T, T( |0 Z - static int ccnt = 8;* R0 r0 j2 i, i; j1 }4 [' q
$ M: G2 t: Z/ Q& k: ^2 k a# k, O- module_param(acnt, int, S_IRUGO);
+ x2 B7 c/ v/ d* U3 M - module_param(bcnt, int, S_IRUGO);
/ ~ Z+ n7 O0 T& ]$ n4 D; U1 w* U - module_param(ccnt, int, S_IRUGO);
复制代码 % Y7 H0 |7 \4 L& g
5 O# w, E7 `; j0 M" ~+ D! ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ A! {' E8 D9 H' }
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 p" J- t/ ?2 x2 Q2 h; z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 ]' N; Y- a: C+ Y: i9 ]
c+ F9 X F x2 J. U
+ c. o: c% e' V5 v8 Z b1 u
|
|