|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 ~: q Y. `7 E: } {- [code]EDMA sample test application
- Q$ b9 ^, @) J. d - /* K" m1 w( p' j. K6 a
- * edma_test.c+ ?! @! b& Q; O) i
- *7 G H2 h& p$ u- v9 E
- * brief EDMA3 Test Application% V0 R, k) I) e0 N* s5 R
- *. p2 V1 D' f) S% v
- * This file contains EDMA3 Test code.
+ a- v# D; t8 [8 m - *2 J$ v2 g+ |9 A' E% i C/ ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ p' m5 c5 }; r+ M6 l! o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 I# j+ H% s, w3 t' c, J4 P - * TO CHANGE.4 y/ x8 J9 x( Z4 v
- *
! F. v* G6 g& |& X1 x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" y$ z9 v0 N) | |2 f2 g' P% F - *9 ~/ a; x1 Z. e# T+ S
- * This program is free software; you can redistribute it and/or
4 N7 w; m8 a1 n/ p4 v - * modify it under the terms of the GNU General Public License as* N3 W& H4 D$ |$ L. a/ g
- * published by the Free Software Foundation version 2.
. R0 Z' g$ w6 i1 V. ?) _3 P - *# M' ?+ O5 S! n6 F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) T/ W) F) p- e
- * kind, whether express or implied; without even the implied warranty1 C+ s* K; L+ \) ~. k! _4 S! c; c( t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 X1 F' O" Y. P8 f% j( I
- * GNU General Public License for more details.# m$ Y/ ^* q4 w# @) @$ w
- */& n* A z) w& g/ w( L
! q+ E! U2 f* o: O- #include <linux/module.h>
: q2 h) U+ Y" @% X8 \ - #include <linux/init.h>+ ?0 `$ w D7 a8 k: ` a) o( y9 y; Z
- #include <linux/errno.h> o$ ]/ S, C2 h: v, Z- Z' F1 W
- #include <linux/types.h>2 t: H6 n( q, c! H2 o6 m, V
- #include <linux/interrupt.h>
1 A; v5 D" S( o8 h" E$ N0 Q6 Y - #include <asm/io.h>% \3 ]. V7 e Y: {6 d
- #include <linux/moduleparam.h>
) J# p* T3 c/ R2 v/ W x2 R - #include <linux/sysctl.h>
: V% J% F" P. k+ I$ U2 a1 Y - #include <linux/mm.h>
. H# T& x6 S t7 s# C7 I - #include <linux/dma-mapping.h>
. b& @1 n: V% H: l0 i - ) v( S! P0 X2 b- f9 p! F1 `7 d
- #include <mach/memory.h>
- p) K$ J: L6 Y0 } - #include <mach/hardware.h>
+ q" k7 p$ i, c B - #include <mach/irqs.h>
`" g# o" [" o9 E% a: C6 X. {: E - #include <asm/hardware/edma.h>% a1 @' I! e' v
- : e: C, V4 p5 W) g X) U; I
- #undef EDMA3_DEBUG8 P' q2 G% @' L6 N( ?) Y$ G2 D* K
- /*#define EDMA3_DEBUG*/6 i X6 E5 i1 P" ~ g1 a c- C
- 2 z1 C! l4 q! x" ^7 C. w/ X
- #ifdef EDMA3_DEBUG6 Q2 m. u7 v4 b! t z- l/ A- V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ r# w( A% |' @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- p8 {( S$ C4 V8 M0 Y! p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- I/ P( x; B( V/ }4 f% x - #else. h* L D6 f: q; K5 l
- #define DMA_PRINTK( x... )& ` }! f" I5 ]$ j5 I1 B2 j
- #define DMA_FN_IN6 ^$ _& u7 p: B' Z3 p6 [# E5 n
- #define DMA_FN_OUT C/ [, f2 A6 l0 o6 J* J
- #endif$ [+ U2 X$ _5 [+ L
- & G. ?7 y2 p/ p2 d7 n2 J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 F Z a, n( H0 C4 G
- #define STATIC_SHIFT 3
, @* W q* j% r' z - #define TCINTEN_SHIFT 209 N, O/ ~2 ]0 b! O2 P
- #define ITCINTEN_SHIFT 21
" t. V& n. r$ R' q' q - #define TCCHEN_SHIFT 229 H- `4 H% \ C: `) k v" u& N8 m8 v) H
- #define ITCCHEN_SHIFT 230 r5 i3 q3 x% y) L- ^% S1 J# z
2 @3 ^4 I/ k. v: @# y+ B- static volatile int irqraised1 = 0;( N! t0 W/ q, l0 d; m% @
- static volatile int irqraised2 = 0;# J! n0 T9 R1 Y
* F* d0 p/ _7 M% z: G/ d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 }2 X+ ~% D8 ^4 v( @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 {- ]2 d# k# l% J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 I' N1 d ^* w7 c) w; s5 u z
- O+ `) S" h' C% X [& u) i$ c- F
- dma_addr_t dmaphyssrc1 = 0;
- b3 y5 K+ `+ S9 v. `2 g - dma_addr_t dmaphyssrc2 = 0;7 ]' ~$ ^9 k: }. U
- dma_addr_t dmaphysdest1 = 0;8 v! q: Y7 f- i' W* _8 s" ]+ J& e- ?
- dma_addr_t dmaphysdest2 = 0;+ h2 t7 U4 N' Y3 `4 D
: O f3 B: g# o! E1 n# h+ x- char *dmabufsrc1 = NULL;
. N) {" g& K9 `; q! E" F: f, X - char *dmabufsrc2 = NULL;, Y4 k4 [& T# r# F4 t8 K" x
- char *dmabufdest1 = NULL;
8 j2 c }( t2 D8 p7 E, I9 J6 B2 J - char *dmabufdest2 = NULL;) D1 b) U+ L7 v: b3 _% g
- 7 X/ y) _8 M; q
- static int acnt = 512;
+ E4 p/ N) N5 ?( M" i - static int bcnt = 8;
Y6 _$ n& [" {9 G - static int ccnt = 8;
1 w3 g9 \$ }6 r* C/ H1 \ - ! m2 R8 ~+ i% d9 f2 s; S% J% d' r
- module_param(acnt, int, S_IRUGO);8 G; I5 s- i! ]
- module_param(bcnt, int, S_IRUGO); H) B( @; z$ ~' S
- module_param(ccnt, int, S_IRUGO);
复制代码
3 v* c7 h; J( V
$ M5 [$ _! ]: l/ i4 a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 H( H0 ~0 H, K/ H- x4 g1 h5 ^& k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 ]6 z' z6 f1 e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 _7 P: Y2 b: n; e$ t) y/ X+ d( ^9 I; q0 O; W1 f
. C, ?8 c* { \& e
|
|