|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ J( \3 l" P$ n9 T: {9 [7 i- [code]EDMA sample test application
3 X6 ]2 ^. t: s% C - /*
; f% P }; I3 E- T - * edma_test.c
# X; Y' L5 D7 B) ?. V6 k; S - *
3 \9 m9 u; k- a, d - * brief EDMA3 Test Application
+ x3 j) A S# a* c - *
5 I: l0 ?, X2 z% P - * This file contains EDMA3 Test code.: E7 }3 I: q! Y
- *
Q# |% K, t* V* V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 k$ C @4 v' {5 Y* p$ R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" ?7 T# _+ L1 _4 L
- * TO CHANGE.1 _+ N$ [ I* @& G0 b+ d
- *; H4 c6 F$ o) |) A" R4 a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 g9 O6 l- P- \! i - *- d+ {9 y( b9 R, E. r$ P) j
- * This program is free software; you can redistribute it and/or# {) J! q3 @* X1 }' v
- * modify it under the terms of the GNU General Public License as+ ]0 ?, h' u$ y0 V6 Y0 s- D' V
- * published by the Free Software Foundation version 2.! Z9 Z# T$ S5 A1 m( i L
- *4 Y( D5 G. v( e. z+ Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# K8 \: \; V0 l" a- Y+ M8 g
- * kind, whether express or implied; without even the implied warranty, @* c5 ~7 i6 j9 c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- F( i3 l5 _ I4 n - * GNU General Public License for more details.
* _7 m3 ^0 s* S+ i2 u3 i6 j. [1 v - */" w3 z) l% Q& `9 n: ? I C
- 5 Z. J u$ M S4 |! r3 T
- #include <linux/module.h>
, Z! k/ @& F1 F - #include <linux/init.h>
/ V& j, I: N* H) l4 y/ M7 a - #include <linux/errno.h>6 L$ T' u+ s( W1 l: [3 ?* f
- #include <linux/types.h>- X! o" ] h3 ^6 x' \& b0 F
- #include <linux/interrupt.h>
# n$ D5 E# O1 q; h - #include <asm/io.h>
! g2 N1 C# s: b; c! Z; P$ O - #include <linux/moduleparam.h>
5 e7 ]/ W( o+ t' E4 R* F% v - #include <linux/sysctl.h>
; i s+ \7 Z* ~3 w y# B - #include <linux/mm.h>+ T) v* G6 l, {) g
- #include <linux/dma-mapping.h>8 e" D) `/ c! v/ a; x# g) n6 q
9 X% y8 o9 k3 M: T- U+ r, g- #include <mach/memory.h>
9 d- ^+ s5 V4 ^- p5 B- W* V - #include <mach/hardware.h>
& s; R! a( O8 f - #include <mach/irqs.h>
: w5 {) `' {7 g( d( Z8 w+ d - #include <asm/hardware/edma.h>' J( X, u, U/ j7 \/ i+ ?
- ( l) H" X" l8 u
- #undef EDMA3_DEBUG& \: y* h- p4 _+ e( ^9 ]
- /*#define EDMA3_DEBUG*/3 c" H8 q1 T+ F. m6 u6 E' ]+ F
$ b8 j0 m7 M/ _" E; [- #ifdef EDMA3_DEBUG6 i6 G2 o2 k8 N0 h! x8 E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ T6 X5 w/ \' T5 Y/ g9 } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), b: x+ P7 ^/ `: L6 S1 I! D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). n6 E$ K7 z$ U/ e" [6 {
- #else
2 I& L: s$ p8 Z# V& k V - #define DMA_PRINTK( x... )
" V4 I) Y/ e: Y9 s/ L N' L - #define DMA_FN_IN
. |& X! _ d9 ^3 Z1 K! Y! A _ - #define DMA_FN_OUT
7 _! w' A, U% l4 c, c$ {' X - #endif
* t% y3 s8 o# n; B* f! H* F9 o - 3 Q8 r5 e& S6 [. p' N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 s2 c, r! I0 c* j' f! x8 z - #define STATIC_SHIFT 3! J$ g& U* ^- ^( j0 i+ U6 Y
- #define TCINTEN_SHIFT 20% [$ e8 O) ]& ?6 P: x
- #define ITCINTEN_SHIFT 21
. k$ d. ]% Y' K! E - #define TCCHEN_SHIFT 22
( l7 C: c( `4 ]/ ]0 f6 J - #define ITCCHEN_SHIFT 23: K8 v; P. y7 ~6 D" J6 x% c" t0 Z
- $ I, _" _; S& Z5 T5 H( k% n8 K
- static volatile int irqraised1 = 0;
5 v, v* V. p( z) p0 E - static volatile int irqraised2 = 0;% ^( e' L3 z5 F7 R) g
- 7 U/ S0 f6 v% f: Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# ~2 p; x* W& K" H$ \/ p; d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! f; F6 X: l- I9 W- S" n# u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 a. _1 u: @: Z# t - + Y3 b; X7 Z/ g* M# Q$ w
- dma_addr_t dmaphyssrc1 = 0;8 f4 g9 }# ]1 m) `/ r
- dma_addr_t dmaphyssrc2 = 0;
. M {& R& y4 f2 E2 @8 l. E, r% [ - dma_addr_t dmaphysdest1 = 0;2 e* C/ P$ h4 d: H; I, t+ M5 m
- dma_addr_t dmaphysdest2 = 0;: p; _8 K+ \( O" y; ^0 K5 Z
1 ?5 C+ O$ [3 r3 W5 G6 P- char *dmabufsrc1 = NULL;8 w- Q1 @" Q/ B4 i
- char *dmabufsrc2 = NULL;
" V. k8 e" v( }5 k3 d9 Y - char *dmabufdest1 = NULL;
4 }6 L# B" \4 s7 e - char *dmabufdest2 = NULL;; K. p7 Q; S2 }: ^: R
- 3 x2 E5 e( L% F: J4 |: J
- static int acnt = 512;
% t; G( M3 _7 C0 J - static int bcnt = 8;
c$ {1 }9 r5 y# K7 K - static int ccnt = 8;' {: x4 S) T) j0 S: _/ i# q' l
: t( Y/ }) a" a* K$ |8 }- c- module_param(acnt, int, S_IRUGO);
3 l/ A% |0 P# J2 r9 p/ z& Q - module_param(bcnt, int, S_IRUGO);
& \# w. U% `( R+ n! @ - module_param(ccnt, int, S_IRUGO);
复制代码
5 ]9 d4 O& h8 K* D
1 B1 j; [) `5 c* d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 x6 g# o5 M; s4 Y* c" y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 ?$ |8 K# L4 m3 M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 O: p2 M6 g- K7 _$ c$ \
8 B0 z6 X$ n! J$ {
/ {: K8 H/ N& v5 P- A" T# W |
|