|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % E% K' A. m! N
- [code]EDMA sample test application
( d- }/ M H3 r9 z( X - /*
+ P, z) D- d+ n; d+ P - * edma_test.c' F, P: f% o3 l- s( J
- *6 u# q$ s6 \" g4 z
- * brief EDMA3 Test Application% x/ o/ y6 H6 q. p) K
- *
3 D$ j) p9 m* L& m6 X - * This file contains EDMA3 Test code.* O0 m! O4 ~: T2 C8 ]! k/ e
- *
4 A5 M- g) G. g6 s. s" P0 U! ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 E1 Y! U' \( j' J( ^; D4 }! } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 [8 l& c6 ^# Z3 g3 O9 F& V& n - * TO CHANGE.; [* u2 n% h+ g
- *& a: j1 U5 c; j- t! j1 b; F5 c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 y6 C0 N" P, T" _- x* R - *
" }: y) L4 o3 `& w# U: O/ H - * This program is free software; you can redistribute it and/or
+ m6 W/ R0 Q9 _4 [; K - * modify it under the terms of the GNU General Public License as
- s9 \% c1 ?+ ~1 Y: p8 C/ b# I4 ^" m - * published by the Free Software Foundation version 2.
+ C1 b- z" `# ~. X7 g - *
) Y; J) v w- }9 f6 H v( i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 [% N8 x- M( b. j2 f, Q
- * kind, whether express or implied; without even the implied warranty1 t# y: r9 r8 {9 Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 h" J8 K8 K- n+ e! O+ N - * GNU General Public License for more details.
$ F, V% e# M! G7 d- ? - */) y [/ W% Z+ x; ?+ q4 I
- 6 U- s, z5 o: L5 y6 k* W" d# [, i- R
- #include <linux/module.h>; O- Z$ n0 V, x. D! S: f1 ^! m# N
- #include <linux/init.h>. y c. l. Q& ?9 ^7 u) Y
- #include <linux/errno.h>! A3 u# s8 G% S, H( w
- #include <linux/types.h>
& \! \) M: b, e - #include <linux/interrupt.h>
# w* | R$ L: e* u7 i' p - #include <asm/io.h>/ }: V/ T1 p0 A
- #include <linux/moduleparam.h>2 p5 h* d6 I" `7 o
- #include <linux/sysctl.h> l* z$ Y+ I# z
- #include <linux/mm.h>
1 n% [" Q( Q! B& q8 D) E% ? - #include <linux/dma-mapping.h># \ W* F/ e2 z( i3 s) R+ Z2 c* D
- . K8 `" }0 E4 b
- #include <mach/memory.h>
6 N+ j6 S7 J+ b2 j/ N - #include <mach/hardware.h>
4 p/ ?- j+ ]4 O% s4 y! y/ d9 A1 d - #include <mach/irqs.h>
! T ~# O$ H4 N& H. H1 o( m - #include <asm/hardware/edma.h>7 v/ h& y5 v+ q, P* J
- % p. t( k2 G' S* I
- #undef EDMA3_DEBUG
9 T9 h0 u5 _* F9 |( N* X - /*#define EDMA3_DEBUG*/) c `( a, H. S2 a7 e2 s
; v+ E" m0 ^( b7 O$ v2 l6 {) O- #ifdef EDMA3_DEBUG- \) }: K8 u1 \: g; B- S% m" K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ O6 ?6 n$ }$ _! l- D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* L$ O; Q: N) \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 t i- e4 D7 a; g
- #else
% n7 C& P/ Z. K& B+ ]+ H. m - #define DMA_PRINTK( x... ), Z5 U' l4 X% x' X
- #define DMA_FN_IN: o6 ], Q+ N, K; ~' l* |% S J/ }
- #define DMA_FN_OUT) H6 z8 d, _; i, }/ q6 B; A/ [
- #endif( w! Q0 V8 E) W
- , P5 j& O9 E; L7 @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ i5 U2 Y0 M2 `& H4 N - #define STATIC_SHIFT 33 f/ S& D0 D+ u2 X: B b0 q% i
- #define TCINTEN_SHIFT 20$ x. D$ w8 w ?3 a4 R
- #define ITCINTEN_SHIFT 21
7 ~; T$ }( r+ O# O! q: L T" W - #define TCCHEN_SHIFT 22
# V9 ]1 ~$ I, ~5 F) S w - #define ITCCHEN_SHIFT 23
, S3 v* n. ]9 _- @
% v. w1 ], U7 c2 |: m- static volatile int irqraised1 = 0;9 p' E% ~: x3 r* H3 x. ^7 X
- static volatile int irqraised2 = 0;( ~! A6 X, E5 P0 s% t
+ _4 R z$ ?2 m8 a _' j% T/ P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* b# h+ i, h! E. ~( G% P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( _: A7 t T) e+ M+ E. r, k7 _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' c0 H. g! B3 A' \2 a
/ X% b' P9 V6 U! D, W- n% s" ]- dma_addr_t dmaphyssrc1 = 0;
9 _5 I5 E7 A$ Z8 F - dma_addr_t dmaphyssrc2 = 0;# ~* R: B" B x; T6 l8 @5 X
- dma_addr_t dmaphysdest1 = 0; r0 `; h" R! s
- dma_addr_t dmaphysdest2 = 0;8 V& Y T9 K4 e
# _5 @/ L L7 @8 {4 Y- char *dmabufsrc1 = NULL;1 u# v) J# p. i6 n/ M0 F6 \. }
- char *dmabufsrc2 = NULL;
* E- q3 S! Z/ M8 j9 a: d - char *dmabufdest1 = NULL;
. V" `: ?7 e3 t - char *dmabufdest2 = NULL;2 q4 E6 y2 O/ |( U6 l
- 5 y$ D; S' w! b- }% L- ?% f
- static int acnt = 512;
0 Q0 n9 B/ h) r2 U. z, a# s - static int bcnt = 8;
; x( b! V* T! Z7 \, l - static int ccnt = 8;
) @" e9 o% i7 k+ X- P - 5 F3 v, N0 i8 _. Y- ^8 q
- module_param(acnt, int, S_IRUGO);
2 V6 W- q9 ?3 E5 O5 x - module_param(bcnt, int, S_IRUGO);, }& Q5 j3 v* Q/ y, t0 y4 m
- module_param(ccnt, int, S_IRUGO);
复制代码
: E5 e" A- p% b4 w f' t& P" I4 ?: J. p' ?2 c, \* N: _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ A3 x) @" U1 E6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# A# P0 T$ B! P4 \- G( d' } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 m5 a. S7 w: T
5 g0 e" @! v, X+ i" |) i5 ~- L
k; M1 I' M% c" U }- ^ |
|