|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % d% a- E, v/ b0 |0 Z8 T& q
- [code]EDMA sample test application
- C5 l- q, ` w" H4 S - /*
. U9 g0 P: l: O Z! X* p- l - * edma_test.c: u: C7 _5 H9 Z0 M# k, z
- *
, _7 H8 Z. z; _7 L2 Y% L2 u+ r - * brief EDMA3 Test Application
! j. X& B3 n- ^5 p! d6 e7 e - *
7 A# \/ n B4 ]- o+ d - * This file contains EDMA3 Test code.
2 x* ^1 [# \ e3 E - *- E/ o6 L5 o0 A% Y7 N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' H' o6 ]1 L, Z- E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 N4 L0 d8 w2 o. a; e2 M) F - * TO CHANGE.1 x" i% l) Y' E% g4 U
- *9 B7 A$ h/ T; F+ ~7 B2 R; i. q4 _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( [. B# z: A7 B/ ?8 ~4 c - *
0 c% Q7 R$ A5 G3 k0 }+ R - * This program is free software; you can redistribute it and/or
2 Q) s. ]$ j& S, Y9 i# v - * modify it under the terms of the GNU General Public License as3 a! J$ g3 |0 ~: \
- * published by the Free Software Foundation version 2.
( M4 v4 o+ L p5 z: m, ` - *
4 |; |3 A7 }0 B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, U: ]% y" t# j4 W; `* d. C - * kind, whether express or implied; without even the implied warranty
! F; Q$ X/ }$ [; W* e$ }9 F3 s8 h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 M$ d' L" a$ P: i- X' M* s - * GNU General Public License for more details.
) x, j" C# u& J - */
& u) R3 n+ H1 e - . e3 O3 u" w6 q
- #include <linux/module.h>
# _ p9 D# L) j1 \' l4 x - #include <linux/init.h>
& e( v! m4 z& W - #include <linux/errno.h>, a9 D& z: ~' O& b
- #include <linux/types.h>( V, [! m1 E1 k* C+ y$ N6 H
- #include <linux/interrupt.h> W" a) [) ]" T2 D- y- `
- #include <asm/io.h>$ M6 t+ n) I |# Y0 E" ~
- #include <linux/moduleparam.h>/ E5 q# b6 P, s" P
- #include <linux/sysctl.h>
$ ^' a- E5 J$ t5 ?" \% Z - #include <linux/mm.h>
7 {7 x: x. g) o& F3 L$ R - #include <linux/dma-mapping.h>
' r; D# l7 w# r( K+ c
k* B9 [0 S5 k( s; Y- #include <mach/memory.h>
5 s: C0 a" U, e! G: V( d8 ]4 X - #include <mach/hardware.h>7 v* z% o5 K: N4 |$ Q+ I
- #include <mach/irqs.h>
2 U4 d2 l5 M& i - #include <asm/hardware/edma.h>
; W. C8 b4 A8 M0 |( N - & A! H& }+ r& ?! y+ ~9 Q% m4 P# p
- #undef EDMA3_DEBUG7 O. i! ?. _; G4 X% z( |
- /*#define EDMA3_DEBUG*/4 }4 H4 ?) t. y# p& K
6 x) O u/ d2 `% F- #ifdef EDMA3_DEBUG( b% e9 n/ ^# K" U$ V* ]2 ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 p$ M) o w0 [8 Q5 y) i7 p! }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 W% g7 q0 {0 r- `. E- Z) J - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- ~9 [6 F$ L K& [
- #else7 l) A) w1 }' A# `' ?
- #define DMA_PRINTK( x... )
{" Y$ L; r+ Y9 r' |. C) v - #define DMA_FN_IN) {2 ^% e7 m. U" u, M
- #define DMA_FN_OUT
, Q' S W* e$ G3 K - #endif
5 `& G/ P$ f" w
7 N/ n3 O6 g3 H$ w! \3 d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& S& L: A+ F& f+ N2 y - #define STATIC_SHIFT 3
0 l6 |# l7 r/ ? - #define TCINTEN_SHIFT 20
2 A; M3 ]1 E; R9 B- `! | - #define ITCINTEN_SHIFT 217 R/ S% p# ]( A; j# y
- #define TCCHEN_SHIFT 22
( V% F2 f- }- Z- M \ - #define ITCCHEN_SHIFT 23' M7 b0 g V: r9 B" ?- b1 S
- 6 W5 n- ^( ]+ i: f
- static volatile int irqraised1 = 0;2 ^; O$ Y- g1 q( t
- static volatile int irqraised2 = 0;
3 t. n8 D+ x5 _; E$ Q" J: q+ Z - ; g6 f5 g3 d+ L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ k- E+ w& e3 v! ]' q5 B) b+ O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ F( Y# e% k6 ~" o9 e' w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 V( S9 q* S9 E9 u# i
9 L' I. E; c; M9 b% I" Y6 s- dma_addr_t dmaphyssrc1 = 0;
$ d# L* ^) x. N$ }6 O - dma_addr_t dmaphyssrc2 = 0;: G4 ?8 E0 B @& B" h
- dma_addr_t dmaphysdest1 = 0;
9 u+ F; X4 [. N. E K - dma_addr_t dmaphysdest2 = 0;8 @3 f5 G% o" Y- I
' q/ ^ o& s1 ^3 u- E- char *dmabufsrc1 = NULL;- M; E3 V7 o8 D! E/ x( _9 [9 {
- char *dmabufsrc2 = NULL;
% K f9 R* |: J, F- x# x - char *dmabufdest1 = NULL;4 H, p* t. `1 J* B2 E
- char *dmabufdest2 = NULL;" y! ^* Y; f0 k5 P9 `8 ], W
! j' L* I! K; s$ O, s9 {2 x- static int acnt = 512;9 t- z3 i1 x4 I; [* @/ V
- static int bcnt = 8;! J. a; w8 _( B+ S; u8 X3 @
- static int ccnt = 8;# ?% @( o# B) q7 k
- : @! U- { v: Y, M% Q( U
- module_param(acnt, int, S_IRUGO);
% N z) m' b# q4 S% s# w' v - module_param(bcnt, int, S_IRUGO);3 _5 q3 S& ~# ~; G
- module_param(ccnt, int, S_IRUGO);
复制代码 2 c9 j. p/ R N& ] v9 A
5 f- m- j* ~ b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 i: U/ v3 O6 t+ G. W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) c$ i [5 W7 O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 \' S# ?+ `2 x
/ n' y: O8 s9 f3 n, \7 H' a% Q8 W" ~
|
|