|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 z& s3 i* _/ w3 l- `% }$ _% {$ C- [code]EDMA sample test application
( V& f- b/ J3 A* |1 A: q# K - /*' l4 V, J4 w8 E
- * edma_test.c( P+ K0 V" b) U" Q3 V& D) ~
- *, g4 x) F# m: y: n& L
- * brief EDMA3 Test Application! y. M D# h8 p' ], V
- *
+ j. E' m) {4 @9 W8 T - * This file contains EDMA3 Test code.
1 C _% E1 c; v4 C& A3 }9 M. p ~ - *
. T E( q/ `7 [$ f5 s- z) i) G' w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 r# E L' E! f6 w0 O X0 l/ \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- G. Q) ]/ x2 O9 ]5 k7 k - * TO CHANGE.
2 X9 N( t% j0 ?# K8 [ - *2 [4 R0 G& z* i. p% X1 x$ i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( D+ {1 ~* k4 S7 d* H - *8 }) Z' |) z! Y2 X- y
- * This program is free software; you can redistribute it and/or; Z, h }) ]! t, q. H" Z5 a
- * modify it under the terms of the GNU General Public License as
* [) }( q1 y! Y, f! G& u5 n) b; y2 x - * published by the Free Software Foundation version 2. p2 j* o0 g( D+ O8 x
- *
& v$ [2 l6 N1 p& q0 r, f. W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. O. n1 X- R' F, S y3 Z! Q
- * kind, whether express or implied; without even the implied warranty* p6 U" R- W4 U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" ~+ p# e! _/ U, u - * GNU General Public License for more details.) Z# F, T: @7 C' u* r, g2 V/ [
- */
0 u; p( O- l$ V. ^7 a - 0 x2 N6 e' `7 a; \
- #include <linux/module.h>1 H8 X/ ^) p; q" w6 k- w0 m7 R
- #include <linux/init.h>" V3 @6 ^. J i- x
- #include <linux/errno.h>
7 D7 p5 R4 x+ U% b' D - #include <linux/types.h>
- Q5 I8 |1 G, u6 ~2 a - #include <linux/interrupt.h>
, S0 C8 d3 R4 }! P; z ?+ [ K& z+ G - #include <asm/io.h>
; k. b1 ]( k: \. f K" i - #include <linux/moduleparam.h>
, u$ U# ~( u% S' V H z$ m - #include <linux/sysctl.h>0 @# ?# h2 p( C8 I
- #include <linux/mm.h>9 a' h. X7 S" b
- #include <linux/dma-mapping.h>' Y A4 ]" |# Q* x3 e) X; r5 U
) `* t$ M" h3 r m7 E" H8 ?- #include <mach/memory.h>2 [4 O+ @6 k$ z& I2 a5 D$ q' g
- #include <mach/hardware.h>' z& d, b" v6 `# P
- #include <mach/irqs.h>+ Z8 j" X; d1 Z7 _
- #include <asm/hardware/edma.h>
3 {' Q. P$ p( \. H" X9 F6 @ - - M" w$ `. i$ }& t9 ?
- #undef EDMA3_DEBUG
( A3 {+ b7 ^/ S% b/ B1 S - /*#define EDMA3_DEBUG*// U# [7 o" k; z$ Q/ f6 }
- " H. o. m1 D$ Z# {0 O
- #ifdef EDMA3_DEBUG8 r/ b9 N$ v) j8 e: ]0 o5 j' x* N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 n. d, }$ M, o. o, `* X) ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 G Y+ ~9 c. Q5 \# X' H0 r f5 o& ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 [2 h/ Q$ M3 w9 T9 N$ t: l) M
- #else# Z. O; L; @# S" l5 G
- #define DMA_PRINTK( x... )
! p1 l1 v* P) N, @: ` - #define DMA_FN_IN
1 k' W" Z2 t' o/ J; b2 O, s0 { - #define DMA_FN_OUT& W. d, B2 V3 I% G; O0 G
- #endif1 M, \3 E. M! E# a9 `2 k% l
- - Q, l3 S4 B- M- a8 f$ A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 ]- M. H- x6 T% H+ e - #define STATIC_SHIFT 3" [$ `; d6 y" b: W) j7 {
- #define TCINTEN_SHIFT 203 {& ^4 x/ G# d% s8 D2 e0 G
- #define ITCINTEN_SHIFT 21
9 `1 A+ ^& |0 m5 J - #define TCCHEN_SHIFT 22" M1 y2 V' h) ~: m
- #define ITCCHEN_SHIFT 23
4 w* ?; n6 S6 n* j `0 j
0 |4 s/ V- p* d% z' O- static volatile int irqraised1 = 0;. B. m+ T8 L& \, k9 ~. `
- static volatile int irqraised2 = 0;
; [4 c* X) o: K v3 P
, C6 [* H: C: c$ z2 w& T9 f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 x/ s: Y# F2 n0 r( } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ^$ M* i* o% L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# C6 Z: k" F8 V9 L, E6 v" [
- 5 l$ t6 K* `0 k; x. E
- dma_addr_t dmaphyssrc1 = 0;4 |* B# o/ w& ^/ l4 B
- dma_addr_t dmaphyssrc2 = 0; q ?) r R5 Y1 c
- dma_addr_t dmaphysdest1 = 0;
6 a7 {( v6 {- E* T; t/ W# F' w - dma_addr_t dmaphysdest2 = 0;# y% \8 k) @- ?+ R6 w- i
7 H: [( ]. \+ g- O6 I- char *dmabufsrc1 = NULL;
! t9 U! x( M2 Z) f" v, G - char *dmabufsrc2 = NULL;
. ~1 J) `+ r6 v9 i! d9 K2 | - char *dmabufdest1 = NULL;, i7 t' w& S8 ]6 r5 \6 b
- char *dmabufdest2 = NULL;
; \6 d8 _% Q+ w+ b/ p6 x( f$ S
8 a7 a- } S/ I+ \! l8 j- static int acnt = 512;5 C" |5 g! E2 A, B' {7 [8 R
- static int bcnt = 8;
# a1 C, V z! J c - static int ccnt = 8;( u) |* N, p! e5 {& q# K
- ; C$ D ~) r4 D& s$ @) r8 r
- module_param(acnt, int, S_IRUGO);+ a) b- H" {( a( e, d+ [. c
- module_param(bcnt, int, S_IRUGO);
( x" d# H1 K& e4 R7 v8 z! } - module_param(ccnt, int, S_IRUGO);
复制代码 1 ], W- c) t+ j* a# {7 U/ f
$ L9 Z$ e+ t" Y0 z' X3 M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ ?+ R0 y; j3 q8 z$ m, U% l" A narm-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 ^4 l$ N- I. \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: H1 F& [4 A a* r/ W5 ^( @6 r- c$ G/ W- p7 @
3 k3 e/ K. ?6 b8 M8 Z8 t3 z
|
|