|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) }2 u1 z. C$ G
- [code]EDMA sample test application/ j- l: h5 I5 M7 ~% U6 C
- /*
' c w$ m$ N$ p+ m - * edma_test.c( J' F: {/ O& i' N" {8 r) m
- *
4 D# u& y6 D, P9 E - * brief EDMA3 Test Application
+ R1 @" K6 ?4 D6 Y - *9 \. X0 G; U' q+ }0 M
- * This file contains EDMA3 Test code.
4 q& i1 h1 V- } - *
; h( o6 I7 y+ E e- | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. }& g+ ^2 _: w3 k% a0 c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 _2 |$ P+ c! D Y4 H! U - * TO CHANGE.
5 O6 J" C0 p' a: r - *8 ~ c4 z" f: M5 N" `) m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! A6 @, R; D- U5 P/ w9 Q- g - *& U3 q% @! ]# k/ M: z3 ?3 ]# B
- * This program is free software; you can redistribute it and/or1 `- e% T6 `3 f/ e* n
- * modify it under the terms of the GNU General Public License as2 z- Y1 K% {# @% C2 p% U, X C3 z
- * published by the Free Software Foundation version 2.
$ k) L, J; ?0 v* x& { - *
, P" F6 p( B8 g9 P$ L6 l8 ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; V4 h2 f( {/ f5 c - * kind, whether express or implied; without even the implied warranty( e5 F, H, H, n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: f; V2 W3 a9 R- q& f
- * GNU General Public License for more details.
5 @8 {7 v: g( j. T - */
7 f) y; M8 N3 V' b+ d/ L/ V
: H! `) k! V2 x- #include <linux/module.h>
% u' J; M, T- P+ T' ]" s) ] - #include <linux/init.h>
/ i0 O S1 K; V' h; C$ w8 I+ h, } - #include <linux/errno.h>/ \( e: u+ S5 n% U \2 Y
- #include <linux/types.h>0 _1 x: }, [/ Q: H% ^
- #include <linux/interrupt.h>) E0 m6 z; P. Y* U* i
- #include <asm/io.h>
& w( u% H$ v( \7 H! E - #include <linux/moduleparam.h>
5 c5 Z& P' t& D2 E - #include <linux/sysctl.h>
8 ] T' |& n* g+ g& y( S1 I - #include <linux/mm.h> C. q( U* [( H3 W4 N
- #include <linux/dma-mapping.h>
% z$ Z% G H( V8 H
/ M1 g( ], y1 ~8 y4 j- #include <mach/memory.h>/ ?; |# ]$ ]! Z9 Y
- #include <mach/hardware.h>' f* o8 `6 u& v h1 ^5 u( f
- #include <mach/irqs.h>
9 n% D: [% w5 h( C0 s - #include <asm/hardware/edma.h>
$ c5 j# W9 ?$ D: {+ f/ y# `
. h; i: g! ^5 ^3 F- #undef EDMA3_DEBUG- |& O! ~- `, `/ G1 V( s: z& {
- /*#define EDMA3_DEBUG*/
" o' U7 m% N" G# m' S7 _
( @7 W, I) n# J# t8 ~- #ifdef EDMA3_DEBUG
, R [5 I8 J& O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" `& N3 i9 b$ x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 o- I: S Z: a* Y0 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" a; E. N& ]' ]4 O" y - #else" i. h: U8 t; J! B& i& z
- #define DMA_PRINTK( x... )7 v$ i' z" ?3 a8 c9 K8 p
- #define DMA_FN_IN) o y( e% d& b2 u* I4 J& |
- #define DMA_FN_OUT& f. L/ k# @6 y7 g9 i5 j
- #endif
: d8 R7 ?2 o$ O3 ^3 q - & i. h4 q1 {) d" c7 L# S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, c( h9 b2 q# ]- U9 s3 ] - #define STATIC_SHIFT 37 A( I4 ~' I& P! z3 N& q
- #define TCINTEN_SHIFT 20
' c, R9 ^ ]2 b5 S. i - #define ITCINTEN_SHIFT 21; \4 D/ M! M* a3 H) C v
- #define TCCHEN_SHIFT 22
; g' { g; O2 Z& ^! Q+ ?8 @) p5 B$ j - #define ITCCHEN_SHIFT 230 V+ V/ \/ l# }+ x) o5 t6 [
M; |3 _( Y S7 H2 ], A% S- static volatile int irqraised1 = 0;' V3 X5 _/ e# k8 x5 p4 x' d
- static volatile int irqraised2 = 0;
5 m2 _% v! _7 ^: |( ?3 y5 \ - % k/ i; P5 @- n; D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ b M- `" p P. j6 ?9 k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 T' }* x/ C" l0 n2 D$ v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ E, R( ^/ |1 y3 F - ! h# a' t& V# V$ h0 E: m& a
- dma_addr_t dmaphyssrc1 = 0;
* E0 j" T2 n( t" k# \5 w - dma_addr_t dmaphyssrc2 = 0;+ I+ ~7 O# H/ a! Y
- dma_addr_t dmaphysdest1 = 0;
: T3 F- \) S u4 K3 E7 [' K L: o% B - dma_addr_t dmaphysdest2 = 0;( u+ J6 _, p. R' ` S _8 V) ?
% T0 ~& E) C1 B' ]6 F) K- char *dmabufsrc1 = NULL;1 m7 x4 h& s1 \/ T9 P
- char *dmabufsrc2 = NULL;$ ]6 s. ^; W" U
- char *dmabufdest1 = NULL;& X' l+ V" d) a) L1 i
- char *dmabufdest2 = NULL;* z% D3 e, [" R- R+ Y$ t6 i0 o
; z% J- A: E' ~ T- static int acnt = 512;
$ C, g$ O' W& u- W+ Q: b* e1 C6 i7 K! F - static int bcnt = 8;' u8 d+ x: _! `0 p
- static int ccnt = 8;
# _4 c6 r h. c5 _; V - X& h! {/ I+ [; e _
- module_param(acnt, int, S_IRUGO);
* G: l' P9 m5 T- I9 f, U+ s - module_param(bcnt, int, S_IRUGO);: K$ C9 m) d/ k$ D
- module_param(ccnt, int, S_IRUGO);
复制代码 6 O& o- `/ \& J
( ^& V9 C& B' J/ B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 \- f5 c) G9 z" o2 s7 _. }, `$ { Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 c. g* h6 A2 X% y5 }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 V" x3 u( Y2 I7 e
+ X( k% ]/ t; G4 ]9 l T6 q! y2 M6 A
|
|