|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! } H" c* s3 v1 Q8 v O7 f1 |
- [code]EDMA sample test application
2 K* p. Q# w8 U ~' R K - /*2 I7 x8 ?6 w1 B7 q+ A
- * edma_test.c' r" d1 S1 d8 q5 Q8 O* z
- *
4 ^; v9 v: K$ F* e - * brief EDMA3 Test Application
: m) K* k" `% ]7 P9 N7 O1 E/ @ - *
) x D* h* I; b, |6 x# M - * This file contains EDMA3 Test code.
: h% L1 V; w( ]; b! a0 d - *
6 E+ c) j9 k9 p9 N7 R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 q2 B9 v4 x/ E7 B; w: ?4 |/ r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, q6 ^3 t0 u7 ^5 H - * TO CHANGE.
2 t9 ?. G \7 g1 ?6 N" P - *0 v$ ~, J+ ^; ]' |/ A. k2 p% b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ ?9 L$ C/ ]. P5 G' g1 G1 C0 U, I
- *
; P0 f/ y# M% d9 @0 E - * This program is free software; you can redistribute it and/or
# ~9 P) S3 W2 r: d2 ?% F% y/ ^0 |% X' @ - * modify it under the terms of the GNU General Public License as
1 R! B! C: [ M - * published by the Free Software Foundation version 2.
! P0 k$ G1 }! Z n$ r2 i/ \ - *( h4 h h1 z9 E( y1 O; V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 q; @9 ?: \; D. V$ u& p7 o
- * kind, whether express or implied; without even the implied warranty
6 S/ K: Z( \4 e% b# I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 }3 _3 J1 \, l - * GNU General Public License for more details.
P( m# B! ~0 C8 ?3 d - */
8 F) Z6 C5 e# w: t - * K* A/ n: _0 D; f# h
- #include <linux/module.h>7 Q7 I7 y! M8 v6 P1 h4 g
- #include <linux/init.h>
- Z% a, C' o, a9 H# V - #include <linux/errno.h>
2 G' G# _( C; g! W/ j( m" m9 q8 U0 [: o - #include <linux/types.h>
+ w! G" d3 D) O8 r& ?2 E% x' N+ v - #include <linux/interrupt.h>( ~5 r5 t2 s% V
- #include <asm/io.h>
# N) e: C6 u- N/ b - #include <linux/moduleparam.h>, ?" f# B3 [% N7 E
- #include <linux/sysctl.h>* s! a3 L+ R6 ]$ J6 k+ w. C
- #include <linux/mm.h>
. C5 k/ q9 i- R% {. t( } U; D3 Z - #include <linux/dma-mapping.h>
1 l4 S% N: c5 o3 L; e4 P0 s9 ]7 Z - # o& O3 B* ]( V. k( D* m
- #include <mach/memory.h>/ i) a- d m0 z- |
- #include <mach/hardware.h># h" d0 i" G5 w+ v; G
- #include <mach/irqs.h>; q, j0 a/ B( R
- #include <asm/hardware/edma.h>
$ L9 [9 K$ h4 s - 9 v0 k% l) \- K8 s6 i
- #undef EDMA3_DEBUG; C, [& |7 m. F) C( w, @1 b% Z
- /*#define EDMA3_DEBUG*/
# y- w H: l5 e" K& h2 Z; W - ' i. ^( o. E/ Z6 Q1 ?
- #ifdef EDMA3_DEBUG& [% U+ [, R* w* z8 c) V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 P& F! ^; r1 f8 K: `8 G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 Y2 |/ G. C1 U3 ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); v$ d) A, M1 P
- #else
2 B' L; ?7 C+ Z$ f4 a% t - #define DMA_PRINTK( x... )
/ y7 s- t7 f! ]7 ]% i7 w3 g - #define DMA_FN_IN$ d) c: Y1 a$ g& y- r
- #define DMA_FN_OUT9 W' p2 B2 s/ t$ v9 A2 a% \
- #endif
A. X& ]; j8 c8 Y) e# m9 q
3 j$ Y3 ?& B ?. h% Y5 x/ N- #define MAX_DMA_TRANSFER_IN_BYTES (32768), H" |) G0 {7 V( G/ B" z0 `
- #define STATIC_SHIFT 3
/ ~ R" ]/ q: ` - #define TCINTEN_SHIFT 206 a6 V" Z+ w9 k! G5 K/ m! D
- #define ITCINTEN_SHIFT 21
5 b! F. ?$ I) q# u6 _- |/ V - #define TCCHEN_SHIFT 22$ A1 e7 d7 M9 q9 I+ U
- #define ITCCHEN_SHIFT 23
1 g/ T' _+ s5 D
1 u: I N& v$ g# N- static volatile int irqraised1 = 0;
5 H9 V9 L+ c; V; { - static volatile int irqraised2 = 0;& R0 r" d5 }4 U, \9 }
- * b' N/ _: H( L4 C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) n# {. g J3 ~0 x# _! p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
d& }% n/ l! r! T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; k- |0 X- a! _& x& F0 V
- / O6 A8 w( O! e: ~( t9 Z
- dma_addr_t dmaphyssrc1 = 0;) ?7 e3 Y; m2 C( ]7 f+ ?
- dma_addr_t dmaphyssrc2 = 0;; t! ?' Z" S6 S$ r7 l* K
- dma_addr_t dmaphysdest1 = 0;& F1 M+ _* ?) F
- dma_addr_t dmaphysdest2 = 0;. S% x, K1 A/ w/ P, a& z
. S1 h) Z4 Q0 V h- char *dmabufsrc1 = NULL;' z; s u' R, M& Y& c, h
- char *dmabufsrc2 = NULL;6 ~/ F# k2 b: e5 h, ?6 A: l& I# O
- char *dmabufdest1 = NULL;4 J- D6 i Q: c! Y |/ R
- char *dmabufdest2 = NULL;
& J: Y+ p# V6 Y- g3 l3 N! R2 e
& W3 ^% _7 c/ Y: j( Z2 ~3 l6 O3 x* V- static int acnt = 512;; p; J3 i1 i3 g3 W1 B6 J- d
- static int bcnt = 8;
0 t$ A; W1 Q* d- g6 N# K) o - static int ccnt = 8;
/ H2 R! o% u5 d B0 B/ g! P6 r4 R8 g
# Z$ {3 z" `- k* `/ m! t* M- module_param(acnt, int, S_IRUGO);
6 C6 T% y: |. K9 e8 {: W' P3 G$ J - module_param(bcnt, int, S_IRUGO);0 P2 e/ n8 Z% A+ Q1 _0 J
- module_param(ccnt, int, S_IRUGO);
复制代码
* }# }; p3 g' g9 H* E N6 q: E9 s
- Y/ C8 x7 `7 @0 g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 \1 h$ p7 \& I& h" S
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 d$ ~3 }2 C2 ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. Y( M! ~4 \& z! L" a
& g9 X; c. a! Y( q. D `
9 j4 Y* f R+ Y9 y" w9 f
|
|