|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
z. \2 [8 _/ F# p/ u- [code]EDMA sample test application
" a* `% j$ e. k - /*
9 X1 p5 M& [$ y' `$ B* ^7 n7 q - * edma_test.c8 X# @' H8 ~) G1 C
- *, g: j% U) X* k; {& J9 c( b! R
- * brief EDMA3 Test Application( p& r x$ v# v. h$ E- z& G
- *
% y/ E7 S* v5 A+ Y5 E - * This file contains EDMA3 Test code./ P1 [- y1 U$ v
- *- Z# t: j/ G. r; [2 }# g5 F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, f' ?( t: c. q, ]" Q# w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) B4 g- @$ t7 L9 k - * TO CHANGE.7 V3 L _5 M# l9 z1 a
- *5 i& |1 D4 p$ t1 B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: U4 Z: p; A g- l2 r' D3 T( ~4 l9 ~
- *3 C$ P) d. x+ |; ~. t& z) i
- * This program is free software; you can redistribute it and/or
0 h n. I% A5 v; X - * modify it under the terms of the GNU General Public License as
' h8 _- L3 f! w6 h- @ ~' Q# s0 C - * published by the Free Software Foundation version 2.
! p _9 k! G& P# }: O$ }2 d# ` - *
& J/ `7 S2 e' K) e/ X* h$ Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: x( @% u; a5 I" n
- * kind, whether express or implied; without even the implied warranty
. L) l$ a0 m' d& O7 o/ V* n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
K; c+ q! B: ]! m4 Q# V - * GNU General Public License for more details., J2 M. q3 y( r4 y4 I- q
- */
: M& D9 L+ Q, j& L; ?7 g
8 M8 z" m# o! U, g& V- #include <linux/module.h>
- ?* Z: G; l1 p; q+ L' n- m3 c - #include <linux/init.h>2 p3 B/ m g. i# y
- #include <linux/errno.h>
: r4 z4 T# c5 Y7 ^ - #include <linux/types.h>
( \- {/ N3 U! h' g - #include <linux/interrupt.h>3 x. C+ v ` c( q) h, I) d5 i
- #include <asm/io.h>3 _" t! _$ t% z3 s% p8 }& ^2 d# Z
- #include <linux/moduleparam.h>! \ X( L. |7 ?
- #include <linux/sysctl.h>% m! C2 ?8 ~. a; Z6 Y5 X' {' ]
- #include <linux/mm.h>) G; ?2 }2 n- e* U) l4 _* _ n5 t; N
- #include <linux/dma-mapping.h>
6 a1 q; Q. F: |
' f: }5 {- y ? R- #include <mach/memory.h>
4 |, c" k4 M/ q% C& b" b - #include <mach/hardware.h>5 I0 r+ Y# {$ P, Z
- #include <mach/irqs.h>" P) U5 j% w; D+ o
- #include <asm/hardware/edma.h>
3 ^5 a1 `) O$ d- r, R - ; u0 Z6 I" W4 O" `) H
- #undef EDMA3_DEBUG
! N4 J# \9 e7 z F ? - /*#define EDMA3_DEBUG*/
" i7 f4 P" z3 Y" u - / r8 g1 K% M; c7 K7 ]& s9 O
- #ifdef EDMA3_DEBUG
0 q' z$ T7 j+ u" X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): c: f9 X7 K1 H9 m. z& b! F, l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 V5 H. n$ _0 E- C) g8 I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ U& ^* y! I$ ], Y* S
- #else2 Z3 J0 e; P- I* ^% } |
- #define DMA_PRINTK( x... )! g. }/ i, D; \7 F! {% }4 z
- #define DMA_FN_IN
: b$ L" `& @/ y7 A0 w - #define DMA_FN_OUT
n, a9 k) O* y4 s" x - #endif3 L9 O7 O& D5 t; S4 B, u
- 3 x8 E3 h1 b$ I) d# A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ X6 S; ~ A% n - #define STATIC_SHIFT 3
$ K/ n! y1 K" q/ d: _; U - #define TCINTEN_SHIFT 20' R7 w0 |5 }% }
- #define ITCINTEN_SHIFT 21
/ ?5 j5 Y1 `, c1 B - #define TCCHEN_SHIFT 22
8 F- [, O1 p8 O* j - #define ITCCHEN_SHIFT 23/ P' ], u: z+ r# q3 m4 ^
- + g7 J( X' a0 t+ y
- static volatile int irqraised1 = 0;2 y* C! i7 z5 |! v! x
- static volatile int irqraised2 = 0;
1 Y9 A! G: n4 S; @$ D i* r) ~5 n - - K( W% z( e* ^( K9 Z% W Z! S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 J; k+ z2 E. E, i1 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ |7 o- q# b8 X# a; i# ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); o' e+ p, K9 A- d5 y$ \/ ?
# B$ ~4 r6 L! _- dma_addr_t dmaphyssrc1 = 0;
4 r! D, h' @/ A6 ? J9 U* r: I- K - dma_addr_t dmaphyssrc2 = 0;4 q; I% D% v& r* r, P0 w }" V
- dma_addr_t dmaphysdest1 = 0;) k T( Z% S1 U5 p' w. x
- dma_addr_t dmaphysdest2 = 0;4 Q- b' ^0 d. {
7 I* h" {% L* X K$ t4 Q8 F- char *dmabufsrc1 = NULL;5 k8 G' P% R: L: O
- char *dmabufsrc2 = NULL;( a! p" g2 m0 F$ t/ P$ a- a% w. C
- char *dmabufdest1 = NULL;
4 _3 s# ?3 F" a8 s: z1 b! x - char *dmabufdest2 = NULL;
# _3 E5 {/ d) j8 L v" C
. V7 n6 e2 G U3 c% k- static int acnt = 512;2 }) i7 M" r$ C8 i) v. n; D4 N+ f
- static int bcnt = 8;
/ A% @$ I9 B! L# L" _; G - static int ccnt = 8;
$ Z6 Q" M' A% y W
% ?$ ^/ a7 j2 I, k- module_param(acnt, int, S_IRUGO);
3 N# D1 g/ p. C; c! l1 H9 F( l7 S - module_param(bcnt, int, S_IRUGO);
$ I P2 m9 H& M7 |7 x, | - module_param(ccnt, int, S_IRUGO);
复制代码 3 }7 t, G( T/ H% o0 }
$ J1 E* K. H. }# I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ g# G1 J: O# P( k8 [: u7 {6 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% r( j1 k& O, F# F/ V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 k1 x x' D5 z2 m. L
9 j# n6 f3 e- v+ L' |8 a1 N- G% P" z6 ]2 @; k8 E; X1 I
|
|