|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
l* C6 o# [* i5 W- [code]EDMA sample test application' g" S9 x& O. a; B/ j
- /*. g6 Q: j) p' e9 e% e
- * edma_test.c( U3 |( Z; t7 {4 D. F1 g4 @
- *; ^) |" p4 f# s! V7 e2 d/ ?
- * brief EDMA3 Test Application
8 _9 [, m8 P. s8 s# M& j - *7 K. t( A4 C1 J1 ? H7 h
- * This file contains EDMA3 Test code./ \% U% Z6 D3 Z2 a6 C0 p; r; Y6 q
- *9 ] g5 F ?) O2 V% g% i! b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! j) v q7 I4 L1 V* C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 S, L& N/ V, e4 G
- * TO CHANGE.
+ M' y4 I2 m3 B2 y* ^ - *
. p5 `5 a! F" f4 r6 k& H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 F' J: S* C1 ^% K - *; ?0 K# C7 Q" g7 D! H
- * This program is free software; you can redistribute it and/or
( y! D2 z$ G l$ O) n) N - * modify it under the terms of the GNU General Public License as$ }% V* Z5 j+ ?* Y7 o# P
- * published by the Free Software Foundation version 2.
2 q' d, m3 s5 g0 P: t, o - *
3 a3 d1 `" L5 I; g; L, }2 Q* [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ `% I+ Y; I0 U1 b; S/ D8 \/ k
- * kind, whether express or implied; without even the implied warranty
/ d: G0 L$ z& @- K5 m: i8 T! M) _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 |, h& f, V% ~! U - * GNU General Public License for more details., F) f1 q$ h! K/ g
- */
1 `1 u. _+ W& @7 ?
" q: ~4 w+ E, ] {: c2 Y- #include <linux/module.h>
+ a+ \) f% o& K7 { - #include <linux/init.h>0 ^" q2 F! t- Y0 ]
- #include <linux/errno.h>! s# I! b) p1 W! }
- #include <linux/types.h>* s+ R" E6 F+ l5 H
- #include <linux/interrupt.h>
0 b) K& G- l# A$ C8 R9 w - #include <asm/io.h>
* I0 X+ C) ~* o2 A& s/ c - #include <linux/moduleparam.h>3 O) t+ C$ Y; G0 n* a& |! ? t. e
- #include <linux/sysctl.h>
* j6 z& d. I, K - #include <linux/mm.h>" D, n$ s# s+ e3 g3 v4 X4 E+ C' Q
- #include <linux/dma-mapping.h>) x; \; s8 C0 Q8 h+ {6 c+ A
- 5 D* ~- r* f' R z0 `$ m
- #include <mach/memory.h>/ L ] k7 w: l5 i
- #include <mach/hardware.h>
9 r: k" o3 [4 S3 @: t! y- x - #include <mach/irqs.h>4 C- r: X9 o8 H. c" l6 t0 H' {
- #include <asm/hardware/edma.h>
4 @) O4 F2 o1 x( {3 j/ {, X - 7 e' C3 h( L- y+ i/ b
- #undef EDMA3_DEBUG, i* I! @, |" z& @4 ~
- /*#define EDMA3_DEBUG*/$ K! J7 d; e1 M8 I$ p: b
) S5 N' Z3 p1 s- #ifdef EDMA3_DEBUG
7 O& v' @3 L" p' C" b6 K2 v* O3 S. n* B- Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 ]- S6 K8 L5 i! [0 i7 A; X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& O# j; n* e/ u: U) | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 q) U; z4 M+ n/ ]2 I
- #else3 _- P1 w4 G& l; N. [' i, N- x
- #define DMA_PRINTK( x... )
8 W& r9 D: [& Z; s$ ^* Q: j - #define DMA_FN_IN
- Y! [; \/ l# C& u" F - #define DMA_FN_OUT4 s) U( f1 J/ Z! P
- #endif& g" G) s* z! Y, v" \5 X
6 j! m2 P% L/ [! f" }" x. Z0 g1 B7 J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 ~6 ~0 G; z# I. J$ y2 t - #define STATIC_SHIFT 3
( z* `1 j1 b& C& W/ s/ u - #define TCINTEN_SHIFT 20
) t( _3 B. j# E2 N% q - #define ITCINTEN_SHIFT 21
2 |+ c& m( [# _ - #define TCCHEN_SHIFT 22
# a! N# Q; g7 y3 v4 }0 T - #define ITCCHEN_SHIFT 23
; @* { r; s5 k( {. t; K) @" w - * r' ?2 Y7 l9 s0 f) r8 P% R% _9 f
- static volatile int irqraised1 = 0;) C5 Z- ^. Q; `6 K* B9 L Y* q
- static volatile int irqraised2 = 0;- s$ Y2 K1 m4 t3 q- E9 M+ p* Y. x
" A/ x: }4 ^1 L1 W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 A7 M m3 X; T' O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' R7 \6 D* y1 x" p% L0 M, d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ W# d! G) T+ T- r) g
' r7 `( h% L$ K- dma_addr_t dmaphyssrc1 = 0;
8 m& `& Z. o- q# ?8 ?% C% o - dma_addr_t dmaphyssrc2 = 0;
8 G% t, I- A {7 }8 t) } - dma_addr_t dmaphysdest1 = 0;
( {9 u( ~5 X n& D8 e. S [ - dma_addr_t dmaphysdest2 = 0;, k: V [) ^* X3 B7 S1 k0 u
- # \3 p2 M' H o* U3 ]5 _/ _
- char *dmabufsrc1 = NULL;
+ J* e: a1 [! I! }' b; q1 V ` - char *dmabufsrc2 = NULL;9 e5 e2 J' L" v. f3 N8 ~$ h) V
- char *dmabufdest1 = NULL;
& A: [; b" W; T2 { - char *dmabufdest2 = NULL;0 n& f! }2 O% w y7 O5 F/ P
4 Z" v% L @* k% y4 }- static int acnt = 512;
! p) d5 N3 n* r0 F$ g0 d - static int bcnt = 8;
+ I; t% t0 O5 \ - static int ccnt = 8;" u) W5 e( R( _% ]$ z7 N. \
# @4 [2 W8 p2 ~3 }/ Y% R1 W7 _- module_param(acnt, int, S_IRUGO);
4 h6 b. x& j. j7 { - module_param(bcnt, int, S_IRUGO);& k' B3 i9 C$ T7 y5 L- i# t
- module_param(ccnt, int, S_IRUGO);
复制代码 ) f' ?( b# b) b$ q* v
9 G. [( ~0 f* c& I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 m2 A- ]! n4 R0 M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 l. y7 Y9 E, `9 J8 ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) @( N- J- M& G) h: V5 R" J2 c7 a2 w3 ?4 G* b2 A$ r2 n& t
" e' i) B3 P4 B% }7 `/ e8 E |
|