|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: C, e4 |# e- Y" n0 x$ J- [code]EDMA sample test application$ M5 |# }4 m) Z; B
- /*
; d' p& K4 ^& @. S) h - * edma_test.c1 ~. ^0 W6 F$ X0 \. V3 V0 a. W
- *+ P* M( G. V! L' Q) Z
- * brief EDMA3 Test Application
; x$ j G- C/ ~% ?( n - *
" q/ P0 {9 V+ j# g: T* t - * This file contains EDMA3 Test code.
4 i& l, w* o7 B3 U% t - *& I- Q+ u. }) P* Z9 k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- h4 a" ?7 b8 Q0 G( d, G8 I; n, a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 s- j3 X, r6 r! E - * TO CHANGE.
8 _0 B/ p8 B* X9 u% I - *7 C3 Q: R( \; h1 B U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 a2 [+ K7 E; \- k ]4 c
- *: m7 `* Y8 D' U* Z7 r( Z
- * This program is free software; you can redistribute it and/or8 H6 u% q; ?, I+ U4 i2 v) I
- * modify it under the terms of the GNU General Public License as
* X y0 n u3 u6 E J* J: d) I/ E - * published by the Free Software Foundation version 2.! C" X4 b" q4 V6 l$ }0 o
- *1 l7 R0 y: B7 I0 E! J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& B% R! q+ a( F! U - * kind, whether express or implied; without even the implied warranty, J& H& U% z+ D6 v; }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ o( b3 S6 X8 U( y5 W' [' H3 O: B - * GNU General Public License for more details.
9 a0 j/ k' ~0 M! V - */) N& a) r( a+ ~5 B) n5 w# |
' s1 z' `/ t& r7 u; a/ j- #include <linux/module.h>) s6 ?# @9 r( B6 G4 h. t! j
- #include <linux/init.h>% p; }1 I; S* a- j) N
- #include <linux/errno.h>2 K6 d ]7 \9 y7 \# j! A
- #include <linux/types.h>" C2 E' v3 |/ C9 c
- #include <linux/interrupt.h>+ }3 n; a0 D0 n+ r
- #include <asm/io.h>
, E9 e9 P T& { - #include <linux/moduleparam.h>: L- |+ G" L2 o& F5 I l2 L
- #include <linux/sysctl.h>6 }2 ]$ ]3 k# y" [8 I
- #include <linux/mm.h>. s; e7 |: l8 n2 ?4 \/ c2 m' C
- #include <linux/dma-mapping.h>
* t% f! L3 E/ L - : G$ ]( M8 }" @2 d2 n& Q6 Y o
- #include <mach/memory.h>7 t: i& `! J) ~, _1 g' K9 X! ]
- #include <mach/hardware.h>
' I7 \; Q! H0 n2 ? - #include <mach/irqs.h>
; j/ L) ]3 h% M6 a, Y0 f7 \# m/ f - #include <asm/hardware/edma.h>
( x: |4 N! u R$ `" X5 q) D
2 Q5 @ L {$ C$ e! S- #undef EDMA3_DEBUG4 d+ C5 C# c; V V' E6 \9 p
- /*#define EDMA3_DEBUG*/. z# Y) e# L* ~/ B
- ( n- ^+ S0 O& Y! k5 ?6 Z' m8 c
- #ifdef EDMA3_DEBUG
9 g+ ~5 q( h: W" g' j% r% c1 h9 P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); i" e$ d: G! j$ y2 S q/ Z! T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 u2 t$ T) `; {0 t& Q* e6 n0 H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ W, R( k$ T! z+ j& i* s - #else; y+ b$ T8 ^2 o& O
- #define DMA_PRINTK( x... )% a( V# V, `" k4 h3 Y. ]% k, z
- #define DMA_FN_IN
& W& [; l1 f9 {- B7 u6 X. z - #define DMA_FN_OUT
" g7 p5 l4 Z% w# @# ` - #endif
# `! D4 i$ B {& y$ f& b - , Y8 S& d' `( Z1 \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 y1 z1 o* T9 k4 Z( k$ F+ Y
- #define STATIC_SHIFT 3
1 B8 ?/ _/ H5 d - #define TCINTEN_SHIFT 20
+ u% B! ^" W7 q4 j5 q6 {9 _ - #define ITCINTEN_SHIFT 21
- Y5 o- Z+ T1 B' B2 }: I7 ?; M/ t, g - #define TCCHEN_SHIFT 224 X0 ]7 w. ^1 X3 }9 L! }' C: Z) u
- #define ITCCHEN_SHIFT 23; \. j) _* y0 T# |% T5 A% {2 {
- 2 r7 V- I% T2 r9 {) e h2 p
- static volatile int irqraised1 = 0;
3 L1 E! M5 _8 b4 H r. i - static volatile int irqraised2 = 0;: P- t8 s/ a2 r7 N" i, O0 \, k
5 d a& g1 T" }! H0 n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ z7 } k% y+ v1 x* M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Q0 g% P- G% L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Y0 l! n2 C* k( n/ K2 {! `
. Y. e1 i/ `) K% x2 s% }, g4 h, K- dma_addr_t dmaphyssrc1 = 0;, s$ g- C. O7 m f1 |+ v q
- dma_addr_t dmaphyssrc2 = 0;+ d1 k5 Y- a+ A$ S5 D1 a" D$ ?
- dma_addr_t dmaphysdest1 = 0;
* m. R# B n8 e: o& e& O - dma_addr_t dmaphysdest2 = 0;
3 i( Z5 h G1 A+ B/ W, d9 C5 [ - 7 x; q( z7 q* }( S" W5 |' t
- char *dmabufsrc1 = NULL;7 ?, t5 Z' J( U* L; K: N
- char *dmabufsrc2 = NULL;' V5 ^2 @3 G8 B; S
- char *dmabufdest1 = NULL;" o9 \* A/ y* t
- char *dmabufdest2 = NULL;, N8 R4 h) Y! E2 O3 V: e
- 8 |; n* V& E8 { E; }3 ]$ b
- static int acnt = 512;: R" `4 R* [ Z
- static int bcnt = 8;' [$ D6 i5 g- V5 u' }) _
- static int ccnt = 8;
0 I" L0 e, o2 S+ Q; K( I3 ? - k' X& c6 h. F: o
- module_param(acnt, int, S_IRUGO);6 c) \$ O* i' j j, m
- module_param(bcnt, int, S_IRUGO);
" k- S1 ?) V& a: V - module_param(ccnt, int, S_IRUGO);
复制代码 - v1 C" r& a) O" K4 J6 G
5 B1 ]& j# x" Z! T O: W" G/ x7 p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 Y2 w+ p8 s8 P/ I1 [2 j) d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! v, C& m& ~) G+ C( C3 c, x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. q' D/ e0 E( ^, k8 V8 ^
& a- N( Y" C5 N0 [
3 H' H- d+ A' ^. J/ d7 w |
|