|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" G' M1 Z1 e# }: X* E& M) r- [code]EDMA sample test application! t1 `1 A* q. I; H" i9 R
- /*+ U# W: {& E7 e2 I! G6 ~
- * edma_test.c
4 h) L! m' T \4 w: ` - *8 P) Z' Y: b/ C
- * brief EDMA3 Test Application1 A. Q- _% v% ]- { l* |2 {& L
- *
4 p0 s, b8 e. D) Y - * This file contains EDMA3 Test code.7 q7 |4 _: O2 w
- *
9 [7 ?- K1 d+ W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( E* P8 g# D" e# f* u" I2 G E, ]" X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, q7 m; T, G& `, m - * TO CHANGE.
+ d p' L1 k7 c4 ?& O - *4 t. |3 L8 _$ W! ^- {3 {8 ]5 c2 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 u5 b$ C& l/ r( L8 |. n' t
- *4 ]+ \( N! o9 P& L
- * This program is free software; you can redistribute it and/or
8 E7 D1 p* u1 r: x+ p8 X7 ^ - * modify it under the terms of the GNU General Public License as
( v7 N: v% I2 H+ y - * published by the Free Software Foundation version 2.
) k) @( N2 f3 v- T0 W5 q5 s; M - *
8 U4 ]2 _* Z9 ^, D& j1 q: T$ C7 L- q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 G/ ]* @' j& Z; m8 T - * kind, whether express or implied; without even the implied warranty4 L7 {; n6 Y. {( c& r+ r0 X* H9 @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 f+ @$ t( O7 o - * GNU General Public License for more details.
4 p! i8 W+ |0 ]& T! d3 P- q" }' ] - */3 h0 u2 I8 P$ F; F% C: j
" b/ D" _: f- ?- #include <linux/module.h>
( I b+ ?# G& J2 A% ] _ - #include <linux/init.h>
, p' |1 `+ W- \) w% m' _" Y - #include <linux/errno.h>. K- G0 `# P. n% I5 H# ~) C% p) q
- #include <linux/types.h>5 ~& p: N8 D7 D/ b# N" K
- #include <linux/interrupt.h>( }8 {# _. D' D6 s
- #include <asm/io.h>
, }2 [% h7 F) t8 R% w - #include <linux/moduleparam.h>
. s+ d [; U+ t5 G/ \4 ~% t - #include <linux/sysctl.h>& K6 M: ]: q3 p8 w0 F, L5 E4 r9 i6 J
- #include <linux/mm.h>2 D b/ Z3 I3 C1 G2 i7 |$ P! W
- #include <linux/dma-mapping.h>
$ x" Q5 x% _' C' r W' r6 q7 q4 Q0 w9 W - % G, m7 R& q0 I4 J( e( k
- #include <mach/memory.h>! G q1 D* d4 o! K6 _
- #include <mach/hardware.h> w+ T6 I$ ~2 t; V: x d- o
- #include <mach/irqs.h>) U7 a- t1 g5 E$ h3 p
- #include <asm/hardware/edma.h>
4 N2 Y! V; e0 m9 U& v! w
0 ^3 L# ]' ], d" R- #undef EDMA3_DEBUG
* j! X. B8 e- Y+ h# R O - /*#define EDMA3_DEBUG*/
4 ]9 ~ t& p" |7 F( G - " x+ @' ?* B: G" t8 ~& [* h
- #ifdef EDMA3_DEBUG
7 \% I: {2 Q6 }; b# Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 b N& ?9 J C/ n _5 L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& }/ x& p) @3 p, D) l: b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! J9 y8 t2 f7 s' R* B - #else( @ W5 j3 n7 k" C7 K% R$ O. w
- #define DMA_PRINTK( x... )
: O+ X1 w5 d" _' g - #define DMA_FN_IN, c! l9 R2 C: W j. P4 P8 t
- #define DMA_FN_OUT1 _; v; [/ x, u" h( m. v/ i
- #endif; j4 L+ z$ E9 ^9 r+ H8 _ }5 z
4 Z9 s2 |6 v0 @; M' o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ o5 k6 T. u& Q' Z
- #define STATIC_SHIFT 3
9 P+ C2 l( r) G: |3 b4 g6 C& M+ r - #define TCINTEN_SHIFT 20) R( `% R, t6 M Z
- #define ITCINTEN_SHIFT 21
; r9 i q5 y5 B+ D3 I; N' c8 _/ U/ F2 I - #define TCCHEN_SHIFT 22
6 n( ?! d1 n0 s1 u$ Y$ N. f5 h - #define ITCCHEN_SHIFT 230 r3 p5 b1 C# m* {3 ^8 m5 }
- 5 i/ j6 U5 {( R: L
- static volatile int irqraised1 = 0;4 |2 J) s9 o2 J) T3 b+ L$ a2 D
- static volatile int irqraised2 = 0;
) L+ G- X' t+ e, G7 l
, R/ i1 b" s& B+ l3 [! C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ W9 F; I* w/ m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 ]* R% i1 H/ t8 c7 ]& m& Y. y; T2 K& ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' c) \+ Y- G/ a6 P6 D! e6 K8 `
- 2 K$ T: P+ B! M4 x% `
- dma_addr_t dmaphyssrc1 = 0;
- o5 A1 z: J2 A& ~: J - dma_addr_t dmaphyssrc2 = 0;
8 \) N! N$ }. t% [& z" g - dma_addr_t dmaphysdest1 = 0;
4 i0 S& i: H n - dma_addr_t dmaphysdest2 = 0;
0 H/ P b- U& N# q! R
/ a( Z5 t" F$ j* j: _- char *dmabufsrc1 = NULL;
, K$ }+ p! }& ^& e4 ] - char *dmabufsrc2 = NULL;) l7 C2 L" I7 t1 t: W
- char *dmabufdest1 = NULL;4 X' D. k, n3 k! b7 `" b
- char *dmabufdest2 = NULL;
7 b2 S+ {3 O) R$ _3 K4 S
% ]. S0 R) C: P( e i- static int acnt = 512;
( Y4 v. [; P: Z+ m$ ` - static int bcnt = 8;
' u# Y0 F' q1 o) a) M7 ]" u - static int ccnt = 8;/ p9 C# J% ]" \
- - k) V# X6 s2 ]+ M5 U4 k/ G) H- ^
- module_param(acnt, int, S_IRUGO);6 |7 w) q, K5 |) P, Q# L
- module_param(bcnt, int, S_IRUGO);, ]) i7 k) T. @
- module_param(ccnt, int, S_IRUGO);
复制代码
; }/ r; ^+ e2 M' V- R' U4 t: n# q" k9 r* V! r' \- p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ V9 f, D; P5 jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- r5 l3 s1 k0 ^+ n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 m7 q, E( u3 M. X
; H& z: v1 y7 ?1 _& }+ i( r: l7 v
|
|