|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - M3 O+ s0 a0 y! T: P
- [code]EDMA sample test application% [0 G; \/ W+ W2 G# U1 \9 X
- /*
3 Q, d% o( W! @: h! Y& C - * edma_test.c J5 J; p" d5 z2 k9 J; R# Z3 p
- *1 [# `( \; f& m2 ]
- * brief EDMA3 Test Application# \/ `; C8 J% i6 f& H. k) H
- *& `1 d- e) ~ h" T- a; O6 h
- * This file contains EDMA3 Test code.0 Z7 G$ v) j- I1 \% _ Z: l# |
- *
9 K2 C1 _! ^/ q/ S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 u! E1 d4 o- m7 b: w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) u ~1 m" {7 Q6 K4 \- b2 ^ - * TO CHANGE.
$ D& g9 N. N% _ - *
- Y$ V2 H& ?# N2 { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
J, C# B" h( ~! t# H" h& U. G - *- L g) e; y& ] J% n) ~
- * This program is free software; you can redistribute it and/or/ P' }- I; I* ^
- * modify it under the terms of the GNU General Public License as0 l, n. P a+ ^- |
- * published by the Free Software Foundation version 2., i1 S$ k" g' F& ?& G4 o, l
- *
3 D8 c; c: z1 o( q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 n. g9 D; T' I H& h
- * kind, whether express or implied; without even the implied warranty* G* ~* ^. c$ U4 D4 ~5 b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; T% m5 S/ i$ W' b- K
- * GNU General Public License for more details.6 a3 L& f# _9 u0 R, ~& M& N
- */
& P! E* l* k& ]1 k/ V2 e - ! ~3 V* v+ c3 S2 _' O1 f- p/ e
- #include <linux/module.h>
; y7 a, O: t* E1 K. h; o - #include <linux/init.h>
! f* s: \8 C ~ - #include <linux/errno.h>
6 X. u | S: ^# p o - #include <linux/types.h>
, q, @) U' Q7 K. \+ ^! a* F# O9 ?! _ - #include <linux/interrupt.h>
, R* X7 v" _ g0 Z6 O - #include <asm/io.h>$ ~( w' D. ~1 ~) H
- #include <linux/moduleparam.h>
/ r; D1 |6 O% w - #include <linux/sysctl.h>
/ a8 }4 v, C3 w1 q+ @. ? - #include <linux/mm.h>. j; p q) _8 B) [# d) ]
- #include <linux/dma-mapping.h>
4 o7 z, L* p/ f7 {9 a* ~
* E4 q+ S: w7 M; c$ w, L- #include <mach/memory.h>
5 N& g4 c$ l1 }1 F - #include <mach/hardware.h>2 t& N: p" v3 f# v# o. D
- #include <mach/irqs.h> z8 b% E- h* q0 C8 J! B
- #include <asm/hardware/edma.h>, n5 y1 ^% M& T
- 2 |- x% O& c9 H& H
- #undef EDMA3_DEBUG
' K, k$ B8 w5 ? _( T/ U$ U/ S% P - /*#define EDMA3_DEBUG*/* W: V1 m+ Q9 ]; f9 W' W
- 7 e/ K1 x& ^3 _( A
- #ifdef EDMA3_DEBUG' u0 E0 D, U$ W- A# v: w8 e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): B1 x; @7 J7 d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; Q/ n- z6 N% ]4 p4 f [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, N# s3 R5 k$ B* c M k5 T# `* O - #else
; e' ] `+ O$ S( { - #define DMA_PRINTK( x... )0 w& ?4 L2 T. l! i, ^; h
- #define DMA_FN_IN" r% i. `$ ?0 k3 T) X
- #define DMA_FN_OUT% R) W) f( D+ {. Q7 p
- #endif
3 W& i2 O; T# _, I" g - + Z6 V* @' b- |1 Z3 U' W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ r4 w) O" b0 N
- #define STATIC_SHIFT 3% A; i% u! K% i" @( m; @
- #define TCINTEN_SHIFT 204 x9 V6 Y3 l* J
- #define ITCINTEN_SHIFT 218 C6 @2 y- W# m3 m8 l; [3 ~
- #define TCCHEN_SHIFT 22
* }/ {, u+ x: \ - #define ITCCHEN_SHIFT 23
8 K6 s( A0 _ R! o, Z9 C: |7 X4 }1 ~4 m
( g# a" ~% Z8 Z- {- s0 z7 _- static volatile int irqraised1 = 0;
& Q) n2 f7 s# U" o0 r+ n1 G# | - static volatile int irqraised2 = 0;0 V3 J _1 F+ }; w \8 c
" h: W, k9 h' s, N+ e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 A4 T1 | B7 O, O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) i% w/ i( l: x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# {$ R) i3 G1 f# w. ]) S5 O* [
- ; C* {6 @$ G. [7 x6 I
- dma_addr_t dmaphyssrc1 = 0;( F8 o. m0 A! ~9 _
- dma_addr_t dmaphyssrc2 = 0; j) H0 k( l2 A" A. e
- dma_addr_t dmaphysdest1 = 0;
- ?' n6 j2 I- n* ?% [) m) l - dma_addr_t dmaphysdest2 = 0;1 i$ h1 D3 s; Y5 f) Y z
/ w8 B1 T1 _7 g- char *dmabufsrc1 = NULL;+ H$ ]( o9 S) ]& o) l% [4 j9 a
- char *dmabufsrc2 = NULL;
/ L+ u8 q0 {9 i' V8 t/ g" b - char *dmabufdest1 = NULL;0 Q6 g4 r5 b3 e5 J
- char *dmabufdest2 = NULL;) h! M- Y+ Z8 r* l/ C5 V0 E
! ]& S5 l u k, N( {- static int acnt = 512;3 z- t$ t5 f: e1 O8 c: Q, L
- static int bcnt = 8;" u, K) x8 P: q/ @
- static int ccnt = 8;. v% Y1 \ a. Z
- 8 f) Z# d! {+ a( X6 h! o! I
- module_param(acnt, int, S_IRUGO);& b2 x0 P1 G$ i8 t
- module_param(bcnt, int, S_IRUGO);
% I+ M1 M/ o* Y' f* O; n$ p) M9 A - module_param(ccnt, int, S_IRUGO);
复制代码 ) G& r1 n+ E( c3 \* u
5 G7 L6 B+ a/ w6 ?' s' B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" n0 N. y% ^( \: k5 d# ]/ a. K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 o0 ~# P8 q7 r, C3 e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ z: T. E* z4 W
( W3 F5 g; ?8 K$ M% y
2 G) S* v! m4 J- l& w. Y |
|