|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : f' o8 K% {- R, @' D+ w- c( h
- [code]EDMA sample test application
% ~# K7 e1 D+ z; W( Y$ g - /*& ?) ~7 ^& x |! N$ W3 o
- * edma_test.c6 }6 l$ m- `+ B3 `* e. `& N
- *5 b! u2 V0 G( T i
- * brief EDMA3 Test Application/ x ^( G$ m1 @, {
- *
% V0 V1 U$ j( }4 B. @7 P+ { - * This file contains EDMA3 Test code.! b9 J+ s; Z/ F1 z
- *+ m: o h0 M+ ?3 D9 U: P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 w3 T, h5 w- G: m+ K* I) p3 ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ X2 [, p q2 F, e
- * TO CHANGE.) V& z$ k7 L& c2 I4 B
- *: Y. X, v1 Y$ t! y4 s4 k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 c. M1 @% f& |$ H( H- O4 ? - *
% [# _, X$ o: e! I7 ^, h - * This program is free software; you can redistribute it and/or: ]- S9 K$ ^/ r/ ^- Z6 ~
- * modify it under the terms of the GNU General Public License as+ `, m% z- t0 p3 E( j
- * published by the Free Software Foundation version 2." |0 }! j& r+ s$ m5 u
- *
/ K/ K* ^$ D/ ?! d% C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 ]0 a' p& G* w+ D8 A- b6 A
- * kind, whether express or implied; without even the implied warranty
# j b& ] W& D% n/ M* R+ L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 v# r% T5 z5 J, u- s( p; r - * GNU General Public License for more details.
$ e( G% U% w& b2 M3 E# t& q! e - *// h0 T' x6 D9 C
! u4 e& Y4 a2 g6 I: {8 g- #include <linux/module.h>
- @1 R8 G9 F* x6 Z, d2 x9 S( x - #include <linux/init.h>) L: M" L" R8 F; t6 x7 z% P3 B2 L# e
- #include <linux/errno.h>, J b4 i- ~& c0 O. q
- #include <linux/types.h>
1 r7 Z/ E0 s2 T/ c4 M - #include <linux/interrupt.h>
% V9 |& a. \# h1 ~! _& L8 d - #include <asm/io.h>
' u3 k! l) v2 h( f, N& u8 L* G( v - #include <linux/moduleparam.h>
( c4 r$ a: ~$ d" n6 A; o - #include <linux/sysctl.h># _8 J1 J7 l# U& Z& E' M
- #include <linux/mm.h>
6 l* @& s& t+ j0 w; ` - #include <linux/dma-mapping.h>
1 a0 {, h' x$ V: ^( p& S - ' p" R; n7 f, W6 {
- #include <mach/memory.h>
: v Y3 E% G4 @! h1 N S" B - #include <mach/hardware.h>
% I: Y/ y2 s0 r3 o - #include <mach/irqs.h>2 }6 O0 u7 V$ @2 Y: t) a0 T3 t
- #include <asm/hardware/edma.h>/ r) I6 w4 ~; ^0 ~# d+ g
- 7 c( \5 D4 i( |$ j+ D8 w# i
- #undef EDMA3_DEBUG
- S, S* @$ Y- o9 X - /*#define EDMA3_DEBUG*/
* w' m6 x! B' Q2 e - . B, B# ~, f2 D( f- S
- #ifdef EDMA3_DEBUG
t6 q! \: a' e3 u: d9 L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 R' K) ]9 \$ c& L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* L! r. I' l$ X/ ?# p: g& o5 g. i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) m8 ~3 L& m& S4 K/ ~/ @ r
- #else! f) B- h5 h; ^" O
- #define DMA_PRINTK( x... )
% }7 X! k$ ]% {" Y - #define DMA_FN_IN
# j: x6 f( `5 x U - #define DMA_FN_OUT8 g" s9 ~. |+ O2 B
- #endif
7 Z% b- q l% f' p& P. @6 _
4 K1 Q; \6 j' k! ^, y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 G- m1 Z: J- f3 d1 d
- #define STATIC_SHIFT 3, b4 ~9 x; }# ~" @ {
- #define TCINTEN_SHIFT 20
. e+ R/ Q. j) v" E - #define ITCINTEN_SHIFT 21
. f6 d3 ]- ~% D) Q- ?$ _9 q/ X1 s - #define TCCHEN_SHIFT 22
7 G* J) g: a, \- Y, s; j - #define ITCCHEN_SHIFT 23
) M, T$ \5 X5 N$ ]/ r - E( h0 g, w. Q. b
- static volatile int irqraised1 = 0;
/ b# K- ?3 K2 K: r& D( X - static volatile int irqraised2 = 0;
1 E" Q3 ]9 K; M# Y5 Z% }! i$ l
T! j- E/ |' J* P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 M/ y2 T- H" _$ T* [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' \" k6 r! ^9 G/ s! y7 U$ w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: J3 N) z; v# j4 K
- 9 C( L" ?" d# Q7 g( m2 v# D9 S
- dma_addr_t dmaphyssrc1 = 0;8 D' U/ j @- m# p' W* Y
- dma_addr_t dmaphyssrc2 = 0;
" b3 B N3 W6 v5 o- m. E - dma_addr_t dmaphysdest1 = 0;
* h5 c( H7 k4 c - dma_addr_t dmaphysdest2 = 0;! a8 S [& O' `4 C
- - [7 P4 J L7 R5 s, o5 x, h, }
- char *dmabufsrc1 = NULL;
9 T6 d; o! n" X% H8 v" W/ i - char *dmabufsrc2 = NULL;1 }( s z6 {& `6 g# J0 D
- char *dmabufdest1 = NULL;
% ? J6 j& a8 g4 d4 F/ k* D, J - char *dmabufdest2 = NULL;* e0 G9 B. ^+ v8 S
- - k* m5 B4 Z; _) q, b! j5 w) ]
- static int acnt = 512;+ x1 Y: I1 Q" C9 f! c
- static int bcnt = 8;) i; t# k8 a0 Z0 X8 N/ y' t8 X
- static int ccnt = 8;
, t5 [2 u2 j7 F% A; q8 _ - 5 W I8 M9 _, s
- module_param(acnt, int, S_IRUGO);
e7 `+ s1 y' z - module_param(bcnt, int, S_IRUGO);$ s' H/ o/ v# V2 ?5 l3 A
- module_param(ccnt, int, S_IRUGO);
复制代码 # [6 a2 T* C* j/ l5 G) T6 k
m% w4 w0 \5 y1 q$ W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 Q$ |8 k5 y8 N6 j, n9 |# S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- {6 w! u- Z/ u6 _6 j0 B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: X$ B# W# f0 y+ }9 p% y8 n x$ a
, T6 c. i, I& u
4 i9 J. W' m6 O+ Y |
|