|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & }) l- n+ b" Z3 u" f3 x7 d; d5 w
- [code]EDMA sample test application
3 l7 q$ l; t: U5 G, _ - /*
7 [6 ~+ m- B/ {: z" s, K" [" n2 m - * edma_test.c
! n l5 H& {9 c( \, ]1 _" _ - *
9 n* T7 l+ E6 N% n, B4 F$ t - * brief EDMA3 Test Application
8 p0 i% ^9 y" u" f; L! e - *
" [5 A- e P8 O, ]2 a3 e; e - * This file contains EDMA3 Test code.9 v3 Z6 h7 d6 {: c0 ~
- *' ?; T( h _" H5 c; k3 J" s4 r0 a2 E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 A O9 w% R7 }* N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! Q9 c/ I" E! I q5 W - * TO CHANGE.
# V, F: N* E2 d - *
1 E7 n- h- {' n# y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- h7 r8 S k3 \/ p; F: a - *. v7 {' D! f3 u/ B) b
- * This program is free software; you can redistribute it and/or
( j2 r5 l; N! i) N O1 Y: o - * modify it under the terms of the GNU General Public License as# |* A4 |# N4 a2 o8 u
- * published by the Free Software Foundation version 2.
. N7 j9 |% o8 m Q+ j, N: ^* [ - *
. t, Z' N' ]% u+ C/ J2 ^- ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 H. ]# w$ a. S5 o" B
- * kind, whether express or implied; without even the implied warranty5 g% y, r% J8 l) ^3 r4 l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* L" x2 ~6 S c" x" l/ q
- * GNU General Public License for more details.: U1 t* R6 C- u, A% O
- */
$ a6 f6 G- C' g+ w7 K
; e' D9 B' X3 P! g; s) C- #include <linux/module.h>
8 |: |) [. {' | - #include <linux/init.h>
/ G; A r/ W; e+ R8 } - #include <linux/errno.h>
' v' u5 z. u8 D$ x% w. H) ? - #include <linux/types.h>8 h' s- E1 d0 T0 ?1 x' d2 t
- #include <linux/interrupt.h>! d4 D" T+ q5 `1 E4 w
- #include <asm/io.h>
4 ^, ]6 D& ], |' n( `* E0 {/ F - #include <linux/moduleparam.h>$ ]$ d# Q3 U# k3 ?. Y# s
- #include <linux/sysctl.h>5 w0 _0 H5 K; j4 K- f! T3 t2 I; P
- #include <linux/mm.h>
( ~5 ~) c8 o" p* ?# d9 C: z1 F - #include <linux/dma-mapping.h>
3 |$ y# Z8 q, c& {: Z! r( n& g
2 a' u- ?+ H- Q- w+ m- #include <mach/memory.h>
6 J, A: @3 |. ?4 k8 S - #include <mach/hardware.h>& S, K+ I+ `. q; m
- #include <mach/irqs.h>: v6 w7 y' [7 R+ H" z
- #include <asm/hardware/edma.h>& I& V/ A9 x# ^
- 3 ]: X; ?" s/ z e
- #undef EDMA3_DEBUG. n2 f# D p+ a
- /*#define EDMA3_DEBUG*/
0 ~* Z. A. H* z0 ~% |) s - & v8 j A! l( j
- #ifdef EDMA3_DEBUG
$ a- u3 t& Q3 z/ d* z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) b( \8 r/ F4 p6 G, @/ K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, Y! n7 ^* Q& | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. }/ I& |7 E* Q/ J4 H - #else
8 Q) H: x9 j4 } - #define DMA_PRINTK( x... )4 z7 T% V* E! @
- #define DMA_FN_IN
& ]* @4 M/ X; g) r - #define DMA_FN_OUT3 q7 [" O, i, h/ C3 P
- #endif
( `& h* ^ m! j7 v/ _
; @6 B0 t2 Q2 }9 @7 K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ d# W0 ]4 k( W) W4 C# m8 e. K$ T
- #define STATIC_SHIFT 34 m" k* I/ u* x: L+ b# A" n) Y* ?. }
- #define TCINTEN_SHIFT 20
- r- s7 E, n. o. R5 H) x" x8 j - #define ITCINTEN_SHIFT 21
3 q) X1 C. j* T6 }* S+ v1 ?0 k - #define TCCHEN_SHIFT 228 p1 p* x6 o8 q& m+ b0 r
- #define ITCCHEN_SHIFT 236 O) N; ]( w% `+ k5 ~* P
; V! d* T) C* u5 A8 T' K; @ d- static volatile int irqraised1 = 0;" u# \' y+ i% P5 T
- static volatile int irqraised2 = 0;$ c5 I7 j* B$ q% l# [# w
w( s( B) I0 z3 h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
E/ v( p5 C) c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 H" r8 Y5 [. x& m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* j( F6 u& ?4 y# e. n3 `6 _) N7 r
" m0 @* G2 i* f* r+ v- dma_addr_t dmaphyssrc1 = 0;
" D' o K3 z' m! ] - dma_addr_t dmaphyssrc2 = 0;
* s7 `! D* G% n- q5 e, _) y; w0 y - dma_addr_t dmaphysdest1 = 0;7 y9 W6 W+ b) n7 M7 \6 G5 l
- dma_addr_t dmaphysdest2 = 0;; p/ A% h; H$ s1 A2 k. Q
- 3 R1 J. ~9 B7 A9 F6 D
- char *dmabufsrc1 = NULL;
; G. y% M/ Q* b1 { - char *dmabufsrc2 = NULL;
& n. m+ j8 O! }- h2 }( s8 }7 b - char *dmabufdest1 = NULL;
1 b7 F8 O2 B { i7 L+ [0 q* e! x - char *dmabufdest2 = NULL;9 s7 B% J. l! u4 l' H
- . o$ Y3 \3 b3 u" _
- static int acnt = 512;
# W: K0 n* ]" G" N - static int bcnt = 8;- B% |# |, i7 h* A+ f
- static int ccnt = 8; j& J6 G2 n( {5 I2 i1 y/ q! g
- / i" r) o, Z) F! }! R/ q
- module_param(acnt, int, S_IRUGO);. W+ [% c1 B2 ^
- module_param(bcnt, int, S_IRUGO);
: Z: L7 ]5 ^1 o" \5 x8 ?. } Q - module_param(ccnt, int, S_IRUGO);
复制代码 & U8 A) D2 T- R6 k* T
, s0 k2 f0 t0 E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. b V" q. c ?/ f$ I2 f& I" V! C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' \5 a) L' U# _5 H1 Q5 Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% {( g9 d: G- v" ?8 U# S
; R% e# t' A# H( [* H& z
, z% B, [8 v& t3 y
|
|