|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : M' I2 ^: ^, q; N+ _9 S4 }" `
- [code]EDMA sample test application) T; n3 v _( c, H3 f! F
- /*
& e. ~1 W; e9 Z, i - * edma_test.c
& B3 v7 G4 s) _0 b1 @ - *
7 Z$ ~( Z% f0 }9 T( c$ g6 J - * brief EDMA3 Test Application
# ?2 ~, v, x8 _* r5 j4 j - *
( I% W2 x- x# t3 h8 Y$ i5 ^ - * This file contains EDMA3 Test code. B, S& r$ B( d
- *, [' w3 |7 A2 g$ Z( h4 `* w! H* N- }+ a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ j8 p( ]1 c9 d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 [( i& }0 r. m
- * TO CHANGE./ I& ^/ ?) Z5 l+ _! m( i" B5 c
- *
, O4 r1 x6 V+ q# Y( R& } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; P ^* d9 U/ D - *
& l. |* P' s p) m- d# Y& ~* d# H - * This program is free software; you can redistribute it and/or. Y m. A& W) m$ I: v
- * modify it under the terms of the GNU General Public License as7 h) w* G5 A, M, j
- * published by the Free Software Foundation version 2.) J8 a- t) H* o1 v1 e) @ j
- *3 B- N6 Y3 B4 t* U& I6 N4 f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( Q D8 }+ ] F3 V - * kind, whether express or implied; without even the implied warranty5 w" P; k$ G1 I# h! _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& L# N4 P4 B5 g7 U, y" G - * GNU General Public License for more details.% U- x- H: h P, S& ^2 e. ~
- */7 M p% r/ p1 s2 X, V, u
( \: c5 q" o1 ]2 s: S1 w- #include <linux/module.h>
6 d% a8 p4 }# [3 m+ S) C" Z# Q - #include <linux/init.h>
( m5 M; s: M }# j% p! U$ V# F - #include <linux/errno.h>
( @3 P9 [. G, u3 p - #include <linux/types.h>
$ U3 s5 _% c2 L/ R, y* `' j* C* R+ s+ K - #include <linux/interrupt.h>
$ U4 R9 Y/ F5 H" B7 ~ - #include <asm/io.h>, C& @4 K }# A% i. l4 r$ O& M
- #include <linux/moduleparam.h>
# g$ T0 l% V: @+ B - #include <linux/sysctl.h>
) K3 D9 U5 Q9 o - #include <linux/mm.h>: o$ [+ A+ i6 Y a+ T$ Y) T$ N
- #include <linux/dma-mapping.h>
1 Z8 e& K5 R) b5 R0 m - + e+ W% w% `& ]/ ?; ~+ x( B( [6 O
- #include <mach/memory.h>+ k3 W( {/ Y A q
- #include <mach/hardware.h>9 @0 \, ~) B' h/ ^* ~) t5 s
- #include <mach/irqs.h>
' f, t$ `. {% d - #include <asm/hardware/edma.h>5 q5 R) Q Z- z- M4 U
- 9 p1 p5 f( g; b9 f, I
- #undef EDMA3_DEBUG) Y. P4 D$ Q; b0 o7 r. f
- /*#define EDMA3_DEBUG*/
* B3 M2 m; C* X# c' u- L2 J" `
- L# E7 G2 \) U0 x- \- #ifdef EDMA3_DEBUG9 Z+ w& _+ h0 q6 C( z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. [' ], E1 a8 Y4 z# \5 v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# K4 L1 L9 `1 t3 W* p9 X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ j; {9 i4 ? U3 P# _) R
- #else% _7 j" x5 x( `; m& b
- #define DMA_PRINTK( x... )& l U( C. V, r
- #define DMA_FN_IN9 s" L* r5 V1 L* O3 t; I- ]% c
- #define DMA_FN_OUT
. U1 h) S7 M! N' B- p2 e - #endif3 |+ k6 z7 s: |* d1 w) s
- 2 W' j8 ]6 e$ U; U. y/ w% U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) p( R& h4 j. t - #define STATIC_SHIFT 3& Q" @1 D, c" Y2 Z
- #define TCINTEN_SHIFT 20$ D/ m/ M' D9 z
- #define ITCINTEN_SHIFT 21
' W- J0 e( z* s0 ~4 p - #define TCCHEN_SHIFT 229 j) \, h' w2 n( M- z# ?
- #define ITCCHEN_SHIFT 23& c5 l/ D, L6 C: t/ ~
( ^9 s/ I6 b" p' y- static volatile int irqraised1 = 0;
& s ~/ G o$ }) v - static volatile int irqraised2 = 0;% ]7 r3 B% E+ n& e3 O
5 U% ?. B) h- x" P" I# x. _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 G- n# s4 V, m* M! w" H, U( ?$ Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
O, ?1 |: A& z/ T! o+ C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 a) @6 T) }, p3 ]
3 O) E) y/ R# v+ {0 ]' y; N- dma_addr_t dmaphyssrc1 = 0;! _& I s; k* S# I8 Y
- dma_addr_t dmaphyssrc2 = 0;
8 G4 R" u/ w. a - dma_addr_t dmaphysdest1 = 0;6 T8 j( C& r z X* P* v+ l3 I5 \
- dma_addr_t dmaphysdest2 = 0;
5 u% N7 P, F" G1 {$ F3 [2 i - & }9 W" s- }& j+ l6 u0 c) x
- char *dmabufsrc1 = NULL;1 C% }3 G; {+ o' p, G' j; J0 Z
- char *dmabufsrc2 = NULL;
6 d$ j" ~. j. D8 ~6 v) Q2 I' T - char *dmabufdest1 = NULL;0 N' a, R- }/ P
- char *dmabufdest2 = NULL;
' S) n1 w, J S( q! u
- t/ F0 `0 l3 T; U+ ` b- static int acnt = 512;
' f5 ]4 b! X4 ~ w0 I! R! y - static int bcnt = 8;& k \1 I% N \: C
- static int ccnt = 8;
# B7 j- x5 T$ j
2 d. h5 A% {+ s- module_param(acnt, int, S_IRUGO);
; Y- M- {1 D/ g& X0 _ - module_param(bcnt, int, S_IRUGO);9 t- Z, Q$ h5 w# N2 B/ Y9 x7 X8 q
- module_param(ccnt, int, S_IRUGO);
复制代码
7 A6 N+ m$ w: l+ F; [) `1 m) q$ D: H6 n* A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, @5 s- z$ T0 D" i) Q2 R8 narm-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 P3 t' g6 o8 |& e$ N5 I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& V3 `* S# p% o1 Z- @: K0 d9 W) ]! p0 x, r; u( u4 u4 f
( I+ b8 X/ n/ G |
|