|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 z" c9 Q& q3 K4 j- [code]EDMA sample test application! V7 g0 [' \$ Y1 t& C* D
- /*
0 D7 y9 I# r8 i9 l" F - * edma_test.c7 R( B+ M: G: I7 k# b3 e
- *
! y6 T3 E" Z$ k& a: c. u - * brief EDMA3 Test Application# k0 b7 K1 G- a1 p5 ]( Q2 D9 R
- *
! y* e, n: S6 T& t' q - * This file contains EDMA3 Test code.3 ?$ b$ M" U& ?0 K8 e! }8 z
- *
$ o9 Y2 \6 U, F0 n- R$ y) R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' }- v- W7 ]/ o( ^, @+ G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ _9 W2 m) n3 T5 G4 a
- * TO CHANGE.) g& A& j$ L7 L9 I1 c
- *9 x) @' W; H* D% C$ O) ^( `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) W4 u6 v# C0 {- J1 l3 G
- *
3 H# D8 Z9 R; s6 M - * This program is free software; you can redistribute it and/or( b; T. n/ k. H
- * modify it under the terms of the GNU General Public License as/ ~! C Y2 _+ i5 l1 f) ^: W
- * published by the Free Software Foundation version 2.! u+ A1 `" f. n; S
- *+ P9 g6 K x. J1 q0 g# }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 q1 s9 A0 `" z% z - * kind, whether express or implied; without even the implied warranty
4 F! g4 z3 p# w( b' n# G1 e# J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 Q) b, O7 }9 e0 N- N M3 ` - * GNU General Public License for more details.
+ y2 o8 p& s9 l% a: P - */
3 I, b9 g+ r$ c: p
: X- q) r) V& ]8 A) a+ K- #include <linux/module.h>
6 H! q7 L5 ^0 {0 k9 z - #include <linux/init.h>, h$ x5 n" _; z* x, q- p0 L
- #include <linux/errno.h>6 w- R+ d6 c/ l6 `
- #include <linux/types.h>
" r4 @; W" _ K5 B. q F4 o$ Y - #include <linux/interrupt.h>/ ^ G1 V2 M5 J' U! L- `0 l
- #include <asm/io.h>* n5 O* e; [% l2 a7 I! o7 P
- #include <linux/moduleparam.h>
& U* m3 z6 N0 P: X - #include <linux/sysctl.h>3 M7 f7 ^0 y: P5 b( ~
- #include <linux/mm.h>7 u/ C6 I' D; M- ?1 d
- #include <linux/dma-mapping.h>7 v3 [3 Y f7 J
; I$ ]* W! J* [; P9 y# s- #include <mach/memory.h>
; Q1 R9 C6 o. a/ T - #include <mach/hardware.h>9 ^0 j% h& y8 I$ x& y7 l
- #include <mach/irqs.h>
8 I# U( f3 t( ]5 Q; m- j - #include <asm/hardware/edma.h>4 E& i0 C+ ~ v+ R+ J. S
" G& ~! c |2 o, o+ L8 `+ [; d- #undef EDMA3_DEBUG: ?' u3 W/ M- b0 v
- /*#define EDMA3_DEBUG*/
! S$ x# |6 T$ }) D
! q O J) B+ M: t- #ifdef EDMA3_DEBUG9 ^) U; d3 G3 m! x/ m& b. Z$ G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- F' y! S: f; R, x9 j/ N$ u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 w' V$ y& A6 w& e+ Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 `5 j5 c6 ?5 S/ S0 K
- #else0 t' N% R6 Z& V4 q
- #define DMA_PRINTK( x... )( t8 [! n& M; v* n2 Q: v" x8 `) V
- #define DMA_FN_IN4 d9 u2 \( C. ^1 p% `5 Y
- #define DMA_FN_OUT! z6 \& N# v; S. w n) F1 V6 ?! w
- #endif* q* C2 w; w& X, M9 t
& E% O. H. r4 q- `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( X! l0 J+ v8 b
- #define STATIC_SHIFT 3, B! r; r# d* [
- #define TCINTEN_SHIFT 20
# A$ V5 X5 A; K% h! [ - #define ITCINTEN_SHIFT 21+ N' y1 t) B/ |( A( ^" i$ B, Q
- #define TCCHEN_SHIFT 22
# G/ {; V N) ~ - #define ITCCHEN_SHIFT 23
t: ^& ?% C5 q0 [' C" h - ( C4 d8 l+ P; P# x ]3 t$ S
- static volatile int irqraised1 = 0;, E+ E X% Y, `7 y( E. i$ g5 v
- static volatile int irqraised2 = 0;$ R* o7 M; x6 ^9 q; a% p7 r) ^
- 7 I. C3 [ J) v6 K+ G3 q% U' W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 S! ?* i& m# L* y! t" V" j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, C( x5 B0 d u H, }' c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 s% ~4 G2 Y9 } |* B$ s% s - 1 F- v' U; ^" e: w* A# A
- dma_addr_t dmaphyssrc1 = 0;
9 U8 T+ h& T& m, F- z( ]1 y - dma_addr_t dmaphyssrc2 = 0;/ K( f8 Q8 r) D J" f
- dma_addr_t dmaphysdest1 = 0;
. l6 f( q# P% e - dma_addr_t dmaphysdest2 = 0;
5 h% t6 n' h2 O, O% j% F/ y - ( c, {1 Z/ W2 Q+ S6 l" \7 Q
- char *dmabufsrc1 = NULL;
2 ^! [8 y9 `4 g# r - char *dmabufsrc2 = NULL;4 J, O" C$ F" U1 p& O
- char *dmabufdest1 = NULL;4 v7 y" r" ^; J- |- F& i
- char *dmabufdest2 = NULL;' L$ U E! U5 Y4 _& b/ i
, @- _$ K: [0 F3 x# g$ |" f- static int acnt = 512;* w9 h9 R; l) W% s/ m2 N" \
- static int bcnt = 8;- I* q G- o. s
- static int ccnt = 8;
5 O2 P& U$ ~* k; g! z% D
2 f) M1 S$ ]6 v) G" i1 e) h! o- module_param(acnt, int, S_IRUGO);
- Z+ f9 }$ w8 Z- W, v - module_param(bcnt, int, S_IRUGO);$ u) r9 H$ |" z, G, ^. r
- module_param(ccnt, int, S_IRUGO);
复制代码
- i$ d8 l+ h/ R$ p( v7 M+ m9 L% d" N4 H- F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' D- e% K4 A, K1 P2 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 N" D+ a7 m# w, v7 |. ]( S- d# e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ X1 X z; Y R; [( m
6 x; w" ^) b+ ~: i% W
3 g6 B- d+ \+ ?2 |9 p
|
|