|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ~% P7 t2 ~7 T3 v1 l! X; p
- [code]EDMA sample test application% d# S4 z% A8 c9 E; g# P2 o
- /*. `3 l# ?3 F: G: h7 `9 V$ f/ {
- * edma_test.c* {/ p/ S- ?4 ~) ^) |/ p
- *: h" m4 n; \! u* b% P
- * brief EDMA3 Test Application
* K H2 Y# A6 h3 \5 v0 P; ] - *5 E H, o+ P# s
- * This file contains EDMA3 Test code.0 l4 J, r' O* B; c! s1 W
- *4 o6 W0 G3 o+ |2 u* Y4 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- n5 s; N- J9 L4 }- _& W3 {& }5 T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
w0 V% K x' i" b6 c' j6 \1 a: Q/ | - * TO CHANGE.- _7 J4 L. e( Q% d
- *
2 y4 h2 q3 z6 c* ` w( O6 M+ S4 T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ A' D- ^' [- @2 f: \$ r1 U8 _2 H - *
% e5 h w) b- z# ] - * This program is free software; you can redistribute it and/or- d) c& q g% r1 x7 }2 a8 p
- * modify it under the terms of the GNU General Public License as+ c6 p+ D- P* a9 f" r
- * published by the Free Software Foundation version 2.
/ u& Z, h/ Z5 U: A - *) n0 c; ?* b. o+ k$ {$ a9 M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 S+ h- e' f0 h" o6 r$ W) H: D2 { - * kind, whether express or implied; without even the implied warranty
/ Z( P2 w+ T% K0 Z+ N% s# Y4 Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ K2 m$ V3 r, |, |- E
- * GNU General Public License for more details.
' h6 i$ }8 I7 q S3 X2 z& R: D - */, ~. }8 R: e( d4 a
8 ~- Y3 g; N; L4 m- L- #include <linux/module.h>9 O. F2 q+ M s6 \' T
- #include <linux/init.h>6 L* h1 q. q: p6 _: i7 l
- #include <linux/errno.h>) q( @+ S9 F U; N( a3 K
- #include <linux/types.h>
% e# f& }8 t5 O* N2 e4 ^ - #include <linux/interrupt.h>. g# R" ~) o& a- ?
- #include <asm/io.h> P3 T# P, D( m: b* l H5 M& f
- #include <linux/moduleparam.h>
4 a ^( w5 S8 Y' b; i. }7 p+ r - #include <linux/sysctl.h>, w4 b3 T$ U6 P2 J! w
- #include <linux/mm.h>9 a* T6 c2 Z6 l
- #include <linux/dma-mapping.h>
" I4 I, h: A% P, V1 A# n
6 [' v9 f2 r' @# R O& D- #include <mach/memory.h>* k% s$ ]3 _- Y
- #include <mach/hardware.h>6 I+ J2 X$ W* M# m9 D
- #include <mach/irqs.h>: G, y: g: A6 k/ G3 C9 u: O& v+ E
- #include <asm/hardware/edma.h>
/ ^: y [5 ]* C$ N, } - ' }/ ~: _2 b( s7 e0 Z( ~4 P
- #undef EDMA3_DEBUG) }/ Y+ c+ f) I: r! S
- /*#define EDMA3_DEBUG*/
c& i6 [" R" k- c, Q
: s# e2 c8 {/ u- N7 |- #ifdef EDMA3_DEBUG3 H* f- x+ r9 ~" B' v9 S1 j5 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( t: I! u9 [8 f% j& k0 h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 \. N3 B6 Z# ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! Z# E& K; y+ I1 G# v& G - #else
* h# [3 B9 a9 \ - #define DMA_PRINTK( x... )
3 w @! j1 d& u$ w) M - #define DMA_FN_IN
M& t$ E: W) |& Q. [; _ - #define DMA_FN_OUT( l @& I) o( C# ]- W9 X8 n& e) _9 `
- #endif
0 s/ B, v b+ r - & K6 f% ^8 X t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) m/ B! `8 Q1 C - #define STATIC_SHIFT 3
5 R: I7 n; F! V2 w# y - #define TCINTEN_SHIFT 20+ i* i% f) W+ O+ I+ f* \
- #define ITCINTEN_SHIFT 219 y8 F: I7 M3 ?7 |0 n
- #define TCCHEN_SHIFT 22
( Q* ]; }) ?* i n% p' q S) J, H3 B - #define ITCCHEN_SHIFT 23
% M% O0 g; a/ ?8 L% e1 R - 2 x4 B! D% Q d1 I/ G; z: Q
- static volatile int irqraised1 = 0;
. ?7 X1 Y1 Y8 d1 h) u* M+ ^1 t - static volatile int irqraised2 = 0;
4 ]+ |& g2 `4 u
1 ~1 x! I7 f, Q( W4 D# B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( q- [% p# F% C8 J/ V* Z4 {4 X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ n& D9 z- b* W9 Q9 x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 c: q0 W3 ?0 k7 u4 f
; q& h' {% L3 d) [0 K7 {+ |5 O- dma_addr_t dmaphyssrc1 = 0;- y9 `* j$ W. _
- dma_addr_t dmaphyssrc2 = 0;
3 n4 x2 }. T) f! P, k3 y- {7 A - dma_addr_t dmaphysdest1 = 0;5 Y2 X, Z* ^! x7 h5 i5 p
- dma_addr_t dmaphysdest2 = 0;0 m* E, A2 H3 X6 R: X
- / C5 z5 ^2 f0 I7 e* G5 x# ?
- char *dmabufsrc1 = NULL;
6 h" j/ X# |" I; b& t1 J L - char *dmabufsrc2 = NULL;/ z) z) r% M$ k% @$ J
- char *dmabufdest1 = NULL;% e2 D$ r; S7 g }
- char *dmabufdest2 = NULL;
# w: m4 P0 m9 I/ I0 k8 M - 1 q: w+ ~% J$ b: B% x5 D9 }
- static int acnt = 512;: r. a. d- C4 L! v/ A/ l
- static int bcnt = 8;
+ v8 F! d2 l$ ~8 K - static int ccnt = 8;. H H+ h8 U' g
- + ]$ ?( `' L* u% |; h
- module_param(acnt, int, S_IRUGO);
5 d# ?3 v9 f" _; E. Q - module_param(bcnt, int, S_IRUGO);) X1 e% I/ t$ g" }9 r
- module_param(ccnt, int, S_IRUGO);
复制代码
" n8 G2 q5 O8 I/ G) J0 q% ?, O2 k* v! ^. s) u# N7 _2 l/ l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; _9 p9 ]1 G% ?# k# f7 c/ {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 g- X i: e6 b/ y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# Z+ Z ?0 r' e: w
3 H3 Y+ C* M9 @7 I& \
: f0 o# r5 {# K$ L$ l
|
|