|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + ? s: `) L- B7 D/ a: f! E' b0 k
- [code]EDMA sample test application) y0 |& R+ W8 X8 O
- /*1 q1 ~- j, C' T
- * edma_test.c
/ w. E2 u) c0 C$ l. j/ f - *
8 Q2 d/ d2 r r+ b6 U - * brief EDMA3 Test Application3 N" V; u- S* m r, ]. A& B1 W
- *
& [2 T3 _; p' R+ x% O6 `6 j - * This file contains EDMA3 Test code.3 v4 \" H+ S0 T% E- B( c0 ^
- *
% V& ?% P6 P* p! h; C: z/ F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% C" y7 `: K6 k; R5 g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! _1 J T. m/ R) }1 B6 z
- * TO CHANGE./ |& _! A4 i) C: P$ Y$ {4 y, I
- *6 E! W! [2 R$ W% A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 |: a; n0 A1 B
- *- B# H$ n# V& F# k% Z$ E+ z) q: l
- * This program is free software; you can redistribute it and/or
- l3 I2 B$ g: I+ C0 W% N4 u6 q - * modify it under the terms of the GNU General Public License as
% n) U+ w; c& W - * published by the Free Software Foundation version 2.4 l, I: u: N* d% [) P+ P
- *6 D; C2 j/ _ Z! i9 m: t$ ^* F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ u' A, c& e. R4 g3 c2 W - * kind, whether express or implied; without even the implied warranty
0 H2 _# r" f/ J6 m* r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 r. q3 e# a d- `
- * GNU General Public License for more details.
7 s, K/ l" @4 W0 L# j; L - */5 S+ s; M: r. N
- 0 B, G- D$ P1 w, P; x3 r8 n1 Z
- #include <linux/module.h>
# i- S+ C* d" c - #include <linux/init.h>
/ y$ C# u( }7 v O6 U( j - #include <linux/errno.h>
1 s0 O9 n! K" z, Q3 {- r, i# ^ - #include <linux/types.h>* b9 J4 T3 c \
- #include <linux/interrupt.h>
( c$ w7 [) B. \5 V: @- C* n - #include <asm/io.h>
( a6 z; v! N; d, w - #include <linux/moduleparam.h>1 l1 l7 ~9 M5 x. ~% O( C
- #include <linux/sysctl.h>
% N7 k5 X6 Y. C5 B - #include <linux/mm.h>
, I4 c/ o8 H m! P - #include <linux/dma-mapping.h>
: u0 G6 @7 b2 \ - 0 J0 z: T1 H. a6 z/ w) @* |
- #include <mach/memory.h>$ e7 |3 o5 g1 ~& I
- #include <mach/hardware.h>
3 A' v% j1 O' W& [. o6 {+ \; ` - #include <mach/irqs.h>
1 w( Z, y c( T/ x2 P. b - #include <asm/hardware/edma.h>
1 T% v% R8 `" L, g6 Y5 I
7 e2 K) B; Y- \- #undef EDMA3_DEBUG3 }; m! I, J1 ?: l( \8 \
- /*#define EDMA3_DEBUG*/
2 C) b$ q6 i: G, }9 l; v3 W( M - ! ?. G# V l7 X) i. A: e( X
- #ifdef EDMA3_DEBUG
; l& q# v- k) x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 k( n& R$ w( A- [& t; C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 o8 q0 l! }7 D9 M# v9 i b# X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ G Y. ~3 ?4 x; @% i' J
- #else
9 C- ^0 L3 z1 e - #define DMA_PRINTK( x... )
2 U1 t; v, X- k# i - #define DMA_FN_IN( W4 H! P+ n. z- m3 s! t
- #define DMA_FN_OUT
- |; x3 c% n4 D" @/ f" {6 { - #endif
) H" Q# B( V3 L% A8 v( g
/ A; _8 r& m: Z! ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 x& q2 V, g# H! @ - #define STATIC_SHIFT 32 @+ `& v: C) t( L
- #define TCINTEN_SHIFT 20
0 _% Z2 ], A6 } - #define ITCINTEN_SHIFT 215 ^' n* b& V: `) Z2 O
- #define TCCHEN_SHIFT 22
5 R( _2 _- ~# a$ t; `4 M' f - #define ITCCHEN_SHIFT 23( } Z9 O; |8 x' u% G. d% \
- 6 H# t6 c! `: A2 W4 H [0 a
- static volatile int irqraised1 = 0;0 s5 \6 x4 J, O+ e) [
- static volatile int irqraised2 = 0;
, R1 H) ?; @9 x+ H$ Q% q* n - ' h9 K5 t, L! e% B+ I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! |5 q% s# [" r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ g, G9 Z$ O$ C" ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# d6 w6 O/ w* H
- . W/ ~& m, ~/ a" W/ _+ V' M: _
- dma_addr_t dmaphyssrc1 = 0;$ J. v: p' T3 f! }! V
- dma_addr_t dmaphyssrc2 = 0;
& Z; W3 l+ j0 S - dma_addr_t dmaphysdest1 = 0;2 ?2 |9 Q V- b& C# [, ^; @
- dma_addr_t dmaphysdest2 = 0;
9 J% s7 |, l8 [8 @7 b) n- z: R - - N4 U U* g) Y7 n. r# O2 y# D" n
- char *dmabufsrc1 = NULL; `, `$ l6 N! y# M9 a$ f/ N: N
- char *dmabufsrc2 = NULL;5 S- |8 n1 Q' C [8 }4 L
- char *dmabufdest1 = NULL; }9 P7 O* c+ N! ?' j! h* a! N% d# t8 `
- char *dmabufdest2 = NULL;
" M. G& B8 B) f+ M
9 T. R% J* b- t% Y- N- static int acnt = 512;2 l1 g+ e4 Y- r9 v# C
- static int bcnt = 8;6 M- r) m0 d: H! U, E) q$ Q+ `
- static int ccnt = 8;9 t+ W6 O6 W0 C9 k8 B
- % A* Z5 u4 A6 k8 F! j
- module_param(acnt, int, S_IRUGO);) e0 L5 @; r' V H. R
- module_param(bcnt, int, S_IRUGO);
6 t8 L: g0 ?0 A: l - module_param(ccnt, int, S_IRUGO);
复制代码 3 B0 y' w0 V1 B( E. T) z! h
5 W1 a6 m5 b' |/ D. n0 G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 H7 J8 U( Q+ J7 y3 \& _3 y
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. S' y2 a2 f: d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 X+ y' O; Z" |3 F/ o
( I( O9 s: F& G- N) G
" T# F @1 B' c) O" j1 J2 i |
|