|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" |, ^2 P# u' f4 h- [code]EDMA sample test application$ d# ^! t, z7 r7 I$ n
- /*7 n" c$ }$ p# i! q
- * edma_test.c
" O- a% {4 l ~. O+ | - *
8 u U% {1 B( W2 F - * brief EDMA3 Test Application$ f) e1 j+ `" m5 g0 j8 j' a6 i
- *
/ t4 F/ `$ x% w( S- ~ - * This file contains EDMA3 Test code.2 t' ]3 p. r6 m% C
- *( D! d( \1 z' W# B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" h( u ~6 e; Z3 E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 o+ |( d9 W& ^7 w8 Q! b
- * TO CHANGE.
7 F5 ^) a6 K8 E( @( _/ f - *; ]# I% |& J) j8 w( Z( v/ g2 r. p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 }( {6 E$ p5 z5 y+ j' ~/ P3 w1 t - *6 t. w* |) d: X9 J; S3 j! q. R* O
- * This program is free software; you can redistribute it and/or% `* y- c* h* T/ g
- * modify it under the terms of the GNU General Public License as
( Y; p( I3 z9 O: M; f- F - * published by the Free Software Foundation version 2.
, r/ S0 T( |6 H) j - *
6 z* S$ D. z& M+ V2 m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: a# z! g7 @: x; c& f+ H$ }3 O: R - * kind, whether express or implied; without even the implied warranty1 @) F3 e; X7 z4 e5 y! E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- G( o2 G7 ^" ^ J - * GNU General Public License for more details.- h3 z! l, [% }3 M$ N
- */
; Q* w* L4 {% {/ n Q' @5 \, c - f3 I( Y6 u4 N0 I9 o
- #include <linux/module.h>
3 j" R! d. H2 h$ p- R( @ - #include <linux/init.h>
% }0 \$ S: x& A& s - #include <linux/errno.h>. L1 F/ D# ~. W/ H% V, H4 G
- #include <linux/types.h>
9 t. G+ M) p# c% c) k3 p% @ - #include <linux/interrupt.h>0 w' y: R5 i1 X6 S5 o, w |! w) |
- #include <asm/io.h>1 R1 X' h6 M: A8 k- y" X
- #include <linux/moduleparam.h>- q* z+ W4 @- Z, e7 T
- #include <linux/sysctl.h>, Z1 ]. e0 R0 G Q
- #include <linux/mm.h>
& x7 U& h5 T. F1 p! R0 `6 R - #include <linux/dma-mapping.h>0 T( m# ]/ U+ ?; x
- 9 u x5 I% J* a2 J
- #include <mach/memory.h>2 e4 I1 I2 ~4 ]. ^6 ^- E3 O
- #include <mach/hardware.h>
* v2 w y. o3 W( t7 k" { - #include <mach/irqs.h>
! D: U4 A2 ^% u; T5 Z, K) U* a - #include <asm/hardware/edma.h>
' a1 }, D8 f3 Y9 Y5 T/ N - 8 x: K" N5 Q+ R' C
- #undef EDMA3_DEBUG
, y1 z( A( f' F* Q! c7 d5 k - /*#define EDMA3_DEBUG*/
- U4 U2 j7 o( B% m - ; z6 z, S, K$ |( W' \ x. S
- #ifdef EDMA3_DEBUG3 y4 [ m# ?3 Y' O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) a( ], v/ b# Y+ v Y6 m! v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 N& V0 p/ x/ Y, N- ^$ l5 b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 ~$ M& ]) B4 c$ R/ ]1 m - #else+ O- V% A* t+ X/ O0 Y: v
- #define DMA_PRINTK( x... )2 L0 q1 s, C5 Y1 }% a, P$ c( X" y
- #define DMA_FN_IN
) x: m5 ]0 \) J( t, Q7 S - #define DMA_FN_OUT, X) ~6 G! G `8 i8 N! v
- #endif$ q/ ]/ I6 d8 F3 h
+ |, F# ^7 I+ t! p) c/ i- #define MAX_DMA_TRANSFER_IN_BYTES (32768) O) M1 u7 H9 e! h1 u# Y
- #define STATIC_SHIFT 3" }4 n o! L8 }: ^% l: m
- #define TCINTEN_SHIFT 20
) o# F n- ~0 |* Q1 M - #define ITCINTEN_SHIFT 21
: s& z0 r4 y; v* [0 g4 z& U - #define TCCHEN_SHIFT 228 i7 r3 p ~6 C+ N
- #define ITCCHEN_SHIFT 23! u, s& i! V8 r# ^
! h; w4 K% w8 b" l- static volatile int irqraised1 = 0;! S( K. q3 ]2 f6 k( z
- static volatile int irqraised2 = 0;5 F, M5 T( c! C/ \, |+ [
- [7 ?+ x) o2 ?& a9 _7 n4 |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Y* r) s: z+ `* R' ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 E! | c: b+ g! i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 a. ~& I& \( a# J E2 W ] - * k+ Q3 L, Z- y+ j8 Q
- dma_addr_t dmaphyssrc1 = 0;. I: S0 ?. V. `9 {. g/ j5 u5 S
- dma_addr_t dmaphyssrc2 = 0;2 C0 l+ M" e2 o6 B' C1 g
- dma_addr_t dmaphysdest1 = 0;& q6 N# e- s; o& w4 s" h
- dma_addr_t dmaphysdest2 = 0;
5 N- l" X2 z0 I8 [9 i
) k- l* e! s* K) k2 M# l4 e- char *dmabufsrc1 = NULL;
, u5 o6 w0 h0 D* ]* h6 N - char *dmabufsrc2 = NULL;1 r5 e4 A2 [6 } |, l6 p) Y
- char *dmabufdest1 = NULL;6 ?# H! W0 ]. F- ^; y- F$ H; q+ u
- char *dmabufdest2 = NULL;+ t# {) |; F) w
- % e) t1 c8 I$ k& B6 o4 s
- static int acnt = 512;3 h5 G, [; y- e L! x* R! D0 a# v4 j
- static int bcnt = 8;
6 {* L# j% f* b# c1 V& b - static int ccnt = 8;" S' s% L- }8 \1 C6 T
- _. j" L6 l# d& L1 @
- module_param(acnt, int, S_IRUGO);+ T7 n; V: j5 B9 Y% {) p( S1 F @+ S
- module_param(bcnt, int, S_IRUGO);
! G z1 A4 v% T/ u- P: {. V - module_param(ccnt, int, S_IRUGO);
复制代码 7 @$ R0 ]: G2 U3 _
9 e' h' p/ m" n" C7 O+ S' c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# w! o$ M/ R' P, i/ H( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* E' H" s& ^, H5 b- Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 p4 l+ n; u ^5 L, R+ ^' g
# ~& o3 _$ L9 W, }5 D& W6 J
' W9 g7 N3 `+ g* C5 ~( e) J: w |
|