|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # b# u" b. [! G ^8 w& ?
- [code]EDMA sample test application* Z: T# ~8 v A. V6 q+ V4 U
- /*
2 G% e7 `- {7 `2 A! W+ b9 X - * edma_test.c
! Y0 R# P! j, r# h# v$ x- ^ - *0 y' b+ c6 R' q% I
- * brief EDMA3 Test Application
- k* C5 N( `* A8 C - *6 [, s! s. ?+ P. \0 l" d7 k" n
- * This file contains EDMA3 Test code.! L$ d! l; o. Y0 v: z8 J
- *
; G/ w- z- a8 ^' d( N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& t% D8 h; ]: p0 U! u$ | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 g8 H) C2 o- B1 R, d+ f
- * TO CHANGE.8 A0 o* V$ f% G; Z, _- z9 v) X6 x
- *
1 Q/ X$ E. ?3 x8 ^" M# t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% F) D& l0 Z5 ~8 | - *
, |. N5 h$ ]" e% n3 z - * This program is free software; you can redistribute it and/or/ y6 A* [8 @0 X+ C
- * modify it under the terms of the GNU General Public License as
/ T" c( u: e+ \, c C4 O4 a - * published by the Free Software Foundation version 2.
! O6 U- M7 X2 ?# a1 X - *" `! k4 R# W& `, R3 m% j8 p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any D5 j# S Q% A2 j
- * kind, whether express or implied; without even the implied warranty
N& y( Q) F1 o9 {* a7 h2 E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 k0 p6 q( z1 h3 x0 a. V
- * GNU General Public License for more details.
+ P# l( n+ e. l5 ~ - */
9 @- C1 J) Q* m* V \* m+ f, [ - & g9 @! r6 a; r* M! ]4 T7 J1 O
- #include <linux/module.h>
1 R. ]- j: k+ L9 @4 d) t5 O - #include <linux/init.h>0 q9 t7 Z' I' Z
- #include <linux/errno.h>
, c* k3 D3 x+ a6 V1 x% _8 r" ] - #include <linux/types.h>7 [7 n7 K5 F' C! i' P! ~
- #include <linux/interrupt.h>
, B u# K, T D" w' l( m1 h - #include <asm/io.h>
7 L+ W/ A1 l, @4 A/ m5 G' g - #include <linux/moduleparam.h>4 p" n4 `6 Y. f4 F3 d- k, z& S
- #include <linux/sysctl.h>& _0 Z" E* H6 R- n5 c8 B9 U3 S
- #include <linux/mm.h>6 T; e" w; G2 s' i
- #include <linux/dma-mapping.h>
' Q4 q% F( G( K/ L$ W, |; M2 `. M
% ?8 r* L: I, c! g. V2 Z$ Q- #include <mach/memory.h>9 \$ @5 x( o) d9 Q+ z4 i/ Y' X
- #include <mach/hardware.h>1 B s' k. Z. [! b& N/ f
- #include <mach/irqs.h>
9 x: i9 n: t" R: y' u$ p - #include <asm/hardware/edma.h>
: y) H9 x2 i" |1 s
6 Q# \3 _$ t4 h$ o) K/ l7 H& s5 j- #undef EDMA3_DEBUG$ I+ `& c( U( v, n# H c9 r
- /*#define EDMA3_DEBUG*/* _7 H& e9 P$ ^% @" i
- 4 x7 y- ?8 k& Z4 a1 K9 @! J! w/ t
- #ifdef EDMA3_DEBUG! i- E# M5 Y4 R' V( G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
V7 U' r+ ^5 d: `* f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 N r1 T8 D/ ]- g: A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% V" Q3 X; N# |% R
- #else
[9 K& s" Z7 U2 N; n" M% n - #define DMA_PRINTK( x... )! p4 `# c- S: f1 N8 U
- #define DMA_FN_IN
- {1 Q- ^8 z) _7 n' V% G - #define DMA_FN_OUT6 q6 W- {. o( ], ^
- #endif
1 k3 Q( g; _8 J, x - 0 g; } y N2 d! |' b- }" w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 U+ T! }% q* f6 n& V - #define STATIC_SHIFT 36 q' ^! U: l; i9 Z8 a
- #define TCINTEN_SHIFT 20
1 U# `* \, c8 T* w* n% m1 P | q - #define ITCINTEN_SHIFT 212 g+ N/ R0 z* X3 j! ?* N
- #define TCCHEN_SHIFT 22
1 A/ s* C0 i3 o8 }$ n$ n, j- ^1 f2 X - #define ITCCHEN_SHIFT 23
9 ^* c6 e1 A# M$ q- ]* q - 4 R; I) s8 W1 _! \: u6 X6 q% `
- static volatile int irqraised1 = 0;% Z9 _0 R( X7 n- Q3 w
- static volatile int irqraised2 = 0;
" f8 X5 E4 l2 u) \& K3 F$ p - . f7 U6 P/ L% o" n/ [/ s8 s' t- W {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 n2 |' ~: S/ Q- B6 Z) S1 V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ _+ i( x9 b* g$ _4 i9 [8 z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' e) f+ V9 u: k# C i8 \7 X2 u' K - 0 b$ X; A1 s% d0 X2 o& ^- r6 j
- dma_addr_t dmaphyssrc1 = 0;( \# c5 x# Q$ T9 Z0 a( n
- dma_addr_t dmaphyssrc2 = 0;
. B* Q4 \% C1 @ Y8 i' \7 b2 S7 q5 u - dma_addr_t dmaphysdest1 = 0;3 A4 T6 V) i4 B6 ?
- dma_addr_t dmaphysdest2 = 0;( l, h4 l0 {& }7 g. l
- 3 a: d' \0 c4 D- w) I1 f: r
- char *dmabufsrc1 = NULL; e9 F8 ` A5 I- d9 N5 y
- char *dmabufsrc2 = NULL;# U# w( r' f1 \# a% c7 q
- char *dmabufdest1 = NULL;
( m; `$ S9 W) L: r& W$ y - char *dmabufdest2 = NULL;: ^. b: L/ I& q$ {# m! n% i. _
- 5 q3 j/ X" |1 C- i- |2 |
- static int acnt = 512;# {8 J R E; K: c; K7 v* ^
- static int bcnt = 8;
0 N/ ?+ h+ U* v+ o7 n; ?! [ - static int ccnt = 8;
: r& A5 v; B% x1 s5 M) N - : {( D3 H( h' w e$ O( N
- module_param(acnt, int, S_IRUGO);
: ]" q2 {$ f) h6 S - module_param(bcnt, int, S_IRUGO);& x" I7 F' R# @0 |& b1 c8 v
- module_param(ccnt, int, S_IRUGO);
复制代码
. \7 H( Q% ~. q5 I. G' O4 U/ E/ H; V! w. K& j( F. I- V2 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; L" W0 B7 v+ ~ Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% i3 y. `5 s/ g- B8 y0 Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 [' o( i) `+ ^* _% u% |/ b7 r/ w1 E2 F8 ~& g- {
# ^7 D% \- s- g& N4 R1 n
|
|