|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / L# y4 m. V. ?" t
- [code]EDMA sample test application
$ X7 T0 n$ M) S - /*/ H6 _' h' b8 n9 Q( W
- * edma_test.c: d! `/ ^" S: L! m* X
- *
1 x9 ?2 \" f8 X5 i1 p - * brief EDMA3 Test Application
: ]1 U" |4 y0 m/ O - *
$ o: u! b+ O8 a R0 Y) a& G7 s - * This file contains EDMA3 Test code.
6 H) ~7 d9 Z% }1 k5 N4 G6 m - *) _, K$ V o ^! m" F/ ~# L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: }; u( m+ ~( f( H3 j' ~( X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& k. F4 M- R8 |8 B' ~7 v, g
- * TO CHANGE.
1 L5 T& D5 M" Y- _8 d$ h% B! T - */ U3 _# Q8 F) X# a' n4 U* m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 R) z m) x6 t) X - *
- b8 k+ H4 j& y( {! U9 W5 F% a - * This program is free software; you can redistribute it and/or
" g: N1 C$ g& G; @# g7 {# t - * modify it under the terms of the GNU General Public License as6 l4 s+ ^& t- G! T
- * published by the Free Software Foundation version 2.+ X& X6 l. M, @4 R8 ]
- *
0 Q1 i& B2 r& k7 |6 |4 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. ?7 ]: b$ F& e; ^ - * kind, whether express or implied; without even the implied warranty: `9 s* F9 {+ S4 S; v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# C! c; l2 ?$ B! y. i - * GNU General Public License for more details.
# R3 k r/ U/ j/ x6 }: H - */; i- |5 H$ E8 W3 e. D/ h3 T
- # y2 d. a% ]9 b b4 L, @
- #include <linux/module.h>
# d q { e/ M$ ~: @; ? - #include <linux/init.h>
- I9 ^8 j) f' n- |1 F6 S - #include <linux/errno.h>. }$ u& X* ?% j7 N9 M1 Y
- #include <linux/types.h>
. E- d) J. d' {6 } - #include <linux/interrupt.h>3 C; n( y1 c& @# x) V& d
- #include <asm/io.h>
# x/ _+ I9 y, t9 _/ | - #include <linux/moduleparam.h>
0 K4 k5 T; L* B& e& m - #include <linux/sysctl.h>) ]7 A; D% d" Y8 i; k2 a
- #include <linux/mm.h># w6 P; J; T- t2 f2 I
- #include <linux/dma-mapping.h>- A7 s7 G8 l3 I
9 k% H) t3 f E. x6 n- #include <mach/memory.h>1 b1 ?6 I- b% U3 f; f/ J; d3 v. W2 U
- #include <mach/hardware.h>
; @+ @7 f# a' w0 z% j8 `' }( [ - #include <mach/irqs.h>! v# ?7 F+ L" }' k+ C
- #include <asm/hardware/edma.h>
. T& Y p! X2 k5 h# Z9 O# t5 R - 3 V+ G; J& v8 o% M
- #undef EDMA3_DEBUG7 ?% n3 `$ ^! s% g
- /*#define EDMA3_DEBUG*/% n" V- l" E3 _7 _" [! a
- ( e( V9 g7 W* B3 ?" B7 w6 x: [) b: C, e
- #ifdef EDMA3_DEBUG
& E& `" L- ?: T8 X0 j6 A( H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" h% @* Q' }7 c/ w1 x6 e& B/ n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& [9 O- o: u1 S6 G1 h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# J4 Y L) V, X \, F4 o
- #else
/ y' N2 t5 p* D- i$ v) F( R - #define DMA_PRINTK( x... )0 i. c+ P; A3 w3 e
- #define DMA_FN_IN
. |2 I7 E$ Z0 e7 v - #define DMA_FN_OUT9 \4 m; `% @& u9 b. H; ]
- #endif
' [% o4 k3 }+ W0 C. `: D0 K
0 @ f4 b9 }5 C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# u+ b E/ N+ a0 J1 m( m - #define STATIC_SHIFT 30 Y% N Z% _3 \
- #define TCINTEN_SHIFT 20
& `& p: W) J7 ? - #define ITCINTEN_SHIFT 21" Q: K i( N: F, K/ e
- #define TCCHEN_SHIFT 22
8 I* \* O3 X% |* j: Z& R( D - #define ITCCHEN_SHIFT 234 _" q& M; {* M9 C, c, z5 t* @
- 1 p5 y" j5 [. l6 ^/ b
- static volatile int irqraised1 = 0;
/ N* \$ `; c$ }% y - static volatile int irqraised2 = 0;4 l0 \: G. I, F8 x+ u! q$ ]# y' s$ K9 M
- 9 O# \6 ?+ v# r/ P. b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); c( k9 K7 ]2 W* W6 L3 b" C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 O2 z( c6 N. h l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 _: w( q9 D% w8 G& g; w - 9 Y1 J0 X; X- c2 Q6 Y
- dma_addr_t dmaphyssrc1 = 0;
' U$ k( T& d8 E$ Y! A" V/ I - dma_addr_t dmaphyssrc2 = 0; X8 R1 L5 U0 Q5 T4 @
- dma_addr_t dmaphysdest1 = 0;$ v3 }' G4 U8 u+ m2 M
- dma_addr_t dmaphysdest2 = 0;2 g) F$ N0 q. S ^! R+ `
% j3 T' J2 l: h3 y) w l" Z- }- v- char *dmabufsrc1 = NULL;
, `0 H8 P. d$ I- T6 S6 ~' g - char *dmabufsrc2 = NULL;% M5 u. [. N& G* X' L7 d) @; K" h
- char *dmabufdest1 = NULL;
' B2 i9 z4 \/ b- T& l - char *dmabufdest2 = NULL;* A* D7 f" n3 q3 R; F4 ?9 _! f
- 1 e2 @6 h& n, x7 F
- static int acnt = 512;
# N3 V6 K3 w, p$ f$ ? - static int bcnt = 8;5 q; ^! t, F: b
- static int ccnt = 8;
" o5 S# R% N; l/ `# v' F- M
& N8 n& J' ^, R* b' Y' M r5 l- module_param(acnt, int, S_IRUGO);! `, f, c; w' x2 W* C" C& l
- module_param(bcnt, int, S_IRUGO);1 V7 s& A6 L# ~6 l3 R
- module_param(ccnt, int, S_IRUGO);
复制代码
! c" g! o X& R6 @
: A% [* V1 J- i% r0 c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; C6 s; l. r5 K: L" e+ c- J5 W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ z9 [7 ^" E; y+ M P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 w" v5 H) ^/ _4 X' ~: N) g/ o" W4 H0 a* r; ?
) v2 P7 w, ]; p v5 c8 u
|
|