|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . t, l' Q& ?; u
- [code]EDMA sample test application% R6 ?5 h! O9 V0 i' @4 ~9 G7 e: g
- /*
1 A, D+ s+ I( ]( y - * edma_test.c
, z8 Z6 ]+ M2 Q; l - *+ \6 ]& [, ^/ X: |9 @- ]; y
- * brief EDMA3 Test Application
! y# g- }3 y$ O. B& I9 Y - *
7 x, K2 r% @ H0 H$ X - * This file contains EDMA3 Test code.
7 W. v: g$ l8 M - *
4 | o0 _( Y* v! q, G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% S5 } V8 `1 L7 V% n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! g9 P1 W e( Q" J5 h8 J - * TO CHANGE.8 e" c" ?0 J/ t; [7 g
- ** G' l+ X( U5 w; S) O: j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) o4 G4 J; J( N* W; h
- *2 D6 L* A0 p9 c( l2 w- o d( _4 p
- * This program is free software; you can redistribute it and/or
* Z6 H3 [- _! D+ _( y - * modify it under the terms of the GNU General Public License as
6 s1 g; l" v& w2 k8 [0 r - * published by the Free Software Foundation version 2.' m1 M6 u# k# n) S q
- *. c' Y7 A( {+ V7 u( _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 M% {6 v% u- @/ H4 L) i3 f0 L8 { - * kind, whether express or implied; without even the implied warranty
0 T9 I$ b: t$ F- g! n: N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 _9 ^; q1 `* C* J1 e+ t0 }" k1 z - * GNU General Public License for more details.
( r0 y- n# [& y5 v% h- b - */
) x- `" V* T9 t3 N
! e. a+ c' J: h7 d3 U/ M5 q: d! i- #include <linux/module.h>
$ Z% l( G8 B5 T4 N7 v/ X6 T - #include <linux/init.h>4 ^$ R% s, ?+ F6 g9 s/ b
- #include <linux/errno.h>
# U, o6 [' x$ x - #include <linux/types.h>
2 n Y% A+ S2 i* [! Q- d# j9 P9 h - #include <linux/interrupt.h>& h+ S$ N: a, X
- #include <asm/io.h>5 L! b' V7 R3 \4 D+ \. P& L$ U3 c
- #include <linux/moduleparam.h>
/ Y/ a! n b3 _5 l" q$ G" N! q& P - #include <linux/sysctl.h>4 M4 K a, o0 ~/ O
- #include <linux/mm.h>
% H1 i- |' A6 ` - #include <linux/dma-mapping.h>9 E( o0 P! J. W" {5 v) b0 W N
- 8 | _$ ~' H1 Q+ ^: J
- #include <mach/memory.h># p1 K$ M: [" U P, @1 ]
- #include <mach/hardware.h>9 m9 R3 N2 n$ d( B0 }, }
- #include <mach/irqs.h>
, [! e; x4 I+ B - #include <asm/hardware/edma.h>
9 b' c: U3 W; Y6 e, b - 4 z( X) |" N3 V" _/ S/ C7 M2 B
- #undef EDMA3_DEBUG7 \3 h4 A3 {& E, g) x+ `! I$ E
- /*#define EDMA3_DEBUG*/ o+ U# p2 j; U& Y
* |7 Z& T# n% K @9 ^* N- #ifdef EDMA3_DEBUG
0 {$ |7 z# V! P# t! Q+ G" [+ K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 W/ {- s" n7 l& V% H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( ^- S, S" }& r8 u7 n9 h+ E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 W' \9 g& L/ k& k9 [ - #else& d) M% ^) }; X% @! Q& F1 y2 _5 W3 L
- #define DMA_PRINTK( x... ), _% U) c; M# ^% D+ N' R6 m
- #define DMA_FN_IN: [! H- n( R d; Q7 K1 H2 Q
- #define DMA_FN_OUT
$ h( e7 Q. K5 Z. w: S - #endif- o0 `6 V; I0 B1 d1 V0 ]& s; Z
, E3 y! o2 l' [$ {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! L( ~: s( x! ~# R" g! B - #define STATIC_SHIFT 33 b% s7 V7 x: `. V9 ^
- #define TCINTEN_SHIFT 20
# C* }0 O r6 W6 Q- }/ W" j - #define ITCINTEN_SHIFT 21
4 a8 H0 e+ [) M7 r, e( }/ i! W - #define TCCHEN_SHIFT 22
1 J( v1 j' J# s% H2 m' \ - #define ITCCHEN_SHIFT 23 V' K3 q3 m' X% a$ u% }' t
- 9 m' Z* H2 k& d6 D* c) J
- static volatile int irqraised1 = 0;8 h6 w+ C& t1 _# K' [& m
- static volatile int irqraised2 = 0;
3 Q# @. D q0 R& ], {1 [* J7 a1 g8 D - 2 q) a' `1 Q- V6 z, R+ J [# k) d4 f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' j/ B; p" D- N" q) A. d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- X2 C( `: b0 Y# b. J4 ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 \$ P+ X! t8 f. p. |* j
- # P. {4 p& g4 H/ T/ j
- dma_addr_t dmaphyssrc1 = 0;
. M. c/ B2 y" W) i. w - dma_addr_t dmaphyssrc2 = 0;
) {( r r2 [( {+ h) l$ e- h9 P, v - dma_addr_t dmaphysdest1 = 0;
, e7 }9 N* y0 S. K$ G" y" J+ e6 b - dma_addr_t dmaphysdest2 = 0;4 g3 M6 X, [$ D6 X
' a- g3 ~1 j' P6 A8 A- char *dmabufsrc1 = NULL;
|7 R" t Z" _& w/ R - char *dmabufsrc2 = NULL;
+ C. ?& u3 U* x" D9 X - char *dmabufdest1 = NULL;& Y1 V/ h( x7 i# Z4 N4 r) H
- char *dmabufdest2 = NULL;6 K+ h5 M2 f k# B% D
- - p$ b+ T) C6 Z5 m/ W
- static int acnt = 512;6 M# |$ T, _- W* x% u
- static int bcnt = 8;0 O: e( h# ~ u4 X9 M; h& ^
- static int ccnt = 8;
. |: i1 T4 F8 b; @7 M# L8 x - ! S$ o( z% a* D
- module_param(acnt, int, S_IRUGO);; B1 }8 \% Y' ^, {# J
- module_param(bcnt, int, S_IRUGO);
5 z1 \7 D) ]3 z1 x4 V" R5 p, U& O - module_param(ccnt, int, S_IRUGO);
复制代码 % E6 y' ]- a9 f4 `3 A
/ v0 B z; Y# j% H2 t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 M) N2 A1 m! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. o& @, S1 s% {0 h [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 L: H2 _- B# s) E4 {
1 r8 A1 V1 x4 q! H1 v9 J, y
" B- |* F3 e/ z7 H k- ?9 n |
|