|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, q* p) N7 f8 t6 r) `/ M7 |2 Q- [code]EDMA sample test application
0 Z) a1 M z. @ - /*6 D6 A0 u" V5 ^- D8 R6 C! B
- * edma_test.c& i) G* b( m% d/ C2 w2 O, k7 [
- *
% ]* k, b: K6 { - * brief EDMA3 Test Application
( V+ n/ Y3 ], E: Z - *1 M3 u9 T' \0 R
- * This file contains EDMA3 Test code.* U+ \5 R7 T4 L* H/ R5 C
- *+ X2 a7 x; L: [1 Z& @; }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ T2 ?- q4 C$ L. k e1 j/ Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 Y1 C" f9 }% M6 g* `' ]5 \1 j
- * TO CHANGE.
, h* S0 x+ L/ ]# g - *# W* Y* `7 @( z3 t; r& a8 a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! |& x; x* s) t: N, F) G& N# Z8 n - *! y( `0 x# h1 M7 u9 A( |
- * This program is free software; you can redistribute it and/or" e0 _9 Y; H+ ?, d
- * modify it under the terms of the GNU General Public License as2 {$ N! h2 H9 @. s" w& H4 c
- * published by the Free Software Foundation version 2.
. k! n8 |$ [; W7 [$ e& Q! f$ w - *" I- C2 l9 \! x- ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( \) Q1 N: \' ]; w
- * kind, whether express or implied; without even the implied warranty
( r5 @5 j; |! l( |0 {* g) W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 ]9 O( b7 f3 b% S e' I' m
- * GNU General Public License for more details.1 B, x% z; ^1 R$ e8 j* L! e* _; k9 Z
- */% Y' W& O, O/ H8 {8 d3 |
- * {! B ?8 N* G3 x- y5 Q
- #include <linux/module.h>
4 ~( W. k u# ]! N - #include <linux/init.h>5 q. a- r3 E; x' T9 g% B. W
- #include <linux/errno.h>: i5 t7 y. g; r9 _0 p
- #include <linux/types.h>8 l2 ~/ x) }2 w7 d% j: _" t
- #include <linux/interrupt.h>
/ t+ Y' v" n, ]% o+ \ - #include <asm/io.h>4 P ~% N% g" o; P5 N* ~
- #include <linux/moduleparam.h># o# i- `6 n, q# P, z* v* p- _
- #include <linux/sysctl.h>
n- ]- ]* T' ^2 v* ^( C& R - #include <linux/mm.h>0 r! O# r7 v5 F
- #include <linux/dma-mapping.h>
! H) d+ X7 Y& X1 {
/ i: H: O3 {8 p, q6 W5 U4 B- #include <mach/memory.h>
8 u: a+ {: M, `! G- [ - #include <mach/hardware.h>+ _2 B5 A0 Z0 [4 D
- #include <mach/irqs.h>
b- p2 J. g! G2 H6 _' l - #include <asm/hardware/edma.h>
' g; ?7 c M e, p% H; r$ t& ? - / t+ E$ Y, q2 _& r$ p/ F5 ?
- #undef EDMA3_DEBUG9 B1 E9 D6 S: L
- /*#define EDMA3_DEBUG*/
+ z. i0 a0 U8 n - & q3 G6 p# d. X% G0 H& |9 c
- #ifdef EDMA3_DEBUG% k, u- m& h, q- [8 w Z& j5 g) b% j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ Y; `" s" R2 s/ q9 K" N- s! P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# i9 ~" m4 Y; H) [& z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 g& x2 r- L( \$ m - #else8 f: e% X/ N4 }! B. g
- #define DMA_PRINTK( x... )
) s- S- a% q1 K* E& E/ q& i- B - #define DMA_FN_IN
" k9 d Y9 }4 \2 \# J! ^9 |0 d5 T - #define DMA_FN_OUT
. z( }, @0 |' O+ }: H5 \ - #endif
. d1 h7 x. Z4 v9 ~1 h
% ]1 M' ^; k3 e" G$ |, p2 E$ S6 v6 P- #define MAX_DMA_TRANSFER_IN_BYTES (32768); b V4 T) Z6 e
- #define STATIC_SHIFT 3
/ S. h* {- p, b+ v - #define TCINTEN_SHIFT 209 b( `; B n$ y o) B4 G% A
- #define ITCINTEN_SHIFT 21& {& @3 Y: q: d( V0 Y0 f
- #define TCCHEN_SHIFT 22
( x. z. T j8 ^( x" ^! L$ b& Q$ t - #define ITCCHEN_SHIFT 23
* j$ `/ _: h6 j) ~3 v& g" b% {
9 e! B' `8 K4 a7 F9 i- static volatile int irqraised1 = 0;
/ ]# I2 v9 X! C& [0 J1 {. s# j1 \ - static volatile int irqraised2 = 0;
0 m, p, o6 @+ v9 I# y3 e9 I' p l
0 c2 w: H% ?& S4 `- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( t: R5 j9 t$ |) V4 ^2 S* \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& M6 y k [ p6 H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ~9 Z6 A" X! j' A k+ S% Y, J
' o$ ?( u; s. O: ` ~) q- dma_addr_t dmaphyssrc1 = 0;
5 Y9 V- n8 L+ ?) a7 a$ u/ O - dma_addr_t dmaphyssrc2 = 0;
! L* P6 E8 t0 K5 o$ {3 b5 r D4 d - dma_addr_t dmaphysdest1 = 0;4 @" k- s# y2 s0 X
- dma_addr_t dmaphysdest2 = 0;
0 I7 V% k/ m1 [& {) [4 k! G - % z" N5 ~- x4 Z# l% R8 ^
- char *dmabufsrc1 = NULL;
}( ?$ H8 ^+ S' e9 V' M7 J - char *dmabufsrc2 = NULL;* q. `* o4 |+ P7 H1 ?9 ]) Y- c
- char *dmabufdest1 = NULL;* m% J7 o1 @+ U8 L4 b: E
- char *dmabufdest2 = NULL;8 [) W/ [! }* G
- p0 T: G2 T, v/ F$ Z% T- static int acnt = 512;0 _: I# P# ~6 Z2 c
- static int bcnt = 8;
& q7 S4 C2 V: E$ I, b - static int ccnt = 8;* Z( n( g$ @" z4 u- H, N* l! a
1 P: }) ~( A7 e( ~8 y- module_param(acnt, int, S_IRUGO);
9 X) Q w6 t: Q+ z( i7 b! ^) r - module_param(bcnt, int, S_IRUGO);% K" _. X* `/ ?, |. L9 A' q
- module_param(ccnt, int, S_IRUGO);
复制代码 " g2 i" }7 ^; @
' e" t j4 c0 \) s3 o9 A# ^# g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- \4 Z) w4 D+ C& B5 k5 {: @) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( I$ J& m5 i; Q$ c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# d4 b7 P! x7 Z+ d7 ]7 T. O' y1 A
" q5 x. B! Q, K4 z% q
7 X" ]; k' [/ `; i3 m; ~5 f1 V |
|