|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 p7 }" h" E: q1 e' ^) O- [code]EDMA sample test application/ \, X3 C- W! e6 v7 ]/ m$ U$ c
- /*
" J/ d7 P0 ~3 e - * edma_test.c* i" d$ L( u& |( t4 p! R9 ^5 ?7 ]
- *; Y) T0 Y5 Z2 J g
- * brief EDMA3 Test Application) ]' i P' S2 {
- *2 ]7 ?& _ T; P: D
- * This file contains EDMA3 Test code.
; n+ R! P+ B/ Y: K; s - *$ W. q! d+ s7 L) S5 N" N4 D8 j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' q) i, F% i# o" Y2 _1 v& v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 j9 a- I6 @# L* ~, z+ t - * TO CHANGE.
2 |8 F6 K- }" {4 {5 J1 ]# h - *. s$ J. {3 N2 {, b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 V* p' z4 f7 J4 X$ ]9 F - *. A/ y. h r1 [; ]7 {
- * This program is free software; you can redistribute it and/or; o5 b' Z( H: K* u
- * modify it under the terms of the GNU General Public License as# l& l2 y- }: f' S% e* h9 d- Z
- * published by the Free Software Foundation version 2.9 S* \6 ~3 G" p/ _* ^$ G2 a L
- *
) U+ O( q* s4 l' ?& ^9 f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( b0 c6 Y: k* K8 `: K% g7 G9 X
- * kind, whether express or implied; without even the implied warranty
3 l4 f& {; ]5 a2 W! m9 ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ T( ~, {! \& y1 ~7 I - * GNU General Public License for more details." M i+ e' u: f9 ^) r/ o+ Z: l' t) d
- */
& U8 w" q$ x' s
: n' n. y. i5 m( ~ E- #include <linux/module.h>9 I! R/ ?1 h6 i* h: \6 R
- #include <linux/init.h>
2 {, Y& P; V$ B$ Y - #include <linux/errno.h>3 l- B0 L1 l- i+ ~! Q- m6 O6 C
- #include <linux/types.h>: W. @, H9 J: V1 V6 g7 `7 r+ {8 \
- #include <linux/interrupt.h>( N( ^8 c7 n& I9 P
- #include <asm/io.h>
) E% @$ u2 a' F% d - #include <linux/moduleparam.h>: f6 k i: P* k# V
- #include <linux/sysctl.h>; l7 v8 M. [5 O b# S* x. _0 n
- #include <linux/mm.h>2 ?6 p2 s5 l, n! ]1 \8 z, C D
- #include <linux/dma-mapping.h>
4 K5 f8 I( a' E9 Y
3 x) D. s9 } s" i3 g3 _; `- #include <mach/memory.h>
o. q P+ |4 N; t - #include <mach/hardware.h>
) O8 S6 U/ `. D' ^8 {8 ^ - #include <mach/irqs.h>- i( N# j6 J) q/ L/ L
- #include <asm/hardware/edma.h>8 R/ Z9 ?* Q D/ H
4 D7 b5 ~2 s! ]3 f: y- #undef EDMA3_DEBUG. g! U: \" c& B$ Q9 G1 X
- /*#define EDMA3_DEBUG*/6 {9 V, R5 j3 p) V) ~
- - U$ l/ }: N9 m5 b C o9 X
- #ifdef EDMA3_DEBUG C5 B ] S: G- {$ j8 \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ F& \: c& N8 Q9 `; A+ h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 U, q. E& O4 C1 Z' O: s3 Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): j% o" I9 r7 S- O
- #else; C' j1 g7 F7 n6 h3 _% I& ~: j
- #define DMA_PRINTK( x... )6 ]; l# H# Q8 `4 w. y
- #define DMA_FN_IN. A7 _. _3 a" N0 o% `
- #define DMA_FN_OUT
, {3 B+ {8 p" ~ - #endif& b( \1 G8 F# k1 g# ]
( I$ X3 u. \- ^/ U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 z" L1 F+ n; M( }/ U- ` m: @ - #define STATIC_SHIFT 3) t5 U0 a! z6 l+ L
- #define TCINTEN_SHIFT 20
" z9 h2 Z, V. S' X7 L# @ - #define ITCINTEN_SHIFT 21
y$ _/ D; r% {: o - #define TCCHEN_SHIFT 22
7 @# {7 @$ K7 f& F - #define ITCCHEN_SHIFT 236 q1 H: z! P3 R( j) Z) m0 }
- 8 O8 [* o- U z& P8 U: N- \
- static volatile int irqraised1 = 0;
7 n2 X D* I B! P/ B' | - static volatile int irqraised2 = 0;6 r+ j* r' l! \3 M
9 y: I+ H- ]4 p% [. ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 D# g- z2 ~0 O9 ]" ?. Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: D1 m9 [4 b' g X4 [9 n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: n. w7 C% t d
- ) Z9 ?* W4 T! I7 }5 e
- dma_addr_t dmaphyssrc1 = 0;$ c3 l; l4 p# y
- dma_addr_t dmaphyssrc2 = 0;
; a' ]* J0 x9 b4 p4 R. F" z - dma_addr_t dmaphysdest1 = 0;
0 h& }" q* i' b9 h* q9 M6 `. n8 o - dma_addr_t dmaphysdest2 = 0;) T+ g; \: F- F& ~! L
- 5 O" B$ ?9 m% k; [' V |
- char *dmabufsrc1 = NULL;( B1 \. w4 Q9 ?/ M4 ^) f- j. a9 p
- char *dmabufsrc2 = NULL;% w* U8 L0 D% p, T8 c" t7 n/ ?
- char *dmabufdest1 = NULL;
+ ?# ^& t, K2 k - char *dmabufdest2 = NULL;; x5 B! p0 W4 L% J3 s
4 O y- B8 P p' Q. {: z4 r p- static int acnt = 512;
4 d% Z) {, k2 y - static int bcnt = 8;
, p. h: B3 k4 K9 B - static int ccnt = 8;
* H3 N: Q9 |6 T- R5 a( [1 @1 q - ! Z2 o) \, S4 L, M. M$ K
- module_param(acnt, int, S_IRUGO);
+ d& `7 P1 b* L, O- I5 J$ \ - module_param(bcnt, int, S_IRUGO);0 v7 ~- R0 X, v9 W# |
- module_param(ccnt, int, S_IRUGO);
复制代码 ) ^' n0 \! [. u+ k3 R
& d0 @' O6 A, H9 V1 |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) P- f7 }! O' e3 c' o- s5 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) y% C" H' v; A9 _) l2 |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 G3 n4 F1 I# H6 i: A
# M4 j3 Z5 M- `* A" Z7 r- D6 ^6 D& x
|
|