|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 y/ J) u# @$ O: b" {- [code]EDMA sample test application, B5 R7 N- J0 Z/ R3 f# U1 k1 c2 T
- /*. r9 K: C& d# |$ v6 L
- * edma_test.c
+ h0 n: U2 Y* O" I - *
9 E2 J) g2 R3 [4 Q$ X* W/ Z, V - * brief EDMA3 Test Application4 {: B3 Y) T2 J4 K0 v! p
- *
0 y/ ?+ v" z, Y7 G - * This file contains EDMA3 Test code.0 i. g3 x- q) R% |7 n0 n
- *' q3 q k/ Z/ A; D! B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) q% H% Q" D, w+ H. D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( r9 ? b: r+ R% V7 Y - * TO CHANGE.
`6 K% c* V) @) L; Q - *' u! q6 h( r9 A+ b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. I. k5 L" l, Z: b - *- {3 m; V+ _1 {0 C
- * This program is free software; you can redistribute it and/or0 ]5 H; h6 b: `* O
- * modify it under the terms of the GNU General Public License as1 F! p3 b S" E2 _; b
- * published by the Free Software Foundation version 2.( x2 Q3 ~8 I. F$ Z! r0 b7 I9 W
- *
& A/ e! g4 H) f+ j) ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' s0 J$ e; z9 w& n( v; i, ] - * kind, whether express or implied; without even the implied warranty
6 h$ K0 N! ?( L! I: F! m* G- \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& b- M! y" L; j& {4 t0 B - * GNU General Public License for more details.; I6 t% |8 d. ]% C2 p
- */
1 @" K# A( y7 i/ e
8 [) ?9 s4 E: C0 y- #include <linux/module.h>
( n4 `1 `: \0 v* |+ _6 F9 ] - #include <linux/init.h>5 E4 a9 I/ {8 v0 `) N
- #include <linux/errno.h>
5 M# @" `+ [# I4 h9 `0 } - #include <linux/types.h>0 k6 f; X+ |$ C# M9 X0 P* O
- #include <linux/interrupt.h>( J& z; t5 c7 D6 U3 Z
- #include <asm/io.h>
+ M2 l l7 I0 g, I - #include <linux/moduleparam.h>9 _! h7 N% I! \5 c8 `
- #include <linux/sysctl.h>0 ?& n6 k) j5 k8 ~# w& J; M# o
- #include <linux/mm.h>! g' j- N( i: J# K; a
- #include <linux/dma-mapping.h>
$ U: b5 x/ W6 c8 p4 i; l
* e0 ~) A" v+ e8 I- #include <mach/memory.h>2 _) j( w/ _1 T3 F8 _0 K$ Q: m
- #include <mach/hardware.h>& Q$ U& ?0 ~/ u
- #include <mach/irqs.h>* z; Q m& p+ W2 _2 g3 v% ]; r
- #include <asm/hardware/edma.h>
" [% U( s/ j, D0 z8 P: u3 F
; B8 J. P' u' W8 ]1 z- #undef EDMA3_DEBUG0 n+ l0 \3 t8 {) y3 _+ {/ o+ ?0 W2 N
- /*#define EDMA3_DEBUG*/1 a# h( _2 U4 W1 t3 _9 ?) A ]
( p6 n _+ q) g! ?9 }- #ifdef EDMA3_DEBUG
7 V4 d8 W4 ^. n) q6 d8 ]. C* y$ M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). p0 Z4 s- @/ I, u4 z. | I, L3 J5 R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ ?8 ^& Q+ [) B" U0 n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) v: z d' t# P - #else
( N" ?* `, x: K4 \# l t7 i - #define DMA_PRINTK( x... ): w+ D# f# ]4 w9 X4 c2 E5 v
- #define DMA_FN_IN) R2 J( k; ^! U. k
- #define DMA_FN_OUT$ c7 z' H/ B- q* L& s0 X
- #endif% B+ V' h, h* N' _, X1 v1 E
- - ?; p% t6 `* j" W; G; _% f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% y5 [7 z+ j5 t5 @ - #define STATIC_SHIFT 3
N* y) X" C. s0 L9 C - #define TCINTEN_SHIFT 20( S7 e5 d, s2 f: u; w9 @- ~4 \
- #define ITCINTEN_SHIFT 213 ~$ `; ^: w! }( \
- #define TCCHEN_SHIFT 22$ ^* u/ B3 A& v: `
- #define ITCCHEN_SHIFT 238 @( B% _+ G: A; L1 C
- 2 L: e# `' \8 ]) f* P4 z G
- static volatile int irqraised1 = 0;# ~2 u+ P1 n4 i n
- static volatile int irqraised2 = 0;
i. j2 T3 m i. r" G
# q, T* i0 w- N0 ? g2 [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 v# \: W E5 G) ]4 f4 d- Q! D2 c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 J# n4 \1 _% u3 j3 v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 _* o7 A g" ~# X. J- {5 i' E
- 5 x3 o$ U1 q& Q3 K* ?
- dma_addr_t dmaphyssrc1 = 0;5 k0 G+ X6 E: |7 k6 ?
- dma_addr_t dmaphyssrc2 = 0;5 f& D, N, p: p# M
- dma_addr_t dmaphysdest1 = 0;
2 U% C N( \" f! @+ N8 ?3 i - dma_addr_t dmaphysdest2 = 0;/ E0 l2 N; x; @, X- L: a) z
8 w5 `% U$ \. x0 e& U2 k y5 ^2 S- char *dmabufsrc1 = NULL;1 q# a r1 M# Y; x
- char *dmabufsrc2 = NULL;
( Y7 g0 H, }% g7 k: i; @ - char *dmabufdest1 = NULL;
# ~7 ~7 C2 T+ }) S - char *dmabufdest2 = NULL;
; l: J# f; k6 m; D& o2 s - ! K9 r6 d& \$ \: ]
- static int acnt = 512;3 P8 z! P1 c# u8 }% f% u2 Z/ J
- static int bcnt = 8;
5 N" X: |6 f+ K) L+ a - static int ccnt = 8;
( o& A8 P: M1 D/ e
5 z" F) D: l A+ L- module_param(acnt, int, S_IRUGO);& B: h" ~# A( n) O
- module_param(bcnt, int, S_IRUGO);
; [1 ]: n/ W( |7 s# f0 b8 t) D - module_param(ccnt, int, S_IRUGO);
复制代码
. c4 j4 |2 w! q; [0 B( h$ X8 C2 O- w2 T; g4 ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! [( ]* h, V- Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' y9 t" ]- C! Z. j I% s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 p5 g2 r. h, Z$ V$ x
/ z; c( j! H& m( r0 M
& y* D+ y S4 B$ T+ ^ |
|