|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( t2 T2 B$ Y: h- H6 o
- [code]EDMA sample test application
7 y+ C! C$ Q2 P( n - /*3 I4 q% ~0 h6 ]4 v; p1 ]
- * edma_test.c
. c0 u! [+ X9 n' Y - *
" b6 @9 ?7 C9 C - * brief EDMA3 Test Application
& X8 c# @# S8 t. c( T; z. { - *' U$ X, R; R: R, s! g
- * This file contains EDMA3 Test code.
* C Z4 a% b' q$ H9 [% R - *( p# i E$ v8 S K, O: Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 R; j. [$ M- W. V, i/ w5 b; m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ h: }# s( |/ _9 O) b- @" L
- * TO CHANGE.
3 d0 A* \" J m3 h+ s5 I# J2 C - *2 }) I; P5 u0 `6 i" k0 s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 v- D; Z+ [0 e1 y& b [! a! I - *7 t/ n! r6 v5 c0 @( Y$ p4 u! Z
- * This program is free software; you can redistribute it and/or
8 s @" L) H8 z5 n- }; r+ z/ o& M6 h - * modify it under the terms of the GNU General Public License as4 {1 T- u8 z/ t* z* P
- * published by the Free Software Foundation version 2.6 j9 W; n! S9 n' ?' F) }
- *
( R5 u4 t* q! ~* F) z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- N2 A. C' w3 l4 \( A, C - * kind, whether express or implied; without even the implied warranty
. `8 C2 K. ?, J9 ~: G- @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ \* C% y' |- B1 x! [& r - * GNU General Public License for more details.2 S, s5 A% M/ @9 T0 K2 G8 \5 }2 P) L
- */
/ p2 M1 I# Z3 ?% r8 u4 ^1 q3 x" | - $ y$ D# I. l! y) o
- #include <linux/module.h>6 m$ ` H- ? w9 R
- #include <linux/init.h>9 K7 a" u# N& R0 y2 A9 A: t
- #include <linux/errno.h>* b' I4 s$ o9 Y2 _
- #include <linux/types.h>" B: W( _% q* X# p+ [8 M
- #include <linux/interrupt.h>
+ {. V0 Y- j' T - #include <asm/io.h>
4 m2 `) }4 |7 t' T3 ? - #include <linux/moduleparam.h>
; O2 G6 n0 m& H: ~1 D - #include <linux/sysctl.h>
9 e& [) r& J- a6 |7 E - #include <linux/mm.h>/ Q; b$ P: e: x
- #include <linux/dma-mapping.h>
2 A- F/ O% N8 n2 s
' X9 U/ E% X: h( G# K2 H0 C- #include <mach/memory.h>- M3 h/ x; b; L! h2 U) p
- #include <mach/hardware.h>
2 e" u9 ~) O; p' m$ o - #include <mach/irqs.h>
6 i% [4 `; Q- \; [0 T - #include <asm/hardware/edma.h>" R. m0 [ u4 E( A4 ~8 r
% y% {) M9 |- o2 {! a- #undef EDMA3_DEBUG
) k6 W; n$ F+ [! W - /*#define EDMA3_DEBUG*/$ i$ O5 p* L6 B9 S& p! h+ W
- ' q2 D& z& p& Y$ q! p; P7 R
- #ifdef EDMA3_DEBUG
2 f8 I2 J; F9 x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' w; o* @3 y: O; e) Z4 d, n% G$ n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, ^( l& R6 _8 q0 w+ z+ Y; ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 i2 k7 E9 i" k! p! k% v+ H( j
- #else* c- ~' `6 v& |$ O( x q
- #define DMA_PRINTK( x... )
* O3 Q3 P0 x) {7 f: l' }2 j - #define DMA_FN_IN
4 w, V: [( h! p8 M6 \% o; e$ a - #define DMA_FN_OUT
# _1 p' f l! j: y7 B9 Y - #endif6 n S; E+ Z+ R" U' X U+ b
. [$ ^4 K4 C# I; T7 j3 R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) P; h0 ]4 g% j' G& u - #define STATIC_SHIFT 37 s1 @, V; g( z y$ }
- #define TCINTEN_SHIFT 20$ }4 @% H5 P" j& {: W
- #define ITCINTEN_SHIFT 21' w6 T0 m6 H+ V4 L6 U
- #define TCCHEN_SHIFT 22
% D' Z9 L6 p" u! N0 Z. x1 s; h0 @ - #define ITCCHEN_SHIFT 23& d3 p. B* M- F# ?& e
# b$ F+ M* w# Z- static volatile int irqraised1 = 0;# O4 p0 }$ ^+ b9 X' ?9 q
- static volatile int irqraised2 = 0;3 h& s: e( c+ ~' v7 ^- U+ b" T
4 d1 I& K5 ?& z8 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ^3 B4 K; c, X. h% F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 f3 N5 R5 O4 _( C( W+ }: c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 A4 O1 Y# a+ c% | - 5 w/ m0 v2 ~; q8 Y! ^
- dma_addr_t dmaphyssrc1 = 0;3 T% b3 ^2 D4 m- c- k( M( }- X
- dma_addr_t dmaphyssrc2 = 0;0 p" ^5 j) u$ f
- dma_addr_t dmaphysdest1 = 0;
! S8 e! d, r3 y: M% F% i) a0 l - dma_addr_t dmaphysdest2 = 0;
/ a1 k) b2 t' G- I5 Y3 J
k- _. U6 p" k) [- char *dmabufsrc1 = NULL;
3 a# c2 e3 t( ^% P# g) C; j, t/ Z - char *dmabufsrc2 = NULL;5 |& K5 [* M Q2 H
- char *dmabufdest1 = NULL;
, [5 j8 J1 ~$ B0 a% v( r) \5 r - char *dmabufdest2 = NULL;
& }; \' f" B+ ]
5 o3 x9 l0 S: y2 K' {2 Q$ v* i- static int acnt = 512; _1 |' f/ f4 K
- static int bcnt = 8;
+ q+ `+ a7 s# ~- C - static int ccnt = 8;
+ f2 z( [* s% t) n7 d# N M0 Z
8 j6 k$ R2 Z Y0 z! K- module_param(acnt, int, S_IRUGO);
( c4 v5 r* j' y+ U9 r/ Y: v9 g5 |. B - module_param(bcnt, int, S_IRUGO);5 X1 E% N6 k4 v+ f( v4 a7 w
- module_param(ccnt, int, S_IRUGO);
复制代码 1 Y' O3 Y# v4 J, N$ W, ~; i
# p" S [/ G, K9 m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 Z6 y( f. e# U! H. R3 i0 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 V9 N- r/ _- z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 F) h- w# d' L K
7 u+ z& q1 `; W/ o: C0 v6 ~" x4 B, T8 Q
|
|