|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 w t9 T: L6 r# \- [code]EDMA sample test application( E/ E3 T* G' [# Y( n' }0 d7 e0 C: _. u
- /*
! P! g4 ]6 Z9 g - * edma_test.c/ j" D- C, C* H# E
- *
2 w$ T% y9 [- Y. P9 L: W# K9 c - * brief EDMA3 Test Application* r4 [1 L0 o: {; O
- *
7 C5 n# e' o* n. o - * This file contains EDMA3 Test code.1 @! m, x! d6 t: K# d! c
- *
8 n W- k3 l) i- L) ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; p" Q0 r, O" r! f5 y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 f2 n+ } ^3 w- Z) Y1 S# Y. q
- * TO CHANGE.
8 ^) G6 F- G6 D - */ {2 b5 Q# x0 W. s' m4 U* m( T; O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) l; k( \7 j& c% j' j2 S" {, s1 x
- *' ~0 M( F9 N9 Q9 r1 c. W
- * This program is free software; you can redistribute it and/or
f5 \4 s) y6 |* h - * modify it under the terms of the GNU General Public License as
2 o& y. e) C) g3 Q - * published by the Free Software Foundation version 2.
) a) y. l3 |3 K% @0 Z$ U' X - *
. a7 E! b3 @3 V3 l) z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, Z2 B' y; W/ k - * kind, whether express or implied; without even the implied warranty
+ _- z5 {3 H4 E5 ~/ j! s7 [/ z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& Y6 y+ p, x: X, [2 a - * GNU General Public License for more details." C# l9 D# I4 b: A
- */
3 p3 @& ^# }; _( c1 ? - 1 H# j9 |! c8 x5 u2 F. t& D/ W' ~
- #include <linux/module.h>2 X2 I* K! |# }" `
- #include <linux/init.h>
* e" U- j9 x) d; u8 T6 F# E - #include <linux/errno.h>6 l+ i0 C. u" z3 G/ e
- #include <linux/types.h>6 m3 c7 t; H/ G( N0 `3 M
- #include <linux/interrupt.h>- b$ p; C0 r! j1 ]
- #include <asm/io.h>
- M- u5 D+ a0 E0 R - #include <linux/moduleparam.h>0 O& n0 P/ C5 l# a; f. s7 n
- #include <linux/sysctl.h>
: |; z- Z! J4 r- t s" I- x - #include <linux/mm.h>1 g! \" O$ w# ^
- #include <linux/dma-mapping.h>
6 R1 W- K. v! @6 d8 }
. `7 R: z/ L4 o; [. o+ T- #include <mach/memory.h>) |; p& @; ]. \- t" k- @
- #include <mach/hardware.h>3 M7 G5 h) U2 _3 H5 T
- #include <mach/irqs.h>7 X. P5 K8 e' U w2 r
- #include <asm/hardware/edma.h>
3 U* e1 k. e$ | - . L# ~( X9 m8 ~: S. p' k: T
- #undef EDMA3_DEBUG
) T2 `- E i% @0 q - /*#define EDMA3_DEBUG*/
' R! g! P% D: h" y/ ]* V1 H3 P' r
: Y6 ?% f* X. {; ~$ L- #ifdef EDMA3_DEBUG
- a, [" Y8 j5 K. Z/ p4 }2 C/ l4 C5 R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): o O" B% i3 V$ D5 R2 h5 L% Z/ ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ i- F# q' w/ M2 G6 e3 Z/ o9 C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 y) D& z+ X b - #else
0 c. g B$ k. M* F" u: _ - #define DMA_PRINTK( x... )
m6 _ L- r$ B) b; W0 F( Z - #define DMA_FN_IN
! ~9 `) S" Z0 q8 r% v% @. c7 P - #define DMA_FN_OUT6 J) p5 d" n6 l$ p1 X0 ?/ o
- #endif
6 f- r: i! l( [& h- x
4 L; ]3 c1 O( G1 T4 v6 Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- _: w; }8 I5 t j
- #define STATIC_SHIFT 3) V" R7 u# h/ u, _5 ?/ b: C; \$ h
- #define TCINTEN_SHIFT 20
; t9 h3 C8 B* w) v - #define ITCINTEN_SHIFT 21
( P" y5 N( k* H! V$ \/ n4 l - #define TCCHEN_SHIFT 22$ T, A5 V5 S, l2 b9 s" W" E! t
- #define ITCCHEN_SHIFT 23' D7 e* v8 t, V
* x& n9 m% M& E) u- r- static volatile int irqraised1 = 0;
) Z/ S, o6 {: k - static volatile int irqraised2 = 0;
4 [( x8 _4 `# j( }- R/ `
) y. j; G ] z0 H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 [: ^% h' \+ w! W" X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 b: u2 `, A1 D" c) h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 {) ]- p6 Z! y8 O! ?
" y$ p) R" n$ |, H5 z7 B6 @* y- dma_addr_t dmaphyssrc1 = 0;
& v" I/ Y& \/ p - dma_addr_t dmaphyssrc2 = 0;! X, N8 {' S7 _) \) Z
- dma_addr_t dmaphysdest1 = 0;, k! \9 r( p' B" N+ y' w
- dma_addr_t dmaphysdest2 = 0;
8 k e5 o) C0 |; s7 [ - 8 K7 r2 ~9 \, B" R
- char *dmabufsrc1 = NULL;
) a4 A( V$ E1 e4 r- d% ~7 S! l; N - char *dmabufsrc2 = NULL;8 Z" o+ J- M' X% @# k1 J
- char *dmabufdest1 = NULL;
' W9 l. { R- P7 u ?2 ?0 _0 p( Q - char *dmabufdest2 = NULL;
9 Q2 G- j E' |4 B - ; y, a: K* d+ R
- static int acnt = 512;
9 L$ q% b& T# S! I! u - static int bcnt = 8;
9 w6 G& o: U' M' F, j7 y8 g- N - static int ccnt = 8;
$ S4 W: L# y1 J% @) M1 }
- }- A& O+ B- z& {( ~% w- `- module_param(acnt, int, S_IRUGO);
8 o; @1 p- C. v. ? - module_param(bcnt, int, S_IRUGO);3 d% N8 s, f p9 n! N; @, n
- module_param(ccnt, int, S_IRUGO);
复制代码 2 U; P: D$ v5 s2 X
. Z/ [+ R4 g9 x3 S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 @2 }* G+ \$ J) c/ r* f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ L& o5 F3 Q2 l/ c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ t1 j+ S) _ E( C T4 \% B" h; p: h4 z0 y: t
- D. A) |9 b" N2 `. ]- O* D& W
|
|