|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ R/ W7 Y- I9 k; R1 K% |8 p- [code]EDMA sample test application
8 r& n# I, y6 W2 Q - /*+ l! ]( i" g' J
- * edma_test.c
+ [& R2 v) U% s' N7 m/ ^ - *
9 t9 Z9 o) q7 S3 I! F u, r k - * brief EDMA3 Test Application* A& s1 P( p8 C
- ** k$ l+ C, R8 ?3 K: Y( W2 B, K
- * This file contains EDMA3 Test code.
, D5 _ R/ F0 h - *
9 ` r# A' m( C# Q4 [, M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 y3 K3 @3 {/ q8 ]8 K; z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- k9 _, Z/ s G# K9 P/ r9 C - * TO CHANGE.1 H& Q/ J$ x k2 n; G7 n% F
- *% C% ^7 _0 k; b$ o& T; m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 b9 U' o! t6 J: `' S2 z
- *
( s8 ^6 H- R0 `; P1 R - * This program is free software; you can redistribute it and/or* g4 `* D) u! H, }7 l+ \. P2 F% S
- * modify it under the terms of the GNU General Public License as" N" N, Q ?. O0 p# L* z2 f
- * published by the Free Software Foundation version 2.
7 a: g; c; j" @& E8 [ - *
9 Z' \. G0 `$ r; N/ A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* U; L* [+ Z0 F6 K9 `
- * kind, whether express or implied; without even the implied warranty
. A" i0 F3 i5 L( S. ?7 R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: u+ t. l7 {: @( ]2 P e
- * GNU General Public License for more details.' ?7 X! X, l1 s
- */
, |; }" @3 W: X; S2 S2 D
: R7 ~; f2 y0 G7 U- #include <linux/module.h>* A c j- A" X, {7 u+ _
- #include <linux/init.h>& [2 c& T* F+ F9 i4 D% q) ?+ e* N
- #include <linux/errno.h># _8 Y1 o1 O# N/ k4 ?
- #include <linux/types.h>8 r' s: n5 }" x% ~$ m8 k0 Q) u
- #include <linux/interrupt.h>
4 E# F' K6 Q# Q - #include <asm/io.h>
3 n, r, q8 W+ V; p+ B9 ?! K6 M5 O3 e) N - #include <linux/moduleparam.h>; q4 D- b1 ^5 O% |8 c" J o
- #include <linux/sysctl.h>3 |# n6 v9 h1 }, i
- #include <linux/mm.h>) M3 I# _0 Y: z; u! g' o- ~
- #include <linux/dma-mapping.h>
' M" F; i# K2 y5 J) ^& s
' g/ |# K5 u; q' f1 \4 z: \) A- #include <mach/memory.h>
; b) c( ]7 b! {6 x: c - #include <mach/hardware.h>5 U+ F& ?% a- c
- #include <mach/irqs.h>/ C9 k! w" ^3 l" p( n
- #include <asm/hardware/edma.h>
3 T( h5 U# M9 l8 y- ^$ ^; [ - & ?! o! y3 @/ ~9 m- @
- #undef EDMA3_DEBUG
0 z6 i9 {5 K, V4 g" Y - /*#define EDMA3_DEBUG*/. g; `: L. P: ^+ W: t+ r
$ F. E8 Z; z! C2 V3 y- #ifdef EDMA3_DEBUG
) t0 G0 |7 |& m0 X- G8 U6 w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); J1 ~7 N1 U9 Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) z) Y5 K5 M& C3 I0 T; F+ F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' a0 Z8 X: Q/ t4 { - #else( @( a0 R( Y7 m0 Z5 l! C6 P" H7 T
- #define DMA_PRINTK( x... )7 h. B4 B3 H. |5 F0 G
- #define DMA_FN_IN# F; P$ m6 R G5 D' s
- #define DMA_FN_OUT
6 s2 R% R4 d6 H ^3 b2 A6 u - #endif" g" P( B+ I6 a( Q1 A/ V3 Y% p8 C# l, W
" [7 J5 H* I. f& S' E6 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# E I( X7 A( B x* N - #define STATIC_SHIFT 3" [6 Y- K9 k) w) B/ ?
- #define TCINTEN_SHIFT 20
7 F; L" @, q: Q7 } - #define ITCINTEN_SHIFT 21" |" e7 N- g" R; V/ h
- #define TCCHEN_SHIFT 22
* H$ i. P" p* ]/ ^" @' U - #define ITCCHEN_SHIFT 23& I6 X. ~* E7 {5 t
) |$ o0 m7 f |0 r3 B, I6 y- static volatile int irqraised1 = 0;
5 u. z- C/ ]6 B/ h Q- \ - static volatile int irqraised2 = 0;# a2 a- p8 J; v4 M: K
$ q. ?$ c s. d- C, a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ^) U% W) l/ i L W' W& U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, X+ P) j4 o% k% n C, _' N* e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 C0 ^& R; A- X; N n) F
- 5 ]. w: D+ b6 i- q. P. @; _
- dma_addr_t dmaphyssrc1 = 0;
, Z4 W% U+ J1 q# G. B& b$ n - dma_addr_t dmaphyssrc2 = 0;
& f6 l/ M% |. x6 w- I* @ - dma_addr_t dmaphysdest1 = 0;
3 [; C) H. b& n5 j& l - dma_addr_t dmaphysdest2 = 0;0 ^* P3 @% y4 K% o
6 k4 v: J+ g3 w$ ~- char *dmabufsrc1 = NULL;
4 J% R0 k$ h8 f! ` p J - char *dmabufsrc2 = NULL;
' l9 y& B2 m% f! l. q0 Z/ E - char *dmabufdest1 = NULL;
" l n/ }% o! P7 g! D. ~ - char *dmabufdest2 = NULL;
B* V1 B. r$ o% \7 I
) B6 V' b! x. W4 v5 S( W- static int acnt = 512;
. @2 H1 P* Z. ]; W; n& P - static int bcnt = 8;
5 a$ U" }, e A( e - static int ccnt = 8;
( d. h; m* i. B% _1 ^ - 8 C) z: u+ g6 N
- module_param(acnt, int, S_IRUGO);# i# V8 k# e- l
- module_param(bcnt, int, S_IRUGO);6 c8 I# h5 g! ^$ h0 p
- module_param(ccnt, int, S_IRUGO);
复制代码
6 x$ `5 h; z/ u |! K0 H
+ H: ]$ \. v1 c6 ?" g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) o3 s/ N' Q8 g# 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# k6 d) {8 V0 H4 g9 ?/ d' W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 b- X& E: o: Z" l' s
/ }7 E5 I1 @$ U
' B; p$ z6 |: D# C/ y |
|