|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. _- d4 S, r: }- [code]EDMA sample test application( g8 N0 `5 g* \" {1 G- h6 y
- /*
/ v/ r* I3 E, P7 ?3 M' n - * edma_test.c1 j% i! H' b0 b5 S; r4 c/ c
- *$ H% P: V( x9 g. C! t
- * brief EDMA3 Test Application
& n0 ] {2 E9 x) U2 z - *
0 B+ F: H" T o5 v" n+ f - * This file contains EDMA3 Test code.
, N' l: _0 z8 y, x2 m& z6 }8 Q - *0 F* B- D- D, @5 P1 P! o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 m; d$ G V! t* P# U5 S8 h- l r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
v! G- N3 d2 T' }1 Z; [ - * TO CHANGE.
]$ j2 ^! r$ N/ z - *1 ]' z) k& G' d$ q7 _. ]4 e) G, C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 B9 e( S, A4 C4 J. V, I- L
- *3 a, @4 D& y6 A5 X- u, E( O
- * This program is free software; you can redistribute it and/or- N2 T I+ s& z9 K, l
- * modify it under the terms of the GNU General Public License as! d, ^7 c# ~( I! c4 t; B# I
- * published by the Free Software Foundation version 2.2 T( F! l1 {9 y' W
- *" i2 O3 |, l6 ~. J' O- m+ ^! y( Y& {3 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 m: R2 U l# q: G! {% \ ?( V
- * kind, whether express or implied; without even the implied warranty
- O ~" e n0 }* v& G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( u" ?6 `% \* E9 j: G8 i1 H - * GNU General Public License for more details.
" E; f7 b3 w. D% ^( L @ - */
2 `- Z H; N c' ^
/ H: G; Z4 ~9 v4 p- #include <linux/module.h>
$ `) N2 T2 D9 r# i - #include <linux/init.h>
) w! `3 j) ]5 d0 q; ^. ]5 x - #include <linux/errno.h>4 v I- c4 U& D! m
- #include <linux/types.h>5 k5 f! N( C! `" R9 n& `
- #include <linux/interrupt.h>8 ^% d9 }; ^- R9 O2 \$ t
- #include <asm/io.h>
) K) g' n9 b. K - #include <linux/moduleparam.h>
/ F3 o; j! s; E8 ^6 p - #include <linux/sysctl.h>1 L" R; e5 A5 n: ~2 _9 y
- #include <linux/mm.h>- b" d; d X$ E" u: e
- #include <linux/dma-mapping.h> g2 B% e G8 h, }5 J1 T
- % T+ s5 e; m# p `& K
- #include <mach/memory.h>
' X" m( c, k" O* g& [ k - #include <mach/hardware.h>7 d! [0 S, \0 s3 b9 E0 P' M; k
- #include <mach/irqs.h>
, J7 _5 b. l8 @9 x5 }5 } - #include <asm/hardware/edma.h>
9 J" _$ u4 T9 e$ T8 i3 K+ G
* Y1 a$ u# H. \- #undef EDMA3_DEBUG: u' C3 |6 C! S* x* ]
- /*#define EDMA3_DEBUG*/
: Q/ \3 [% K/ F+ r2 h
. ?/ |% o( U& N1 s, k6 x- #ifdef EDMA3_DEBUG
# b0 @2 {3 s M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( I# X1 B% G; b5 o9 J! e$ K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ g b, a# g$ i; n) I6 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) V( m# \6 n9 J# l2 N
- #else
2 m4 h. L7 }# f) e! Q, N% n - #define DMA_PRINTK( x... ) N9 e D7 W) T, s$ j
- #define DMA_FN_IN/ ^" o, _: Q7 ^
- #define DMA_FN_OUT. ?; `& {8 ^; Z/ H4 ]3 b" {
- #endif
6 a# T$ u H7 V+ G, j - . \9 w: F. t b* q f+ t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" |) Z( Q9 E- D, f7 u0 M5 j5 d* x
- #define STATIC_SHIFT 3
% w4 F& u; ]4 m8 Z. P - #define TCINTEN_SHIFT 208 D, {9 ^2 C, a+ F
- #define ITCINTEN_SHIFT 21
# v2 p, ]' E9 |& t) N$ u - #define TCCHEN_SHIFT 22$ u: g3 y( Y( X3 X/ k# q5 f. n; n: E6 ?
- #define ITCCHEN_SHIFT 230 s$ e; @& M- c
# k. Q0 X: B; Y- Y4 k& ^) w9 u; \- static volatile int irqraised1 = 0;
. k" D- {% p& U: l& u- \ - static volatile int irqraised2 = 0;8 Y+ M: p+ Y1 P. D0 o" N6 Y* o# v# A
+ b6 Y0 H5 f; r0 q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" j v: D) U- G( y- ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ]% t6 I2 ?9 F8 N5 d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& T8 D4 ~8 g8 `: K5 `) s: u/ Z
- 4 [! p' u0 [/ x; i$ x. }' @
- dma_addr_t dmaphyssrc1 = 0;
) T$ A* L3 h( |8 @! A0 v - dma_addr_t dmaphyssrc2 = 0;9 V& C+ v0 J% L4 L# o/ n. u# N7 C
- dma_addr_t dmaphysdest1 = 0;; }/ e, n4 l, t6 J: g
- dma_addr_t dmaphysdest2 = 0;
0 m2 w. a1 N/ U% A0 c! Y
: C, W& S, |, G' ]% U& d! \7 G3 ]- char *dmabufsrc1 = NULL;/ I! J) {$ ^# e3 d' U
- char *dmabufsrc2 = NULL;
, L+ h6 \ ?8 m1 z: f a - char *dmabufdest1 = NULL;5 Y1 C! v& p8 D# e* b
- char *dmabufdest2 = NULL;
' t& {+ y" x) [& _( j5 D0 _
% S' \) k* E# Z# B7 V- static int acnt = 512;# h$ `7 x F. q3 E w: x( U
- static int bcnt = 8;/ \, b+ ]1 v5 P+ N" W
- static int ccnt = 8;
6 d* a0 M4 s1 a3 N [5 r
( P9 b4 h2 t* W/ H: j5 ~2 L5 Y9 E- module_param(acnt, int, S_IRUGO); k: h: G$ y: M, S8 w# p
- module_param(bcnt, int, S_IRUGO);
8 k; C* ?8 _/ Y( T$ T/ s - module_param(ccnt, int, S_IRUGO);
复制代码
7 F# s/ }9 m7 s$ @$ K2 d) I, Q% d6 b' |0 m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. h% k% D4 M3 R& N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 l( h' p" I2 K0 z& w; W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: K) O7 P9 N) R m# {& B4 N% E- m4 i9 e
2 ^" q$ d* N. O/ Y! ]
|
|