|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ r' k% W; v" H1 X3 B- [code]EDMA sample test application+ U4 ^8 H6 k- h: e* d
- /*8 W/ C' j' e6 K7 E8 O5 z! W
- * edma_test.c- G4 S) ?3 U. W1 E% E3 C# L
- *
s* P8 r$ ?; Q! S, a5 O - * brief EDMA3 Test Application
( c( M( w0 o6 [8 b0 P - *
2 |) `& t3 a% R' H4 M- W& f - * This file contains EDMA3 Test code.5 o" [1 s# X$ { @$ v$ A
- *# F1 W- I& w$ F4 `; v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 ~" \( l% B) ~) c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' K7 q" u: J p2 _+ l. f0 L, S
- * TO CHANGE.
; _ r, Q2 y6 o" q - *% U0 O' \. t# X6 o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 ~- z$ C$ |. n6 K - *
" y1 G) g( X, {* h/ o n! L4 ] - * This program is free software; you can redistribute it and/or4 b% T; [$ J7 G( v6 H; W/ j
- * modify it under the terms of the GNU General Public License as7 n+ N L7 |6 u$ G3 A
- * published by the Free Software Foundation version 2.
1 W( M1 u4 b4 m& t2 y6 C, | - *
! N% R5 ~5 N$ C w: r3 C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ f. w( V2 f( V - * kind, whether express or implied; without even the implied warranty( J; x4 r& M: h+ g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& F1 p% z1 [6 R" ^7 F* t - * GNU General Public License for more details.
1 ^5 m' ]4 a: q; b% b - */
' n2 Q5 `/ N+ m
* B9 |( d1 p6 ~1 s4 _; {! ]- i3 Y- #include <linux/module.h>& F6 B+ J# s' r$ P" Z& y2 a2 f
- #include <linux/init.h>
/ J5 H. D+ A% |: Q1 V - #include <linux/errno.h>
" t9 s9 h3 X: K3 g5 ^3 S# G - #include <linux/types.h>
9 _ @% k/ r& D! D, s1 d0 r - #include <linux/interrupt.h>
6 z! Y& s2 V7 ?' {/ { - #include <asm/io.h>0 \" Y& x j! t6 ]8 v
- #include <linux/moduleparam.h>* Y) P" s" i9 b, Y( ?6 s2 U
- #include <linux/sysctl.h>
2 K! o$ }7 C/ u" e! @: A& H K4 V - #include <linux/mm.h>
, W/ K; b5 ~" c# i4 W - #include <linux/dma-mapping.h>8 h5 J" w' e9 z$ [# ]
- ) f( f' y* n/ q
- #include <mach/memory.h>
) G# K7 \) R1 A3 j; B0 G G0 e Y - #include <mach/hardware.h>
_! ^, N, V' T6 t- ]6 s- F0 J - #include <mach/irqs.h>4 ?6 Q: K( y q! ?1 f6 b! _
- #include <asm/hardware/edma.h>
: ?$ H! B2 s; b% g8 Y: N1 d1 q- K& l
' C. r1 f# J/ H; o- #undef EDMA3_DEBUG3 p) L v) R b" J
- /*#define EDMA3_DEBUG*/7 p9 q- `1 f- y5 c$ ^- Z
1 W8 T3 m2 G8 i! O' c/ o# B- #ifdef EDMA3_DEBUG1 a& n3 B, C. t3 ^( ?5 y% x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 |8 }8 i' H) w% C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 g# z$ N! R2 m3 t8 T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ t6 S; ?9 `1 {, }) h2 B/ j
- #else# E7 q% M% z& O/ O' X/ Z
- #define DMA_PRINTK( x... )6 K) v. @+ ]/ n/ u( @
- #define DMA_FN_IN. ~9 b& ]: ~5 T
- #define DMA_FN_OUT
3 g% K3 I1 w+ d - #endif$ k2 d. l. |# f
- / F" ^, L7 p& E: v" h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) c! w& B% ~9 G5 S5 ~
- #define STATIC_SHIFT 3
B% {; }( E9 Y, Y& f M" v - #define TCINTEN_SHIFT 20
0 \: s+ Z# t9 q7 d* r3 k - #define ITCINTEN_SHIFT 21; ~" }" r6 y. R
- #define TCCHEN_SHIFT 22
2 [1 v# z5 |# u5 p7 O1 k' v9 b) k - #define ITCCHEN_SHIFT 23
7 K0 I+ V7 J- ^: L2 k+ \6 k ^ - 9 V, e0 R3 W0 t0 i9 D7 d
- static volatile int irqraised1 = 0;; P& F! w* }+ E/ {* u8 h, E/ j
- static volatile int irqraised2 = 0;
( }7 T7 ]3 l( B$ J) ~3 A+ l% {7 ?
% f+ s9 z) |0 d" D; C; J/ @, ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: C0 a4 D$ j+ m+ Y2 b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( [. n. L4 w* ?0 U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 {6 ^7 d9 C/ J7 e9 Y& B$ L
" `4 I& e3 J3 L0 Q7 N) K- dma_addr_t dmaphyssrc1 = 0;, _8 H0 l. X' ^( @( b4 k }
- dma_addr_t dmaphyssrc2 = 0;
3 s2 a( m7 S& n' M - dma_addr_t dmaphysdest1 = 0;
( w8 p, c, q& S0 O4 x, o7 C* c7 h - dma_addr_t dmaphysdest2 = 0;% t' H6 |3 S/ y8 o$ P
6 u# F7 w7 d8 Q- char *dmabufsrc1 = NULL;
8 y. y+ e8 g9 X4 a' z - char *dmabufsrc2 = NULL; [: g6 D( A# M% s8 ]7 z
- char *dmabufdest1 = NULL;6 c! A% o" [+ j, B6 x q8 w' T
- char *dmabufdest2 = NULL;
- A ~# Y8 G7 @9 U }
7 Z0 m3 t/ n1 z$ y* Q' w- static int acnt = 512;
7 I+ u* l& J2 k( q - static int bcnt = 8;
6 k+ a: T& S- q# V6 B- _' U - static int ccnt = 8;- ^5 C9 |1 c" _1 Z! r. ]8 v
- a+ g% S8 H& z# x' G0 ~' _$ l
- module_param(acnt, int, S_IRUGO);+ p# C: L) V1 a% N
- module_param(bcnt, int, S_IRUGO);1 V) K$ k4 a: Y$ K4 e$ M& B. O% S( ^
- module_param(ccnt, int, S_IRUGO);
复制代码 * T% x4 X+ S/ f
1 S, F) O# M' ~' h9 B0 p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 O3 n: v, M* u6 P6 K! A$ j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( ~* h r; ]4 ~2 l! W& W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' x: B/ k+ M1 s8 v; V
, E7 g- c- _! `
' S- L# z8 w) ` |
|