|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 ^1 o J2 _" Y5 T% J$ l- q6 a
- [code]EDMA sample test application
' P) H6 r( f/ n" S! g, ] - /*; M: R' i2 v# L" ]6 q9 G
- * edma_test.c) a9 G+ h2 S3 A+ R1 B9 i
- *
2 K9 K* z/ \. ]7 y; a- R+ Q - * brief EDMA3 Test Application
; L0 Z" j1 x) q! e3 s5 ~" a7 _ - *
3 w1 }' E! p0 d0 Z9 z. u5 j - * This file contains EDMA3 Test code.
) e6 ?) [ F6 M+ ^- |; ` - *
+ |0 f. W5 u0 }! c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 s( E& C" T* i2 q2 I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
n; g+ `* E h; c- `2 f( D! ~# N - * TO CHANGE.% D( P3 K( m9 w+ o: C
- *& }& o; x1 Y/ j# u5 K! t8 u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, i; C( y; n4 F% A0 S - *. m5 Q" R* U8 s( |" E
- * This program is free software; you can redistribute it and/or
0 B- j) {) B" f; E5 _ - * modify it under the terms of the GNU General Public License as
6 \: ?8 @+ I$ V/ M6 K( g - * published by the Free Software Foundation version 2.
- p: L/ s; M# @& ~& @7 H/ g - *
; F, T2 F, c; O$ b8 W- s7 r, M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" p; ~& W( I/ G: S8 C; j; _: f8 b - * kind, whether express or implied; without even the implied warranty' |. a& U" ?% C- V. p6 \# m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 L' g* a8 i" P% B/ \
- * GNU General Public License for more details.
) |" G3 \4 w4 Z, ], K }8 ? - */- X( E: l/ q+ O) Y: Q' n7 b
+ P2 U$ h# J$ g2 B# ~- #include <linux/module.h>& b: Y5 M1 x6 ~4 z: h# Y* z* e
- #include <linux/init.h>! l2 \2 I6 K1 n/ `
- #include <linux/errno.h>
' W+ v' d4 l1 M7 { - #include <linux/types.h>9 j! D: b# }/ @( q/ r& v4 |3 i% k
- #include <linux/interrupt.h>+ U, L" Z+ h2 l
- #include <asm/io.h>7 y$ K. v1 w5 U3 h, F1 ~2 |; D
- #include <linux/moduleparam.h>2 p+ G0 N* M7 n
- #include <linux/sysctl.h>* U9 A( m. \7 i, @# g
- #include <linux/mm.h>. j& L0 p. R" P% }( y
- #include <linux/dma-mapping.h>) S7 f' a6 m5 |/ O+ F8 k
- 7 }' o1 a5 z$ `% U8 r
- #include <mach/memory.h>+ n$ E9 _+ Y1 V. `
- #include <mach/hardware.h>6 V" D$ B; ^' t2 d
- #include <mach/irqs.h>
$ {5 }/ }# @0 ~ - #include <asm/hardware/edma.h>5 S$ A+ v: R/ ]& G, b: k
- 6 J, T! c, J# p/ s z6 y* K
- #undef EDMA3_DEBUG
; m# ?& d6 \/ Q0 f - /*#define EDMA3_DEBUG*/2 z, y! H$ N* Q L" F
2 o" M1 r! j* y( T- #ifdef EDMA3_DEBUG, {' B. o; X) W7 c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 b m& C2 f; }+ d7 \* \+ a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 |6 `/ H/ c* v% b- K8 h/ D" ?# d6 s: F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" s" t! {, ?* v" P O& c, N: T
- #else2 V: q! o( Q1 L6 _9 m$ K- E
- #define DMA_PRINTK( x... )0 t4 I! A6 g- B2 D/ S" \
- #define DMA_FN_IN
4 f! ?7 X% `" X4 X6 e7 g - #define DMA_FN_OUT
+ d& w; N% x4 n% s2 m - #endif
" F% T. R$ @- ?9 W# _" R% X0 Y6 r - ; G9 }; A1 S5 u9 Y3 T$ D& z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& D9 m3 m: k1 U# s2 J4 m) n - #define STATIC_SHIFT 3
" r4 e7 w1 F, F( @. Q6 n1 s - #define TCINTEN_SHIFT 20* p o+ z$ G+ u; s
- #define ITCINTEN_SHIFT 210 V$ M/ B. C! B2 i, Q! k
- #define TCCHEN_SHIFT 222 K5 i0 i. ?. h, |, O+ g5 f
- #define ITCCHEN_SHIFT 23
8 L1 u) o; ~2 r" f) z9 _, I7 { - & a/ U) B. ~+ y2 V' ?* \
- static volatile int irqraised1 = 0;
, H ] b5 [- t+ V) {( s" O A7 V: E; @ - static volatile int irqraised2 = 0;
7 _1 p2 D1 ~1 u8 P - . w! J7 [: L/ R* ?# S" P- ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 y3 q* k7 H, T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: t' S6 z3 R& H1 i& } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 O: b/ R- e0 W0 [. j! c, B
" J% x8 W/ Q$ {3 q# r* z, b. g- dma_addr_t dmaphyssrc1 = 0;) g% b& L: p& B
- dma_addr_t dmaphyssrc2 = 0;
4 e9 ^9 {) v7 i6 T& Z& w' _0 G3 D) @ - dma_addr_t dmaphysdest1 = 0;2 {5 @; C8 G. R9 F+ P f K( `
- dma_addr_t dmaphysdest2 = 0;$ U4 i- ~3 A/ b5 u7 R
+ J8 E, o1 b+ i" w1 C4 n, b- char *dmabufsrc1 = NULL;
4 N/ }" H+ u& d, ~' x4 U+ P3 p6 i0 T7 j - char *dmabufsrc2 = NULL;
) L2 l- {) w$ G8 Z, w" s. x - char *dmabufdest1 = NULL;0 D x4 Z6 t: x7 `9 o, P; Y
- char *dmabufdest2 = NULL;2 x: o1 O6 j/ r9 ^
- $ x1 l( q) q/ `4 s
- static int acnt = 512;; X8 u' B3 l V
- static int bcnt = 8;
' @2 o* }$ M5 K- }) b3 u - static int ccnt = 8;5 M- [! S/ @" r& c& r
- ! Q8 |( S Q1 s4 r; y- }( E) ^
- module_param(acnt, int, S_IRUGO);
8 s- w2 j, Y; m - module_param(bcnt, int, S_IRUGO);) K2 O. E7 j% s b6 P5 h
- module_param(ccnt, int, S_IRUGO);
复制代码
9 N8 e1 n! Q/ U- F( u1 ]* i5 S! I0 e. k# P, w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ F! o( |) x# ?* Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ g4 P/ L' l1 m0 ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, k8 T* J' Q( ^6 _# Q
) z5 q; G" ^* `+ X0 {# P8 k! K* y: U, u+ }% K
|
|