|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ H! F9 S4 V7 A& ?5 H* S& }) C- [code]EDMA sample test application
7 @) p8 f3 P4 I- B) _. Q' ^# u - /*
7 W! r9 @# l/ H4 }- K - * edma_test.c. m% \- G+ v4 o4 B+ ]& p' [" S
- *
6 }8 a4 P. }! W; h5 u% y9 l - * brief EDMA3 Test Application
* i; d4 k1 o( @! ]4 { - *
5 h f) Z0 `7 M6 j, L2 N& i - * This file contains EDMA3 Test code., Y1 _$ k, T& N4 V0 r& R
- *
+ I8 l/ G, F X' V j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 g9 F, V% Q: k6 `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 k' Z" N: A, H0 ^ _- j
- * TO CHANGE." F {/ J/ c- B$ @( \% D( G: G
- * V: H$ S' Y7 A: i. e: |5 E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& D/ v8 f# [; N: u$ V5 ~ - *: A2 I- U* r' V4 G6 N* ]9 `
- * This program is free software; you can redistribute it and/or' I2 t1 B1 ~* c; W
- * modify it under the terms of the GNU General Public License as
* {& M: b( o% n* f0 k, r5 R$ i - * published by the Free Software Foundation version 2.
1 ^9 O4 E" d" U+ R - *
2 G% u% a' B. | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( L6 D- ^) H) X5 y6 P' M R+ N - * kind, whether express or implied; without even the implied warranty
, F- t/ J6 K: H: O/ A3 ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 s- e' R' b+ @& @* H! j- s - * GNU General Public License for more details." l, i2 t$ i$ a: F% N C- G3 t; M! G
- */
+ M7 u3 s( e; \1 [9 `9 I( {
' O) C6 c+ I- F: G4 K- #include <linux/module.h>
* o( ~& U1 d, f3 ] - #include <linux/init.h>
" m) e. A; e& [9 x - #include <linux/errno.h>
6 I2 n. N; o" b - #include <linux/types.h>+ X5 }; @* z- K. j7 s
- #include <linux/interrupt.h>7 j' w( j7 a/ _* x6 @, u
- #include <asm/io.h>2 k/ r9 B) I6 [2 D
- #include <linux/moduleparam.h>$ ^/ S1 d% a( V4 U0 G" R/ D
- #include <linux/sysctl.h>3 L! [9 p+ y1 z8 h5 O' W
- #include <linux/mm.h>
( u* `% T' {: C: Z/ { - #include <linux/dma-mapping.h>( K/ G! ^. e: [' }
- ) m2 W& t8 e( y
- #include <mach/memory.h>' V: F4 M( V! R/ M2 I9 l1 M5 y
- #include <mach/hardware.h>
! x+ C) W9 E' X - #include <mach/irqs.h>; W1 ^ ~' S; `
- #include <asm/hardware/edma.h>2 \7 w) i, ?# e, K% Q) U; `! o4 e! T
- 8 ^2 D8 `7 i D; |9 t( M; Q5 o
- #undef EDMA3_DEBUG9 M8 Q: c. I/ G/ T+ s6 y7 i
- /*#define EDMA3_DEBUG*/* c1 s4 Y- O! a# T7 p' O& V
3 d: S1 ~- a5 Y, c; A9 W0 ]- #ifdef EDMA3_DEBUG
O1 c# B; P( q% s0 m0 Q& O6 K! E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) c1 a2 K: f4 _, e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), J2 O: ]1 I8 o) Y3 q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( e/ R2 @& P, V8 P
- #else
6 S/ m" V! Q/ {6 R3 U, W$ L7 Z! I - #define DMA_PRINTK( x... )( a/ d$ M g8 m" ?
- #define DMA_FN_IN7 b. n! H; V: g) Z( `
- #define DMA_FN_OUT; c G; X% [& M q6 P- ~
- #endif6 h4 @" ~' G. P c+ D7 |
- & ]; ?/ W: Q d1 r7 p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( P2 Y+ s3 w, \) C* V1 R N2 J# p - #define STATIC_SHIFT 3! W, f s( \2 U( a7 x; a% u5 A. x" N
- #define TCINTEN_SHIFT 20% e$ r' D2 m' E2 _; i) ]/ D6 D
- #define ITCINTEN_SHIFT 212 H7 D% P4 K/ w d0 E
- #define TCCHEN_SHIFT 22/ c$ A a3 S# u0 \8 c0 c) a; ?
- #define ITCCHEN_SHIFT 239 j M; m0 ?2 q. v, C ~3 b$ U
( P- M$ I, G; ^: h/ z- static volatile int irqraised1 = 0;7 G$ K8 j3 d$ Z- [! R U
- static volatile int irqraised2 = 0;
9 N( d, J5 _; r w# u3 t6 y - ' T3 K) X$ a& X9 Y. i1 G9 B, g' i) B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 `( p; o) U( F. M0 e2 r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 ?# d2 p4 m4 E$ L8 s5 q$ e: e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: x7 o. h% z' x( }
- ! @1 B) b4 R: B) q4 x: R
- dma_addr_t dmaphyssrc1 = 0;% g' ?- [' C3 T$ ]5 O
- dma_addr_t dmaphyssrc2 = 0;) e& d$ z3 h5 e2 T
- dma_addr_t dmaphysdest1 = 0;# a5 r8 F/ r9 A) d# }5 I
- dma_addr_t dmaphysdest2 = 0;
" v0 N; P% \8 J" P% f7 z - 5 Q# i6 _9 z* b. ^" O' V
- char *dmabufsrc1 = NULL;5 [7 Z+ R' }; G) }8 j _
- char *dmabufsrc2 = NULL;
3 y" d. {" [; G' m - char *dmabufdest1 = NULL;
5 c; [# M0 Y. j0 F- y* D; r - char *dmabufdest2 = NULL;
3 m3 w) ^! i, M; V% Z% [
3 y Y( N$ T% M" Z6 {' s+ ~- static int acnt = 512;
6 ^8 P& ~ r8 j, Q - static int bcnt = 8;
$ R" _, V; H$ m* u+ n: R9 R1 I9 Y - static int ccnt = 8;
& ?. f+ m- B2 N- {" c - 4 Q' Z! p( C4 H# i# X4 i
- module_param(acnt, int, S_IRUGO);
1 U7 Z2 { c! h. w/ t - module_param(bcnt, int, S_IRUGO);1 a4 z$ \# Q" i% z
- module_param(ccnt, int, S_IRUGO);
复制代码
$ P9 X: y3 J- \( n/ W' X) z- }, G& o. k8 O8 \+ _* N, B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 g. ]) ?' I* ^7 G {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: G. q; h/ T1 I( a+ E9 ?* P# O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
W) b1 f/ K: _: Z2 x
3 t7 b5 J9 z9 X% P4 C7 b- B7 Q# }) @' V2 g' M
|
|