|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% k, ^8 N8 D% S. [4 B- [code]EDMA sample test application
4 a4 F7 t) A( u0 m2 ` - /*
/ J5 F T. {8 C# L. J6 q - * edma_test.c7 C+ q/ A: R/ s. V, S
- *0 z% b: f5 y' y& M" n
- * brief EDMA3 Test Application5 i! N- n1 o0 ]" p0 }6 o& |- j8 K
- *
7 a& z& {9 W6 k3 p9 e( Z* K - * This file contains EDMA3 Test code.6 l) M- A& o1 L
- *
% w. r; W f4 g8 s. v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. k; b, W6 l4 c+ g, c7 D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. J2 b E5 _9 r* q! P( w6 ]# x
- * TO CHANGE.) ]$ P r$ [$ A" d; H$ ^4 w
- *$ ], U' ~) c/ a5 R. s* Y! ?- S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 d. ~ A! u7 t' e+ s
- *$ n$ E4 ^5 G9 ^* Y8 L ]7 d
- * This program is free software; you can redistribute it and/or9 t: p+ `9 m9 d
- * modify it under the terms of the GNU General Public License as' G7 O- y* |; r1 e7 u' ~
- * published by the Free Software Foundation version 2.
- ^$ c- X0 t( R/ G5 R1 @4 k - *# w) v. x E/ Z( g+ S1 `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 a4 [8 j# \$ {8 s+ d' }! `
- * kind, whether express or implied; without even the implied warranty
3 N. y; e8 {& ^8 d8 J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* H7 O9 @; P* F7 d/ R2 i! l/ f n8 _
- * GNU General Public License for more details.
2 o6 _# G1 v- n - */+ o. V6 U' U+ d. U1 e6 e& U
- 2 v: `" D" X- q2 J
- #include <linux/module.h>/ T% m3 |+ u p& e. \5 o1 M- M7 z
- #include <linux/init.h>5 y9 N V2 j+ }$ c" v
- #include <linux/errno.h>
R3 B7 O( l# |5 A$ w2 n! D - #include <linux/types.h>
5 w9 L$ l8 C$ [3 y, `6 P' a6 r$ h; D - #include <linux/interrupt.h>
$ H% ^" u% j3 r; b; N - #include <asm/io.h>
) n' Y' b2 W- _/ u1 H- H4 d7 b! Z' M - #include <linux/moduleparam.h>$ @& e/ e0 P6 r, Q1 D! n; M& b/ q
- #include <linux/sysctl.h>
/ ^, ]- \7 ?, H/ C4 R. G - #include <linux/mm.h>
. N" S) h8 ?4 |2 N+ u - #include <linux/dma-mapping.h>( }& w8 c$ U( v, e5 n0 g
- ! E6 F1 S- P" g8 ]
- #include <mach/memory.h>( Z2 k1 G: q' u! I# q
- #include <mach/hardware.h>
* f& D$ F; r, r5 U( |& g - #include <mach/irqs.h>; d1 o7 x; \* ]3 N5 k8 b* [6 |
- #include <asm/hardware/edma.h>, d7 Y$ E9 s9 @. e' i+ Z
2 q8 R" t. P( H( b- D; H- #undef EDMA3_DEBUG/ x$ F. P/ q. p; X1 L# p i
- /*#define EDMA3_DEBUG*/* w" \5 \7 z$ H; N
- ' n/ j" W+ C% y8 F# c" a
- #ifdef EDMA3_DEBUG
4 S+ {. B7 \, \9 ^- ~6 X, H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 n& u4 t. o% x0 a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 b5 g d$ A# ^$ @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. }! i: t) v. C8 c( Z2 f# \ - #else
! h* d+ L4 n1 H: A) | - #define DMA_PRINTK( x... )) J1 B) I* i6 V3 t" t
- #define DMA_FN_IN3 v) @% L3 _* }
- #define DMA_FN_OUT% |( @' D( M9 E3 F- X! X+ X
- #endif
0 H- @6 L P8 _) m C" j! ?
# n q( O$ R' {' L% t- u8 x7 R( L. t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 U! V: u1 Z2 J7 u0 T6 H( O A
- #define STATIC_SHIFT 3
% S9 Z, H( t* t0 K0 \ - #define TCINTEN_SHIFT 20( i, J3 o3 }2 Q) o
- #define ITCINTEN_SHIFT 21
$ R. r6 ?5 d7 X) B! H) e - #define TCCHEN_SHIFT 22! T# g8 H8 e8 B: Q2 f" T9 E/ w! L M* l
- #define ITCCHEN_SHIFT 23* i1 h8 T: h+ t; F
7 s1 D5 ~8 b2 v. }4 i- static volatile int irqraised1 = 0;2 f1 \/ {3 V2 D. p
- static volatile int irqraised2 = 0;
/ e- T2 S6 I# x1 I+ s, P# [+ t. s - . [" z+ r- `# v K' l+ B2 w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# F w& @9 B- G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 S$ r0 d8 s, i4 C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: R, e. w/ I2 v
1 M: x; [! m- _, Y: b( F. `- dma_addr_t dmaphyssrc1 = 0;# R8 d/ {% |/ a. {
- dma_addr_t dmaphyssrc2 = 0;
0 y) q# X; B6 y3 X$ s, r" e' d$ d - dma_addr_t dmaphysdest1 = 0;
6 Q% A- t! J \, D9 X - dma_addr_t dmaphysdest2 = 0;
* T" ~$ ?; s' k2 D1 M
6 z' `% V8 g. R) n# g; g9 X- char *dmabufsrc1 = NULL;2 A Y; s! z/ z! V- V5 M
- char *dmabufsrc2 = NULL;
" l& J- u$ s) C/ X0 k - char *dmabufdest1 = NULL;
) k: g7 A" Q5 P W6 e - char *dmabufdest2 = NULL;+ Y& m$ r) z+ t) `& U4 z0 X4 C+ |
- , Y# C. g2 |# f2 F4 Y/ |) t( v; Q
- static int acnt = 512;- R: d' A& d# c2 I! V( ?6 Q
- static int bcnt = 8;) D) H" _. }0 x$ |& \: P
- static int ccnt = 8;
4 F& ]$ e0 i; R3 p/ j6 j# R - . a T+ J' ?) z" m
- module_param(acnt, int, S_IRUGO);
. c# ?' f$ I5 l& U - module_param(bcnt, int, S_IRUGO);6 C9 @& Y9 q7 @, O
- module_param(ccnt, int, S_IRUGO);
复制代码
) P- P" z) n/ U, Y" C) w: S! s* K/ J* X6 |! Q4 U7 A, ~% w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 W+ i$ p/ j, L7 n+ o' j4 O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ c+ w2 j D3 \; r2 A D$ \. n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
q; {% m1 L, i; |$ L; L2 k/ u8 P6 u* ?3 d* B6 ] [9 C
: {; y J. ]. ^; |5 D |
|