|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ g& c9 @5 O" |' f- [code]EDMA sample test application) I8 Y) Z0 c1 r
- /*( [6 G9 Y6 V9 L& q) S$ X
- * edma_test.c; H4 M/ P7 _6 A9 `' Q# j
- *9 l8 S# U8 K" d
- * brief EDMA3 Test Application$ G3 @1 Q. p1 I- c3 M1 k% Y3 O# n3 i
- * o0 E( @7 E* {8 o
- * This file contains EDMA3 Test code.
" I& w0 f' ~0 ?) m0 { - *
" m6 v: b5 }, ^( O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# t% q% r. @9 _6 [& ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ X. A1 I. g \# p8 R" C) x2 [% r - * TO CHANGE.0 A3 R9 Z3 T( N2 C+ E- R7 L7 I
- *) d N. D4 }/ ]0 C+ ~- w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' r+ B! A& U V; i# w% |( D - *" h0 e; }% P+ U2 A* O5 z
- * This program is free software; you can redistribute it and/or
+ W1 \. N$ P! u O5 P - * modify it under the terms of the GNU General Public License as
4 W' c* o, ]) N - * published by the Free Software Foundation version 2.! @0 Z% k3 ]' R8 j& k$ o) s
- */ M) i: S% O4 b0 m& m+ k) K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 u. D5 z2 S1 K$ r! O3 ^+ A
- * kind, whether express or implied; without even the implied warranty
. R3 v8 r' {3 Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% T9 v9 Z4 b: f - * GNU General Public License for more details.; |+ b* e' @# V
- */
# t* A% e0 v* h2 h
6 _8 f+ O5 z0 W) _4 c* k6 V- #include <linux/module.h>3 h" S j. K) g: p( k0 u* m
- #include <linux/init.h>
- k2 M1 \% ~! X; q; a/ J% u1 y7 x3 X* ]; P - #include <linux/errno.h>
' {2 n7 g* v6 \" a, ` - #include <linux/types.h>
% B- N$ l3 h2 ]! W/ v - #include <linux/interrupt.h>
# t( e1 |, Y3 \: r - #include <asm/io.h>
% `0 M" l/ C- L3 H( g - #include <linux/moduleparam.h>+ \3 L, Q) d: J5 @! U
- #include <linux/sysctl.h>
?0 J& r; L' Z% G8 k% { - #include <linux/mm.h>7 L* v6 A# }1 M% q0 R/ ^
- #include <linux/dma-mapping.h>
3 b9 c6 d x, d' [/ A - . ^" z1 h, G$ m$ [5 a
- #include <mach/memory.h>: w* \* n- B+ @9 w! t( J6 n
- #include <mach/hardware.h>* g6 A0 Z+ i) ?5 B+ L3 U7 |
- #include <mach/irqs.h>4 n5 j* l4 g5 g$ z5 K& d0 ~
- #include <asm/hardware/edma.h>
! N; P1 e' y) r* k! E: k
# X7 ~3 v1 c" T$ V2 e, ?6 C5 h( `- #undef EDMA3_DEBUG
N3 c* b* [# B/ M+ |. h - /*#define EDMA3_DEBUG*/4 N' V$ z8 o4 K8 @
2 `! A J* G5 r9 Y; {1 s% [- #ifdef EDMA3_DEBUG+ V5 `& ^' B$ Q) @! S8 c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 [& T3 x2 E, u& D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 i3 _5 h# d( f. e; q* [" x. t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ i" U' H" m# E& c4 K- p" a6 r
- #else$ @/ v9 ?9 ^) _) u0 A/ K
- #define DMA_PRINTK( x... )' e" P+ k7 t9 n; U/ `& n
- #define DMA_FN_IN
' j' t2 M6 F' V# o. ] - #define DMA_FN_OUT
2 X5 N- H6 `/ _ - #endif
9 A% c' a) {# |8 I+ `" o& R
/ C/ C, ?4 v2 b6 {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: }! k% W5 d4 z1 r$ T, y5 m - #define STATIC_SHIFT 38 G; p+ R2 t+ J+ Z3 S
- #define TCINTEN_SHIFT 202 }' C2 b# p, Z3 _" R: a$ k
- #define ITCINTEN_SHIFT 21
4 U& a# y6 Q9 m3 k - #define TCCHEN_SHIFT 22$ T! Z0 v* t: @" N: G$ V# E
- #define ITCCHEN_SHIFT 23
- j. f7 S) \$ y3 W$ i; @7 v - $ a( j& [0 o2 n O5 I$ O
- static volatile int irqraised1 = 0;
8 k' c! S: _8 u% ] - static volatile int irqraised2 = 0;
; P g/ ?9 h" O s( L- P
6 U) H3 \* V* `4 G Q' P! y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( U& I v( `' I3 R: _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ r2 t N# N- a) ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 O$ [7 m! X x1 c" j
) L S- j, I" p+ ^+ ^+ S- dma_addr_t dmaphyssrc1 = 0;
9 c5 u9 v) G; Q - dma_addr_t dmaphyssrc2 = 0;
3 p9 M4 D' |3 i* | - dma_addr_t dmaphysdest1 = 0;
9 c% v4 R& M4 u' o - dma_addr_t dmaphysdest2 = 0;
* M! V; q/ m/ }* Q) \ G - ' E5 U6 P3 T2 y* `
- char *dmabufsrc1 = NULL;9 z3 H/ q- O0 K6 g& J
- char *dmabufsrc2 = NULL; s M, g7 }. j0 |
- char *dmabufdest1 = NULL;
1 Q8 i3 e+ }) w+ b, X# l4 u5 ~ - char *dmabufdest2 = NULL;
, c# F- F7 [1 R) O) x# P - ' ]" J0 t7 U/ }. }5 X
- static int acnt = 512;
( P* o- ? |+ V r1 g0 ? - static int bcnt = 8;( A6 R8 G0 {7 R: G( D
- static int ccnt = 8;* ^5 p ]6 c9 }& M1 c4 G3 S
- 5 m* l' }; r" k$ x
- module_param(acnt, int, S_IRUGO);
( U& b. [# i' \, Y# x) n& z- k - module_param(bcnt, int, S_IRUGO);
, v/ _) b, t& l n% s; e* o, U# Z( f - module_param(ccnt, int, S_IRUGO);
复制代码 ( [. x# x( C7 I M6 N
% T; b7 ?: P6 c8 {* |) w/ Q' K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ `9 K; v; B# G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 {! N* `7 k$ o8 S, H5 ^6 E* M* | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 O6 j; y R- s4 E) g0 K# c
& v& w; g% Y e- }
+ m9 f) E S* H4 h
|
|