|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % y; U4 I0 a" }% p
- [code]EDMA sample test application8 m. P# m8 k0 o/ @1 w4 A
- /*& t" H+ n( n, X2 {2 o' w: i
- * edma_test.c
' V4 L1 T* w; ^7 m6 f - *- b5 D, m3 j+ }8 y, M0 W, f" v
- * brief EDMA3 Test Application$ Q; M2 G8 J5 ?& U% Z) B
- *
1 b9 y/ \ `" T2 J0 w' N6 }$ \ - * This file contains EDMA3 Test code.' O! ]3 p Y" d r
- *. j: E; I( {3 P2 ]% C: q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE l) v- B: |: q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 T4 F/ L J$ t1 ?% U" Z0 i - * TO CHANGE.8 E* q6 r/ x3 S! X% f
- *" R9 l5 _1 T# r/ U$ X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 j7 m- ~0 ~. a - *
5 D) C, k# O- `7 v P - * This program is free software; you can redistribute it and/or: W: w% b4 [) P- c0 y5 R" U" v
- * modify it under the terms of the GNU General Public License as7 ?& P0 L# {! M4 [5 a3 K# d* k
- * published by the Free Software Foundation version 2.
5 b0 S; l& F% y+ L5 V p - *9 s4 @) [' Y9 O9 X7 B. }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 o4 s- U+ f/ l4 q, P
- * kind, whether express or implied; without even the implied warranty$ ]) g P( w* \$ B, O1 L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( m2 ~0 q5 F, I4 R2 E1 n - * GNU General Public License for more details.9 _7 `: K @& Y2 q5 j
- */8 k: s1 e+ H5 V$ L7 z
4 D# m/ C- L' g# o3 J% o- #include <linux/module.h>+ x! `# M) t9 f) A# A
- #include <linux/init.h>$ x3 ~( \! ^, i+ [1 W8 D4 W3 P
- #include <linux/errno.h>
9 o% K( k. u) v- o" U - #include <linux/types.h>
; R7 z8 C- _$ G5 @. v - #include <linux/interrupt.h>
( i- b" e2 y% P6 Q8 y. s - #include <asm/io.h>
& T" D! s( K6 _ - #include <linux/moduleparam.h>( ]+ A# h) v4 \ e6 W+ @ e4 J
- #include <linux/sysctl.h>
4 Y# h) A8 b+ a - #include <linux/mm.h>
4 S7 j! C: w b - #include <linux/dma-mapping.h>
: F. w: s4 D5 |* a" r$ h e6 s
" `) s% s0 Q& A, e* X2 `- #include <mach/memory.h>8 k, n9 }/ E I' h& i) F
- #include <mach/hardware.h>6 B! d& v4 q. I( ^2 ~# S
- #include <mach/irqs.h>1 h: L; V+ H ~
- #include <asm/hardware/edma.h>
- T$ ~% f3 e+ O( j0 t2 t
( f5 f" N" V* V7 ^( ^& U( E X- #undef EDMA3_DEBUG- O$ l) ]6 |$ `6 m) Y
- /*#define EDMA3_DEBUG*/
" C3 d9 M+ Q. s) m3 Y
2 i( Y" `9 ^$ ^, p" u- #ifdef EDMA3_DEBUG: y7 x! R, q; F) e2 [0 {6 n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" f! M# j. a$ I5 N4 G7 y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# H$ s4 r6 b7 w! H* s+ P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 G3 G2 U3 E/ b/ ^
- #else
U& t& j- `) q' X* y* K6 U1 M - #define DMA_PRINTK( x... ). k7 @6 u2 b3 D1 R( A& J+ c9 ?# R
- #define DMA_FN_IN/ b; ?* x i5 I% h9 j
- #define DMA_FN_OUT2 k# A7 F8 B$ l6 B. M* j& o8 f
- #endif
1 @ i( b9 Z$ y; H) X2 K; l - . }) b0 [' ^ D l1 q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" S4 b/ h) V9 Q w* e. s! Z - #define STATIC_SHIFT 3
" | n' \ u1 e1 P/ _ - #define TCINTEN_SHIFT 20
! `7 y: m! {4 ~# X8 M! }, Z N - #define ITCINTEN_SHIFT 21* Z n0 ]* L! o( J" K! a' ~; U
- #define TCCHEN_SHIFT 22
" h9 `3 \- `6 e8 u, a, O - #define ITCCHEN_SHIFT 23/ p- W: l0 @8 m
- 4 N: s( E: B" u! Z |3 V
- static volatile int irqraised1 = 0;
/ @' I, Z7 K8 n/ i( ] - static volatile int irqraised2 = 0;
8 d7 s, J4 a. s# U/ Q" Z! a1 ] - 7 W5 b( _" {4 B& Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 _4 E# D1 y" Q0 _7 X2 F7 T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ]2 Z$ d' m0 C) R. b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 W( k& G" _: E, v+ n( n - # b" J/ |# E- h7 {/ X/ D# ]% \
- dma_addr_t dmaphyssrc1 = 0;
( _% t; q6 l R0 R7 N$ E0 s; r - dma_addr_t dmaphyssrc2 = 0;
/ m+ c/ d4 U" n; k1 _ - dma_addr_t dmaphysdest1 = 0;, \6 z/ H/ F% R% O+ o2 _! U
- dma_addr_t dmaphysdest2 = 0;
" P, X* I6 z) \1 j0 B5 W
8 N5 x; W' v& O4 j3 ^# t8 P/ x) ], c, l- char *dmabufsrc1 = NULL;' G) `( l% m4 Q
- char *dmabufsrc2 = NULL;$ u* w8 g* r9 i9 ^% ~( f
- char *dmabufdest1 = NULL;
- g% \+ B" }5 \$ p - char *dmabufdest2 = NULL;7 r* d8 n+ c- @0 b' {4 e! r! z
: Q& c3 {1 M3 B9 e3 t {- static int acnt = 512;
, L# u" g; \; d* e! R% P& |& h - static int bcnt = 8;! M: W! p( a9 s( r( j5 {6 c
- static int ccnt = 8;/ n4 k* S/ ? h1 L! q
- 9 }. U W( f9 }8 W& ]( M
- module_param(acnt, int, S_IRUGO);
* b9 G6 G9 k/ l5 E- z - module_param(bcnt, int, S_IRUGO);9 z" t2 Q$ v& C. `" X% W, W
- module_param(ccnt, int, S_IRUGO);
复制代码 6 }/ e' `: R( m7 X- Q
4 B5 N* ^, H+ v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! O+ h5 |, @; v' d- F8 O' z' {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' ]/ y) D2 ^9 y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ l" q% E& ?1 w# U* ?: W' Q+ ?
! E* {- k1 n0 b' |9 H0 j% [9 u9 I1 x/ M$ l9 X7 Q
|
|