|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ }4 ?: B! G7 ]' @- [code]EDMA sample test application, V" ?- {) k+ Z
- /*/ t1 |# P2 S& _
- * edma_test.c
C7 v3 d* y. l1 n% @. a2 \& ^& { - *
& l0 c' C- B- r. S% Y8 j# i - * brief EDMA3 Test Application
0 i( H9 p9 M1 g - *; u; n! R3 r- m6 b6 l& [2 p
- * This file contains EDMA3 Test code.7 c9 x: [+ H1 r5 F1 p- \
- *
, y! `3 ~4 b) @/ v8 `# Q% d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ z' m4 @. ^ `2 C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" M2 Y9 ^: D: d+ _) Q* z6 J - * TO CHANGE.
+ A# ?- y Y0 g; l/ \9 a - *' E6 _8 {' t4 P% R ~. ^ D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# c m$ ?3 y. M- L8 K - *
" C" T# i9 x" ^4 \. g- W - * This program is free software; you can redistribute it and/or; _8 @! e4 H' }# r6 m5 Q6 c$ o+ c
- * modify it under the terms of the GNU General Public License as
0 b1 j! X) a4 c8 l8 r4 p - * published by the Free Software Foundation version 2.8 Y5 L( s" k: E1 S+ B
- *0 t" n: \/ `. \* R' k# q O( u4 l, I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# R+ p: x- [" f) \( [5 n" C
- * kind, whether express or implied; without even the implied warranty6 [# n9 {4 m# M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, q( X- U6 h+ O! W- M {
- * GNU General Public License for more details.. |7 {) v0 B# z0 R; E5 ?
- */
8 w/ h9 q% {. ~8 G# k9 J - 0 r/ k: w I5 r% q. }
- #include <linux/module.h>$ @8 T' I/ t0 |( s2 z& _
- #include <linux/init.h>
; G- b2 Z4 ~/ F - #include <linux/errno.h>
* `4 B, p/ d U - #include <linux/types.h>
/ V+ L5 v& G) c - #include <linux/interrupt.h>. i2 }! B& ]/ b, t+ c o
- #include <asm/io.h>
1 a! j( F8 \+ G8 \$ q# m - #include <linux/moduleparam.h>
/ @ ]$ ]. t# p* T9 a9 l - #include <linux/sysctl.h>4 p4 u# s1 e* {0 o, P k/ @. y
- #include <linux/mm.h>
4 Y0 D! S( o8 Y5 t/ E& Y/ T - #include <linux/dma-mapping.h>
# e6 w" a, W% s. {+ q8 l
: h+ ?* y& ^8 z/ b' e- #include <mach/memory.h>
+ m) ^& f9 ~' K) x# B8 J - #include <mach/hardware.h>3 B8 E0 @4 Y$ k) R3 i: M. Y% ] N
- #include <mach/irqs.h>
7 _0 V7 ]# l1 r$ T M' Y( u - #include <asm/hardware/edma.h>$ [7 c+ d3 C7 c' u
* ]8 S) }& q; C$ p% q" ?1 y- #undef EDMA3_DEBUG8 M9 g; N9 R, v8 h
- /*#define EDMA3_DEBUG*/
3 a6 H( a) d* j4 \ - ; l2 S# @" ?* a8 \0 h
- #ifdef EDMA3_DEBUG8 b. `' J6 ~* R: l' y4 h* n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- P/ B' d* P- M" `' W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! x1 g0 ]: f' O( E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 I. F+ U {) F# G - #else$ W; t' D; i5 C0 B. Z9 k
- #define DMA_PRINTK( x... )/ P; k v1 W y
- #define DMA_FN_IN
8 C( R) ]) E& T - #define DMA_FN_OUT s9 o- g( s u1 W \- M
- #endif
( }; q% }! `9 W* F2 X$ ~
) A" e6 y9 I& {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- K4 {! `, N* B/ m! \2 `+ h' x - #define STATIC_SHIFT 3. N7 M/ a7 V) m* L2 y2 Z9 z2 o
- #define TCINTEN_SHIFT 20
6 {- f0 @( q# ? - #define ITCINTEN_SHIFT 21
9 X% o+ K" J: V. Q4 t - #define TCCHEN_SHIFT 22
7 B/ I+ S& G: T$ A - #define ITCCHEN_SHIFT 23) h9 [7 v9 C' M3 c
- : L5 V9 I/ n" X" l; ]7 E7 E
- static volatile int irqraised1 = 0;
8 Z7 O# K! o4 ^9 i* F1 \ - static volatile int irqraised2 = 0;
' Q/ G* e5 f: T' m - / n7 @( y8 N. z5 }5 R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ~0 n; p- ]: M* a7 o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! p5 ^/ b" [7 S) z- W: Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ~! Y+ R& n- B1 q: w
- 5 _; S3 p1 e* L* z$ y
- dma_addr_t dmaphyssrc1 = 0;( e: U+ P$ [8 ^; B, f2 U) C
- dma_addr_t dmaphyssrc2 = 0;* I. N$ C9 i# W4 [/ ^1 s8 t
- dma_addr_t dmaphysdest1 = 0;
: {' t4 }0 m$ z! M. J - dma_addr_t dmaphysdest2 = 0;# \0 `2 S2 l3 |1 ~
- ( c$ x: _0 V4 l9 P" z
- char *dmabufsrc1 = NULL; E2 ^% v* M4 }+ {& E! O* _
- char *dmabufsrc2 = NULL;1 v ~( c# e' z5 U! [/ u
- char *dmabufdest1 = NULL;' T3 {' j) {4 N7 a- N
- char *dmabufdest2 = NULL;+ ]2 R9 u; C( I% o# g2 F
) Z$ Z$ o4 v/ O" f3 h/ K- static int acnt = 512;
h* e, ~' `1 |, q; Q# k6 p - static int bcnt = 8;: C* l2 }* y0 Q* O
- static int ccnt = 8;
, J! f4 z9 O% K) j; r' E. b - 8 T6 ~5 r1 [# f+ M; P* V
- module_param(acnt, int, S_IRUGO);
9 \" _7 Y( e0 _# y$ m - module_param(bcnt, int, S_IRUGO);
! |5 F" q! X8 L6 M& y - module_param(ccnt, int, S_IRUGO);
复制代码
9 V: s# `3 V- A- g7 z" F- v1 `0 }8 t0 G" ]6 Q) J0 r- e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) z5 y" d) l Y: D1 v) f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 C, `) E) b/ d, ]' A% d5 W/ p/ e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 z: Q8 y( c' Y, o5 V: c" I
9 n8 E. D9 V3 P+ A( `/ {
; y6 \! f) e6 F& J8 o) z" g) f$ m. g
|
|