|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" ^ `) s& I2 B; ?9 d- [code]EDMA sample test application
3 k1 o- j& ~( v. h - /*
- L1 A. \* p L$ l! O2 ^ - * edma_test.c9 [1 a* N9 M* ^3 N' z+ P
- *
3 Y/ a5 W% V0 ?9 m8 | W - * brief EDMA3 Test Application
- k; z1 F% ~: _+ r& P: x5 P7 t1 c - *+ q9 \+ H1 l l" ^. y3 `
- * This file contains EDMA3 Test code.
3 ?4 I9 e# { z3 l$ @) r; ~7 z. A" u - *
8 \6 [3 i# ^- r' ~" x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 I/ ^2 F/ G6 g7 ^* P. F f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& c. l9 P3 x! q- ]2 e& W) X
- * TO CHANGE.' X. G% [: J9 h! s
- *% g0 Y& F1 G: D5 h5 t. H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* _! H! |) b7 W# i; \5 Y$ A# w, i7 ^
- ** F/ r. T# X, N0 [: M
- * This program is free software; you can redistribute it and/or. |! p4 c7 ~. ^4 f- ~* n9 U% k
- * modify it under the terms of the GNU General Public License as3 @+ b0 o. U, G- C& q
- * published by the Free Software Foundation version 2.0 p) e& V/ Z% ]
- *- B8 C s9 A% X9 D; J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 o' U0 w$ @# E! h h2 U a
- * kind, whether express or implied; without even the implied warranty
% r& f! y# K+ q/ {; Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' o0 W, F3 J# {' V - * GNU General Public License for more details.5 |" L3 ?& a3 ?4 c. S8 V
- */3 f m( L# ]1 R& @- x
- + T- R4 {% L; n2 }5 n$ N
- #include <linux/module.h>
. F* w* l: s5 ~6 c3 C - #include <linux/init.h>
- H X% i+ N. c. j* m - #include <linux/errno.h>
" V3 Z4 @" P+ l/ v, o& u- K( @, g. P+ f - #include <linux/types.h> ~8 X- B& F( T
- #include <linux/interrupt.h>
# _0 E- A& q. g, i6 h& b O# X - #include <asm/io.h>
. y/ b; G: m Z! ~ - #include <linux/moduleparam.h>
- J! n7 O1 N0 H" @ - #include <linux/sysctl.h>( s/ H/ D; d( S: S# w3 f# r" S
- #include <linux/mm.h>
9 z& w v& g0 K6 g; \( a4 u M - #include <linux/dma-mapping.h>
/ Z z8 f' A1 M6 o
' C) r5 ?- C8 v! ~8 H- #include <mach/memory.h>
8 z+ \4 R" k# e5 z - #include <mach/hardware.h>" N& ~) P4 j5 C8 @+ {
- #include <mach/irqs.h>0 c H6 B- }& C0 U5 \9 {
- #include <asm/hardware/edma.h>
' ]3 }2 i: H3 Y! d
. I: u$ e3 ^; o, x$ u3 R- #undef EDMA3_DEBUG
: z& K) W" Z, H- T% g S7 V; U2 B - /*#define EDMA3_DEBUG*/
E1 D! \0 \) D4 @" M( H
6 e R q8 ~7 f- e( B- #ifdef EDMA3_DEBUG
/ X' i( \) U1 d: m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# z- F* C3 q( }- n6 ^# }. N2 U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ v x3 D& K1 ^% E2 p/ O- B/ f2 h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 c8 b- t# d# P6 Q/ m5 I$ V+ Z - #else; m t& K. u H* n' P' Y
- #define DMA_PRINTK( x... )* M4 B9 F; ^0 `7 S" ]2 d
- #define DMA_FN_IN; }5 w/ {9 |' i7 Q+ ]- W; Z
- #define DMA_FN_OUT
) \# h. ]" E5 `; z! o# K: ? - #endif
, }7 q! K9 i% b x; I1 H' \ B" B
0 h% v! e" N+ e+ l U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 y& J5 B0 A' D* ]. j
- #define STATIC_SHIFT 3
+ a! f6 ~. u/ n. y9 {/ G" ] - #define TCINTEN_SHIFT 20- p- H; Y. ~7 W/ P! ^
- #define ITCINTEN_SHIFT 21
% e3 A p9 n3 W1 X' G6 D - #define TCCHEN_SHIFT 22
% ?: j3 S$ c; t, L) y - #define ITCCHEN_SHIFT 23- A: o" `: ]% F0 L6 j4 B
- : ~" H# ^' I. w# B4 T' G; e
- static volatile int irqraised1 = 0;
. L/ g5 v9 O8 v8 J - static volatile int irqraised2 = 0;
9 L6 m Z' h- t3 q7 x& J+ z% x2 _9 B2 M
& o+ l2 V5 P, Q8 ^( A2 l" b! M, t! q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) \2 \/ {# b) [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! q7 [2 y8 ]% I8 K' x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ t8 E2 A; s1 l$ ^- h - * Q/ i, g# `6 p$ d4 T8 S
- dma_addr_t dmaphyssrc1 = 0;
& q" m. s( z# H) g$ r - dma_addr_t dmaphyssrc2 = 0;4 l. k5 ]: _. M h% z2 {
- dma_addr_t dmaphysdest1 = 0;2 @& e% Z1 i0 i4 G) b8 _
- dma_addr_t dmaphysdest2 = 0; N) q7 M/ m9 S+ J- s
! l* m, j% F0 h1 m- char *dmabufsrc1 = NULL;/ N% h- w. m1 ]0 L/ f
- char *dmabufsrc2 = NULL;5 b3 m# N! I1 L4 X/ _" c
- char *dmabufdest1 = NULL;- t3 h3 h8 x: Y4 Y) _4 i
- char *dmabufdest2 = NULL;/ }* ?! w2 l6 {! i( l7 Q
- 6 u1 n/ }2 t. K
- static int acnt = 512;
1 U" Y `. f- x+ l8 n+ _ - static int bcnt = 8;
" ^% d3 _8 F9 f, H9 J: N# h; l - static int ccnt = 8;0 T) X9 N( z: j3 m0 ^
5 g$ B. b3 B3 s- module_param(acnt, int, S_IRUGO);
# f O" x k, V( u - module_param(bcnt, int, S_IRUGO);
( D G/ m3 I; m E: H; \" y - module_param(ccnt, int, S_IRUGO);
复制代码 / B; r0 M1 u0 j- a
. C1 ?4 ^. V. {! f5 G9 s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) V; Q! ?7 V4 _$ Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 l( {% p+ _( w$ t- ^9 g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 v( u) q9 b: A
* D: m; {# r3 r$ H
+ p2 |+ T0 V2 e! V/ E* e |
|