|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) ?/ u% |& N, h! \# ~$ k3 a
- [code]EDMA sample test application5 z" z- Y3 p: v0 O4 C
- /*+ k8 { n! F9 M4 i6 U
- * edma_test.c
) Y( v' X3 r) Q2 H - *
0 {1 e! ~$ ^* C8 n) h X# d8 E - * brief EDMA3 Test Application
G% A1 j0 v9 E - *0 v7 e& |. a0 U/ R
- * This file contains EDMA3 Test code.; k# ^1 l7 E$ @& }* P4 Y
- *
8 J$ k3 v4 |4 A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ W- K4 \" U f; g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 G* u$ ~, v# W% z/ r$ | - * TO CHANGE.
) ?# A) T6 h6 m/ I - *
& I4 K9 A3 X8 u7 b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 B+ u( ? o, x( Y( g$ S# q, e4 ~ - *
0 i3 q5 J, \- p; {& U% ~/ S - * This program is free software; you can redistribute it and/or0 X, }# m% i* Q
- * modify it under the terms of the GNU General Public License as: i' l/ x- }* i; y/ R4 S
- * published by the Free Software Foundation version 2.* G# ~0 _, A& l) }
- *0 k1 u. s3 v7 k X- P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ ]. E7 G; d& L6 ? - * kind, whether express or implied; without even the implied warranty/ }. k8 j! L% g' j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( i# Q5 q; Z( q
- * GNU General Public License for more details.
3 m/ k9 A" O5 ]! b - */
9 V' ^ }8 L$ K$ s
& N& P0 e+ w) z1 y) D V l- #include <linux/module.h>
' z& S* V) k1 N5 P# i - #include <linux/init.h>
2 d$ K; Z* J& S# U3 p, G - #include <linux/errno.h>
! Q1 t2 Y+ P e( t( { - #include <linux/types.h>
2 v% \3 h% @% U. M# a' B$ i+ Z7 Q - #include <linux/interrupt.h>
& q: t; y0 I4 ?, O1 [ c. G - #include <asm/io.h># ~% V1 u' X' {% U' G2 V
- #include <linux/moduleparam.h> {; z& o2 O8 c; R$ a0 b5 i; H0 U: w
- #include <linux/sysctl.h>+ D. G. E# Q( {2 P
- #include <linux/mm.h>
: k/ D: x+ H9 T+ s1 A: F - #include <linux/dma-mapping.h>
% }4 s( {* e9 y8 v
$ U/ H) K# `" v: ] R4 z% l. T- #include <mach/memory.h>
7 T% T0 A& j1 k: ~6 u8 F" I/ X - #include <mach/hardware.h>
: g4 m; R0 x+ `' y+ i# K- } - #include <mach/irqs.h>1 h( W& d5 M! ?" g
- #include <asm/hardware/edma.h>
/ _- w$ Z0 x E- d) I! P
' D8 U* V( e; _7 x5 f2 Z" K" Y- #undef EDMA3_DEBUG- x0 `9 Q1 L H( Q2 x# Q2 F
- /*#define EDMA3_DEBUG*/
' x3 e; X+ {5 |5 J/ B; E# U) V - ; \3 I, J5 S$ A* x) t
- #ifdef EDMA3_DEBUG
4 F2 T* X- z6 A& y: J# k% _1 g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- f5 V% ]2 ?; h& F- B3 |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ g( O% l3 Y5 ^! }. V; }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 Y8 S* c) J% q* E t
- #else
7 S9 v5 v- O( q' o- T8 b: k - #define DMA_PRINTK( x... )5 N( z4 H; R/ a1 J
- #define DMA_FN_IN p' J* [0 N. z3 x9 C
- #define DMA_FN_OUT
% [/ @- g: U8 J: K2 S$ M$ T* S - #endif
# a/ j \$ e* m+ y" z1 S+ B
4 W; {+ y/ ^& l) I8 v: _2 j6 y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, W3 @$ D% i/ a3 _ - #define STATIC_SHIFT 3
' i9 h) h) c" d. J$ H) d. D4 F - #define TCINTEN_SHIFT 20$ F0 L( |/ j D$ O4 ^2 D
- #define ITCINTEN_SHIFT 21
+ |3 H: n& H/ B; G - #define TCCHEN_SHIFT 227 M/ i1 c2 j9 ^
- #define ITCCHEN_SHIFT 23# V" D) K3 \% [, D, @' u( ~3 d, Q
' L/ x3 m* o8 D3 [, y, x- static volatile int irqraised1 = 0;
7 V5 B$ b% s+ n$ `2 ] - static volatile int irqraised2 = 0;
2 J6 w* l. I' e - / R- k i; F0 O9 y8 |$ J- `* ]6 r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& F& f: X' c2 t; u' @% | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& L& [, N2 T2 Q m& s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 h" u! G5 Y( M3 `7 V; a, _ q
* E- R% s+ r$ k% N5 W) M7 S( \- dma_addr_t dmaphyssrc1 = 0;
8 `: x3 E0 T; u6 z' y" n - dma_addr_t dmaphyssrc2 = 0;+ Y" t- @9 a9 L8 P3 f" w- U. l
- dma_addr_t dmaphysdest1 = 0;% r: x) p1 B8 r/ d4 m4 [, s
- dma_addr_t dmaphysdest2 = 0;
t; M7 i4 f0 T( `1 k8 L/ U: ^ - * j. q; h7 y3 y$ Q7 k' G5 q
- char *dmabufsrc1 = NULL;
# T; i$ g0 h7 J, U# B9 V - char *dmabufsrc2 = NULL;- _- [1 w$ Z$ ^+ E9 g2 ~/ r
- char *dmabufdest1 = NULL;
- J* y2 A8 N) R6 R/ k$ Z - char *dmabufdest2 = NULL;
5 t( u4 ? y0 e) l' d) V o" Z - ) Z5 F8 A1 R4 O9 s2 U
- static int acnt = 512;2 m1 T( [% J/ J8 y
- static int bcnt = 8;
2 `' f! [% M- }; p2 ` - static int ccnt = 8;
3 O1 Z4 n, k3 W' N2 `
9 `( n j$ R2 e9 K, ?1 ]8 i- module_param(acnt, int, S_IRUGO); C. z4 }+ N! d9 {+ `- c
- module_param(bcnt, int, S_IRUGO);
, V0 d6 O8 W3 k& r( K - module_param(ccnt, int, S_IRUGO);
复制代码 , [7 g+ b7 G$ ~$ K% y5 u, V
( Q2 L9 C8 C8 c$ _4 m6 x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 Q" U- p7 t/ D( Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 J& |+ x% y7 @* [/ H, Z0 N+ s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( F# A" [! N |9 J$ [2 d
/ P2 a A# |' ]9 T. j9 B" N. o' z; [( G3 E% l+ L6 |" g; o8 }
|
|