|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : n" d% q2 b5 k0 A( A
- [code]EDMA sample test application! u2 b6 o/ I+ m; M
- /*6 n8 N0 a9 R; l O" a* P# \- I3 K
- * edma_test.c: U8 R3 d1 T4 {' S; P' N4 O
- *
, t% M9 T( C, t5 {9 _9 H; u - * brief EDMA3 Test Application0 _, z3 A6 z9 b$ g* w: h
- *( d* }& B" \! D$ q! }: X: _) w
- * This file contains EDMA3 Test code.
7 k& P8 N! l; z+ n2 Z - *
3 c" ] N, a; r+ A& K) \' W" Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 k$ Q1 N% [ L& x% w3 ^0 o. l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: t" t8 t' q: ^% W. L% V7 g# U
- * TO CHANGE.
# F. w! ^; `7 [; O/ S* [4 U - *
3 \/ s8 k! B3 a7 } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. n) V" f) t; j6 b9 C1 F - */ R5 H; b/ d" l7 o
- * This program is free software; you can redistribute it and/or% p, [7 U) }& ?5 s
- * modify it under the terms of the GNU General Public License as* T% u# p1 a6 r5 z
- * published by the Free Software Foundation version 2.$ G% _* w4 M* h$ v' y0 `
- *
) v( C$ x6 N* E: ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& _ [; {: i' f - * kind, whether express or implied; without even the implied warranty* H) k; b% ?8 e, g/ X2 ]+ D; F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 I- a; D8 F6 w' ]8 ~8 J. k2 n
- * GNU General Public License for more details.
1 k$ {( S+ s; l7 W% u% X0 L5 j1 G' I - */
5 I5 Z* B+ }; I% U - : e* d+ a4 O) p6 |2 d" J+ y1 f
- #include <linux/module.h>" ]0 g% l0 ?/ D+ e" H2 m3 n3 ?$ s
- #include <linux/init.h>
# h% R. k$ j+ k0 P: u - #include <linux/errno.h># V' g8 w+ O; g4 m! C' _
- #include <linux/types.h>
# ^( U* p( n% m0 Q; M7 F - #include <linux/interrupt.h>
2 L# r1 D, k% \ - #include <asm/io.h>& o; |8 r& u- P# e0 m, n
- #include <linux/moduleparam.h>) v% J- i3 T9 s& B6 _( K3 c- F
- #include <linux/sysctl.h>1 N% \' }3 g- c8 y1 G
- #include <linux/mm.h>
' ?/ n3 t2 P, h/ r, ~ - #include <linux/dma-mapping.h>
9 K- y6 R$ P* s( t
. ]6 }* v# ]; S: b! O: X- #include <mach/memory.h>
i& h6 _% d4 Z# d; x - #include <mach/hardware.h>) o$ Q* q# S( B- }
- #include <mach/irqs.h>
; `( r( B$ a$ U. D0 F2 T - #include <asm/hardware/edma.h>
T1 O$ |6 u+ R+ M) k9 S# _ - * y1 a3 y4 W+ }! L. D
- #undef EDMA3_DEBUG
5 V1 s. c5 L4 Q6 E+ Y$ R/ c - /*#define EDMA3_DEBUG*/
6 q" M3 h( h8 p U3 o& p - $ i; W. A' l4 W2 ~% F& _8 r* g: g
- #ifdef EDMA3_DEBUG" z* T& q3 f V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 b+ x7 N8 k6 `# P( ~' e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ c4 P9 }5 N% D# ?( d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ |7 x6 n" h7 e8 i& [* G1 h4 w9 } - #else
' m6 w( p. F3 ]0 I$ ^- S: X2 g - #define DMA_PRINTK( x... )9 k* b- _" y2 g6 u
- #define DMA_FN_IN
) r: P7 y. ]7 ~7 M- Z; O - #define DMA_FN_OUT
v. Q0 u! E- o, x: g - #endif
; ?2 l: f1 D: r! d, I - / W3 M9 ^* ?; f5 @7 A% o1 J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ U. J. o# k/ K9 l5 c
- #define STATIC_SHIFT 3
/ e/ X F: ]2 L* v4 S' B, T) b - #define TCINTEN_SHIFT 20
, Q Q+ s' I* G. X5 \ - #define ITCINTEN_SHIFT 21. v- \' M& P3 U g& i: n* V, t
- #define TCCHEN_SHIFT 22
$ _6 k& d8 R. v! k - #define ITCCHEN_SHIFT 23
6 j7 u2 R, I) u8 G" m+ n$ Z
: h5 W3 h# i. J# n$ w8 p- static volatile int irqraised1 = 0;2 L: y2 W/ g: E# {
- static volatile int irqraised2 = 0;
3 O8 }, h) Z: s# I - ' u+ D' t( W. ~ B3 l( K* L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 _; z6 t5 L; w! X/ A4 I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& o- _- k+ j0 s; Q6 o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ]. n1 S7 O2 i
9 k+ W6 r$ k9 B3 g( x- dma_addr_t dmaphyssrc1 = 0;& s& ?0 e# a" n( \
- dma_addr_t dmaphyssrc2 = 0;
; r* i4 \5 y8 ]6 e w7 W% g - dma_addr_t dmaphysdest1 = 0;, f8 W3 y5 C% B7 f$ f
- dma_addr_t dmaphysdest2 = 0;- t; O% l; Q1 k" z9 e
$ w' g) m V4 _( K- char *dmabufsrc1 = NULL;
# C1 t5 l! _6 D5 z0 ^" J; q+ ?2 { - char *dmabufsrc2 = NULL;6 O2 b: O' a$ H D
- char *dmabufdest1 = NULL;
; N, Q1 Z2 X/ F& x" ?, o - char *dmabufdest2 = NULL;
3 W% m2 |: W+ J/ J8 p* K" y+ B
- Q6 L$ ?, V! _& g- static int acnt = 512;7 L; M1 x, \, L5 W. B! l. ^$ ^
- static int bcnt = 8;! E. Y# c+ [+ ~; ^: o7 t
- static int ccnt = 8;- Z' a+ `- u- H5 c
% l2 U) j* k, t# z6 L3 a: W! H! u% `& ~- module_param(acnt, int, S_IRUGO);
9 S' T+ x3 ^) j7 |3 m! n4 a6 B - module_param(bcnt, int, S_IRUGO);, m$ C4 C* X* b6 D
- module_param(ccnt, int, S_IRUGO);
复制代码
# {& f- t" d/ ?) u. Z' [' U6 d) w
" o6 w% p3 i! \! V# Q a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, H& F. d# E& A4 `9 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! D$ E' H% m4 ]9 `1 s$ ^5 P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 c: r# J* q% x* L/ l6 T" P* @& z, ^& [" ^
% F& v; j+ S f2 Q |
|