|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 e0 C2 r% G8 u- [code]EDMA sample test application
6 E( [- ~0 |% l& Z" W) t - /*
1 H* t! M6 a2 ^6 T - * edma_test.c, y2 k" e0 ]8 {- D8 W& d0 o; B# v
- *
% m: X" [; f0 n6 E) m- C. G2 B - * brief EDMA3 Test Application
" O8 Y0 m/ }8 r3 s8 Q - *. F3 e& \- b! L6 e9 h+ A
- * This file contains EDMA3 Test code.
9 z* J& p# `9 h- x1 j w5 X0 c - *
. A7 W# s4 K9 }3 | } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
G6 m1 U1 s9 F; L: y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- K5 ]% I( z( D - * TO CHANGE.; U" E6 R) M2 s( K
- *" a. J# d Q3 i# J5 X% O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// U0 q- m2 e# c% V8 C
- *! j9 |4 c% F8 h/ q
- * This program is free software; you can redistribute it and/or7 L" o t* c% l
- * modify it under the terms of the GNU General Public License as
' h& f5 ^, Z4 }, C" N - * published by the Free Software Foundation version 2.
: M% S$ S, E! E& K2 k- C( X8 o: p - *
; y( Y7 d6 h1 ^* U% p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
a2 h4 j: o4 V2 L - * kind, whether express or implied; without even the implied warranty, q' \7 N7 ~+ h9 F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 S8 P3 f& G# [- S9 m9 u# _8 ~ - * GNU General Public License for more details.% `5 W; G \3 u: z* t' u) j* E
- */' k% Y2 n7 E' O% N
- + I+ E; x/ r& G7 K' ~% D
- #include <linux/module.h>9 ]0 ? z2 a! T( \3 X
- #include <linux/init.h>+ f, b% f- U* g# D" k S$ L2 E
- #include <linux/errno.h> C5 e9 L% Q* v4 W: `. ]3 e `
- #include <linux/types.h>% k7 T8 T! p3 W; w$ N" Z
- #include <linux/interrupt.h>
9 k% p; p7 A2 M% k* G3 E6 | - #include <asm/io.h>
% l8 L' p" k1 m' x9 @ - #include <linux/moduleparam.h>1 \+ @7 K Y" ]' K- d
- #include <linux/sysctl.h># F* R' e1 y+ J+ _
- #include <linux/mm.h>
2 o7 q9 A1 S% ]8 E - #include <linux/dma-mapping.h>
4 Z; P. v% X" O, Y/ h$ h, N - & v9 ^* ]1 _: K. @9 }, N* B
- #include <mach/memory.h>
' H' b, t' P$ d3 F - #include <mach/hardware.h>
2 n! U( ^, v) h2 ]; D3 K3 f - #include <mach/irqs.h>6 V! q C% L5 L% R( d3 t& L* _
- #include <asm/hardware/edma.h>" [ e$ O5 F. M4 y1 X
- & J6 a$ y6 v6 F% v
- #undef EDMA3_DEBUG( @; W+ W& I. `4 K9 P
- /*#define EDMA3_DEBUG*/
2 y# F* }7 l1 ]3 j1 `. { - 2 U7 U8 m) A2 ~2 i- }+ q. o
- #ifdef EDMA3_DEBUG# I2 A r& g t/ \) I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- U1 T0 f& g# L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 E0 j, ^& R8 W- ]; }& p9 n% m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ C# B" B' Z- Y# H' P5 N+ j* N0 m: u - #else4 f q9 ?/ E ?9 Y2 O( F0 {8 i
- #define DMA_PRINTK( x... )& w' L/ r- G5 j; A( K( {
- #define DMA_FN_IN; @ i3 k3 _* X( I# {6 a
- #define DMA_FN_OUT
! w& f. i4 b% _* N. f) X6 a - #endif3 Z y' p9 w0 }
- b( R3 X: H N" Y1 e6 P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 M: ~# |9 a7 L) R5 t: u+ R- ^
- #define STATIC_SHIFT 3
7 _8 ]3 ~+ B+ e! O8 q8 e - #define TCINTEN_SHIFT 20* Y3 x- I/ y( X5 C l$ _
- #define ITCINTEN_SHIFT 21
- C6 u; `! A/ E, ]! s1 \ - #define TCCHEN_SHIFT 227 V! f, ?& s# e; ~) c& N# \9 _
- #define ITCCHEN_SHIFT 23$ s0 X |$ R: }7 h
- + g, T! ]# L% [0 W/ K7 v* F
- static volatile int irqraised1 = 0;
2 f* `) _% C5 C - static volatile int irqraised2 = 0;
- i6 e" P6 B+ p4 u* v. N - 5 O4 r* ~* P) e2 ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: [5 ]9 v; A2 R. V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- O* Z8 I& ~2 G) j0 [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 j% x$ D8 d' B) d* k6 Q# G - ! _5 g U7 L N& S- m7 p
- dma_addr_t dmaphyssrc1 = 0;
/ g! A$ s2 z1 s& A* T5 z - dma_addr_t dmaphyssrc2 = 0;' n4 d, G) z- H$ L) H! c7 a
- dma_addr_t dmaphysdest1 = 0;
+ c, m" U- F2 d7 ]3 R! V8 w, P: h - dma_addr_t dmaphysdest2 = 0;
: `6 C- s5 i, I) d6 ^9 x5 c# H' q
- l o4 Q7 b8 A0 \4 t* X- char *dmabufsrc1 = NULL;
* ?/ M' p! B$ [+ S - char *dmabufsrc2 = NULL;% o: u( W) _% s, y! c+ T: x
- char *dmabufdest1 = NULL;
* S' m* \& K0 R' w, B8 e; S - char *dmabufdest2 = NULL;
. u" I" \5 G7 r4 ]1 T8 J" w
; E6 V5 l3 F( S/ \- static int acnt = 512;. I! M7 @. l9 d4 H
- static int bcnt = 8;2 k4 R+ N3 z# B1 Q0 E% A; \% I
- static int ccnt = 8;. @, D/ g# U$ Q: S* { d% |
- 1 m) _5 @# E% H' ~: k
- module_param(acnt, int, S_IRUGO);# X3 W$ B! B. A
- module_param(bcnt, int, S_IRUGO);
/ m n3 @1 g- _ - module_param(ccnt, int, S_IRUGO);
复制代码
" t" O4 k* r7 [+ j6 ~% X! a" N% U8 F- M5 V6 Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. v# n2 m# q# o* G9 K9 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 S: `' S2 B' L$ u5 s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 d( |) L4 G! l
% A& B7 `, f) Y. ]* i! t! ?9 y% }6 K. `' ~. C
|
|