|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! f) T( j" o$ T! @- g
- [code]EDMA sample test application
/ ~0 B. ~" S+ z' o - /*( a; s8 e9 ~8 r V- q+ n+ i
- * edma_test.c* i0 ^/ z) h3 _: J* M* Q, i0 }
- *; I* }" [# U9 ?1 ^" `
- * brief EDMA3 Test Application
. I7 q* r/ `$ i) k+ T$ T - *- @8 v3 y: p V3 G& y" v* T1 p
- * This file contains EDMA3 Test code.
; n, A( ?: t \ - *
+ z0 C7 W- S! p3 ^1 a- W& ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& {- }9 d3 W* y! W- ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 F5 H+ q6 X) @7 {* d
- * TO CHANGE.
' h8 ^6 n1 r: K2 f: A - *
! m; I0 f* {$ a" M7 r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- H( K9 W! L* x x, h' W5 M3 i
- *
, E" H6 s6 T3 |5 {3 V8 [1 ] - * This program is free software; you can redistribute it and/or9 Q2 _0 [8 B! u) r8 ^; V
- * modify it under the terms of the GNU General Public License as! Q8 u/ u, n1 H
- * published by the Free Software Foundation version 2.
$ q9 J3 N0 ?$ f+ \* D: [! E; @: L - *
% H: k3 }7 \, @) |; |: E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) _* z0 `' x# @; B+ W - * kind, whether express or implied; without even the implied warranty9 m, H5 E* T" @' I1 {3 n: i- ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, K- H) ~0 v- h. H5 q
- * GNU General Public License for more details.
/ P2 y+ f) y. g5 i' @ - */! r9 b( \ f; q1 J3 U
2 L6 \( J9 B$ D- #include <linux/module.h>1 i2 W$ s: g# A2 }. i
- #include <linux/init.h>% h0 ~( r% S3 A ~: J" m# o
- #include <linux/errno.h>
! M. G) X5 K1 U( G n - #include <linux/types.h>
( ]- w! h. ^* [8 o, T! p1 N) r - #include <linux/interrupt.h>7 {% r& P3 x' w3 |3 f. Q
- #include <asm/io.h>
" e. v* o- [! D+ O6 C" a - #include <linux/moduleparam.h>
O; o$ g- u# ]* L4 ]+ W5 Q - #include <linux/sysctl.h>6 T6 M r/ v2 a/ J' u
- #include <linux/mm.h>6 g9 L- p8 j& L$ y# Q6 o* M
- #include <linux/dma-mapping.h>
4 C7 N6 u c# r6 m, U' h - 5 p5 X5 u: R5 I4 w2 M
- #include <mach/memory.h>" T) M7 h3 S" G/ A8 z1 P. G0 B
- #include <mach/hardware.h>3 D" S, \1 f" w- Z2 ^0 z0 I( o
- #include <mach/irqs.h>
% F& p; O* u& A/ H0 Q - #include <asm/hardware/edma.h>
/ i. f% I3 s9 J: o# V1 ]5 q0 W
6 c& d) k1 C& ?$ k- #undef EDMA3_DEBUG1 `3 l" n/ e6 V! s1 t2 S1 G [
- /*#define EDMA3_DEBUG*/
; d- g, f8 i6 y' ]! b - " V% N; u4 g$ a- U
- #ifdef EDMA3_DEBUG7 V. i% Y) Z$ H1 J" b7 {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* Z( a4 `' w# P2 P$ o" d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 R {1 b! |5 }2 j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ e% S$ Q3 }- ^3 q+ O
- #else
. j% K W: ]" ] - #define DMA_PRINTK( x... )3 ~, t8 P# h6 \1 S5 V
- #define DMA_FN_IN
) y. p& o# y- Q - #define DMA_FN_OUT
4 n/ `; S/ g0 }3 ^! J7 f: k - #endif
) G( R& u8 e$ _9 u2 p. I - 9 H+ @. L. g& s7 s: Y$ E& |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 {# E; W2 c, ^' F - #define STATIC_SHIFT 3
$ I3 J4 M( U! N; d) l - #define TCINTEN_SHIFT 20; }# M; w, l) M( f9 u; Q5 R
- #define ITCINTEN_SHIFT 21
7 n6 n# | o, V* \2 v6 D - #define TCCHEN_SHIFT 22
4 _1 W3 F0 g- ^: y3 f; _; C - #define ITCCHEN_SHIFT 23! S7 ?6 w8 O/ K% }5 u& h
9 T: a" L5 X7 c# ~, R' Z3 y- static volatile int irqraised1 = 0;
3 w: C9 {5 l' p) B# {! G' S1 O* |2 z - static volatile int irqraised2 = 0;
/ [" z! n- ]; o' M
4 k. l: m( Q4 J/ D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- l8 ]4 B8 a4 G; m( d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% u2 K( V# B0 @) q4 E! u! ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 |5 e* F2 i0 |5 A - 0 d8 O0 s3 m1 F+ Q" o, ~# o
- dma_addr_t dmaphyssrc1 = 0;
/ i' I5 o/ D+ P' D/ f - dma_addr_t dmaphyssrc2 = 0;
6 p( V" G( ?# n2 F - dma_addr_t dmaphysdest1 = 0;
: a7 r# V- J" S. {. z( B3 n8 K - dma_addr_t dmaphysdest2 = 0;/ p: A$ `# D/ }$ R$ L
- / v$ X3 `; y5 ~- F; H
- char *dmabufsrc1 = NULL;/ r7 |, F% D" }( m% V0 n* i9 \
- char *dmabufsrc2 = NULL;
* G, X! Q" V y/ v/ n - char *dmabufdest1 = NULL;. L s. h7 T( S" d
- char *dmabufdest2 = NULL;' L( s. N6 n+ \, P
k k& Y F2 B: S/ I+ j- static int acnt = 512;2 P6 Q" U8 ^0 y3 E/ l& }
- static int bcnt = 8;
; b4 K. i4 A& C5 s Z8 z - static int ccnt = 8;
9 {; [$ P3 E# q/ i, g) Z: c - 9 B* m) y+ }- X5 H
- module_param(acnt, int, S_IRUGO);: g" Q$ Y! t& L8 M! H( U# Q
- module_param(bcnt, int, S_IRUGO);3 T* c6 x9 R- D/ r) B6 ] O
- module_param(ccnt, int, S_IRUGO);
复制代码
$ y, _ c1 } }6 f' o E* k) J5 ~3 d* ]" n* w$ z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! |+ K1 }# b/ D: i c2 J p) Q; d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; ?/ u+ }: z! s6 |0 h0 k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& f7 J* k, I% R. h
" y2 R* [' |9 t1 C# j. e' D4 h, l7 ?6 c8 N
|
|