|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- i) e6 n/ {$ Q) y7 p7 J5 T- [code]EDMA sample test application
/ \9 g3 F! j: t3 P' }- I6 W - /*8 Y4 _9 b; |, A2 z: Y" \/ }
- * edma_test.c
$ [, v1 A& I% @8 h5 D" B. ?( d* Z - *9 e% w3 i1 Q9 D2 m+ K# o
- * brief EDMA3 Test Application
& s" r% p6 A8 {3 ]( @ - *1 J Q# p/ v* E7 _% s* G/ F
- * This file contains EDMA3 Test code.# V+ b7 o( _& ?% L3 u
- *
6 `7 D/ G, H8 z# y R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. I3 i' _0 n8 I- G2 R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 w* i8 M* \, p2 U; y% I3 r
- * TO CHANGE.* u) w2 S+ N e t# W! H, Q) V5 r3 d
- *- v0 [2 K& R" n: w2 ^' s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 _+ F8 Q; R3 `2 `5 ? V) {7 c0 z - *
, v6 P) h+ c: B% Z. ] - * This program is free software; you can redistribute it and/or0 C5 k2 q$ P1 F/ e( B! U
- * modify it under the terms of the GNU General Public License as5 O: w1 Y) n* l1 L s
- * published by the Free Software Foundation version 2.
/ J D( Z3 _$ ]' ?# g4 g. H - ** U) s7 j' o% @' v9 i9 [% V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 I, q# p. s* k6 J - * kind, whether express or implied; without even the implied warranty; H! U7 |4 g( ]+ a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& D! o1 ^' s5 ?* `" p - * GNU General Public License for more details.
, v8 W# o, b4 ~& O( a# N - */
, U1 o" e5 j; K
, ^0 m. B% o( i8 i$ R+ F- #include <linux/module.h>/ G1 R7 F1 S2 w' m! r4 ]
- #include <linux/init.h>0 J. K$ ]# |2 p7 a
- #include <linux/errno.h>( Q2 [+ I' g/ u( a; G
- #include <linux/types.h>
: p" o% E! r/ v2 k7 ? - #include <linux/interrupt.h>1 g# y! v( x8 Z4 ~: K! F
- #include <asm/io.h>
0 e* B& S; E) F( G - #include <linux/moduleparam.h>6 F# T5 G4 B3 _2 H. q! t2 y, ?
- #include <linux/sysctl.h>/ W4 K t: s# K p
- #include <linux/mm.h>% e( N+ ~/ K- x* U% C
- #include <linux/dma-mapping.h>
& P+ \! d+ \9 Y, Z4 i1 f1 a8 V* F
/ w8 k3 W. q6 l9 T- #include <mach/memory.h>' J9 v! \/ F/ i- y0 N2 {
- #include <mach/hardware.h>
! H/ m7 N% B) n - #include <mach/irqs.h>
2 r+ @. W) j$ [3 q; k; V - #include <asm/hardware/edma.h>7 Y1 F7 V" i: ~; h) p$ T
- 2 H- s7 T$ y$ F. ?5 z8 a& U# J
- #undef EDMA3_DEBUG' j7 l# ?/ z7 g0 p0 m3 ~
- /*#define EDMA3_DEBUG*/
; \$ m' Q8 }% R
' U7 K) H2 Y$ D" o6 c* q, [/ i- #ifdef EDMA3_DEBUG7 o0 [% I6 g7 `0 a! S4 W# ^, W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ h$ P5 t5 @3 a0 ^# U( ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& t8 r/ b# |5 \6 U6 H' N7 [; ~% E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ I+ g+ E3 p9 I0 c7 m! N" R - #else$ E+ e0 g0 q3 B
- #define DMA_PRINTK( x... )! {: M8 q& @+ O- q4 u1 ^. l
- #define DMA_FN_IN2 s4 |4 q+ T5 h( {& ~ W) S0 J9 K
- #define DMA_FN_OUT* N1 x( U& \7 ] x5 L2 f) J
- #endif: d" I8 g% B* B+ B" a8 P8 c
- _" ]. G' z# R b0 N, r0 q' s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
a5 G8 H) b) L c; S$ T - #define STATIC_SHIFT 34 T. u" N. |0 i6 C: M. {
- #define TCINTEN_SHIFT 20
7 S, o( v# j7 J3 D - #define ITCINTEN_SHIFT 21
9 ^8 O7 m( i4 z* A2 y - #define TCCHEN_SHIFT 22
0 z7 Z. c/ Q' f' b( e4 d, M - #define ITCCHEN_SHIFT 23
3 z: r: u* u7 _4 s9 G
" z3 q* N* G t, R- static volatile int irqraised1 = 0;
9 w, M( Q+ ^8 R) w1 `( K" P' }4 p - static volatile int irqraised2 = 0;$ I0 ~6 l0 M9 ~7 V; l
/ A% c7 S$ |9 `0 m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ J) d9 b4 H' G( ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( e! K' [! D) U2 ^1 F3 Y: n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; E8 I4 }* w8 M0 X
+ m; |! E$ G R- dma_addr_t dmaphyssrc1 = 0;
0 Y: I- ~$ N; C/ ?' V. Y - dma_addr_t dmaphyssrc2 = 0;
2 u: f" ?1 T4 r6 H - dma_addr_t dmaphysdest1 = 0;2 s2 \( {& H6 O6 a2 c# l
- dma_addr_t dmaphysdest2 = 0;( ^, C3 a. ~4 s& J8 C
- 3 x( a1 a1 }4 x1 D) H2 h
- char *dmabufsrc1 = NULL;4 R# m3 G4 f* J; J& r1 u% r% m; v
- char *dmabufsrc2 = NULL;5 k5 G9 N+ C8 [; _. V
- char *dmabufdest1 = NULL;7 U: I6 f# j6 S: ?2 B
- char *dmabufdest2 = NULL;" h- H8 N- U, n+ F6 T" {
- 4 w1 l6 d$ d( h( g7 r; C) W/ d
- static int acnt = 512;, o& c" ]5 l) L0 ], r
- static int bcnt = 8;
6 j- \ c8 f9 y7 ^/ @ - static int ccnt = 8;) e+ i: F& h3 g# X1 I5 k
) u. ]- x. T. @- module_param(acnt, int, S_IRUGO);" s2 i& c& K' u. c9 o2 T6 V" X
- module_param(bcnt, int, S_IRUGO);
5 [6 K; x, q# U: K5 L' r: {: o# p$ }6 v - module_param(ccnt, int, S_IRUGO);
复制代码
- R8 p6 W% @9 T- M& Y4 R3 Z3 v
+ h: X5 H* O4 p* p' D, h( H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 G d4 P& L5 `0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& u7 I `" n, i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# |7 y- I3 U5 U) @! R8 B6 c
& @9 m6 q3 I3 l H% X
% t; U [" I5 R/ q. l |
|