|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 ~* `$ `% [- G+ z) W G' o1 N( L
- [code]EDMA sample test application
4 H% m6 k6 u, i% E+ L& R7 w0 ?* { - /*( N8 U6 {. ^9 ?. W- u
- * edma_test.c& |- g3 t: `$ b- F7 r: P3 v
- *1 k1 w, k' }8 Y! B
- * brief EDMA3 Test Application
/ v8 |- T# B, Z( f - *
7 ^- r8 o" Y) H4 ~( O - * This file contains EDMA3 Test code.
b( J1 j, ~0 f) E. q* T - *" o. C C+ d( W" A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 o( x" D" O* q+ y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( n6 v4 f5 t, q6 G - * TO CHANGE.
6 [% ^# O4 Y9 b. E8 N; f$ i6 w+ o - *$ P% W) e9 m8 k3 Z& Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' c6 i3 C- w$ z5 X& d
- *
! T4 p, p* ^2 N2 w- z7 m7 l5 M9 N - * This program is free software; you can redistribute it and/or
; I1 _) m' Q8 v5 e- ` - * modify it under the terms of the GNU General Public License as
( {2 V6 `0 ^0 ^( B+ k2 ? - * published by the Free Software Foundation version 2.
" O$ l6 E% y0 c1 A! F' n% X6 h0 B - * s. ]5 U, v5 g2 v/ r( I( r% Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( i- v. d' I$ y* {
- * kind, whether express or implied; without even the implied warranty4 I h( J6 Y4 A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 V7 ^+ Y s$ ^. Z! @/ g1 x
- * GNU General Public License for more details.3 z& x; N4 f/ s! S: `, W
- */
, F1 Z# D# @- K0 |$ D" h
+ u) C- g( ^# J. S: j- #include <linux/module.h>, h, d( g7 _$ w% M
- #include <linux/init.h>
/ {. o* U+ M/ p( e( C - #include <linux/errno.h>
K1 Y8 p- Z% D4 L5 D5 u: L9 b! c - #include <linux/types.h>
- I, [; } I1 s& p# j7 e& t" \ - #include <linux/interrupt.h>
1 w6 F3 g( z2 y. N7 | - #include <asm/io.h>' s+ O9 E# h, x; K& e: G
- #include <linux/moduleparam.h>
, i- }. a# Y z- M' Z - #include <linux/sysctl.h>
5 C7 _' g: Y7 j( W) K/ _6 T - #include <linux/mm.h> F2 d: z6 T2 V4 ]3 C- Y8 F
- #include <linux/dma-mapping.h>
( R* ]1 ~ R* h+ Z9 R! v; ~! q- {' z - $ g# r! Q/ \( y( \2 h
- #include <mach/memory.h>+ }8 R E* a1 W6 S% w M) y
- #include <mach/hardware.h>! S7 s) F# a$ X- q6 D% m
- #include <mach/irqs.h>' @. W" ?# U2 a0 k+ ?- E
- #include <asm/hardware/edma.h>
3 x1 `% H, o" V - * Q. N9 K8 _0 d+ Q& t
- #undef EDMA3_DEBUG. g: w6 B) [& ]$ }/ H4 h: |1 Q+ A
- /*#define EDMA3_DEBUG*/3 y3 A# N" ^2 t4 b
1 m5 Q1 ]+ ?. m7 S- T6 G- #ifdef EDMA3_DEBUG8 q/ R# p% q1 p" V9 U/ h( z7 R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ ^3 \; R6 q; U, P9 V& i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) X9 I) }) z0 O/ Q1 n# s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ j. [% Z5 a6 x6 w' |
- #else
3 F& R& W6 ~1 S6 q - #define DMA_PRINTK( x... )
( z' c( ~- C5 N - #define DMA_FN_IN5 v. \! O( n: L
- #define DMA_FN_OUT5 e$ |$ C% o, F2 c! ]
- #endif
) I* X3 A$ ?$ g/ J# U/ C
* ]& S4 u2 @$ d3 T6 e. p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 u) n' y' h# j X3 Z
- #define STATIC_SHIFT 3# |( Y" x- E# f8 G: p6 T( J
- #define TCINTEN_SHIFT 20, m7 w+ |/ E$ A
- #define ITCINTEN_SHIFT 213 E1 [8 S& x Z e
- #define TCCHEN_SHIFT 22 N8 `) ^& h, w3 o, f
- #define ITCCHEN_SHIFT 239 C) f5 ^, X" S {7 C2 n" U) j3 L
1 t% M7 h, a. J$ V! z' }: ~! w- static volatile int irqraised1 = 0;
, k6 x/ n2 F2 X! Q - static volatile int irqraised2 = 0;
7 O R) c* y+ F0 I; p
" D8 Y' R1 y: Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" J+ |# N# k( P1 k. n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. _8 c8 H/ W! S% n( B4 e* v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 ?. I' ]( Q3 \7 p5 ^* ?" x0 I0 l# C - & S- N$ o* C- [& r- o+ V
- dma_addr_t dmaphyssrc1 = 0;$ B9 \/ h+ H' X, `
- dma_addr_t dmaphyssrc2 = 0;; C4 L" Z, _0 V9 f$ I8 ?8 p/ E
- dma_addr_t dmaphysdest1 = 0;
' x. G$ B/ ~. Z* o X8 ^ - dma_addr_t dmaphysdest2 = 0;
3 M O3 u. [% z' Q, j* N% r1 n# h# p3 H
' l$ Q5 w$ T' L1 X) k: `- char *dmabufsrc1 = NULL;
' v7 D: T' Y$ f7 b5 o/ t - char *dmabufsrc2 = NULL;- A) p9 H; {5 C( a+ l
- char *dmabufdest1 = NULL;
: [+ q0 |; D& s8 D! `1 e - char *dmabufdest2 = NULL;# h" b5 _2 q- V* a1 J2 H5 B
- 5 c, ]( o& s7 y; r6 i. b
- static int acnt = 512;" N& K1 `; Y2 p0 T, J
- static int bcnt = 8;. W4 ~6 j6 M( H3 Z. L5 Q7 K
- static int ccnt = 8;) \( S; Q- I4 E! k: _ H: d% R
- - s1 ]0 z: I% n+ b1 b1 l1 \0 ^
- module_param(acnt, int, S_IRUGO);
1 j ^4 ~% F7 ?/ M9 x, @* ~ - module_param(bcnt, int, S_IRUGO);0 w0 p- o7 ]1 ^0 h2 P$ v
- module_param(ccnt, int, S_IRUGO);
复制代码 / A6 q; F1 ^6 w! |4 h9 U, N
9 ?1 f9 a( A" f; o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# E; C! v, |0 ~$ Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, Z6 l, Y) L, q1 t0 A5 Z" v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! o/ N8 k0 l) O# V' K
" P# ]7 o9 S1 G1 A/ @6 ]2 J8 @9 u+ c; a' I- T
|
|