|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: c7 c# Q& ]6 D% e+ h4 E0 r1 E- [code]EDMA sample test application
$ e7 L% n9 b! N - /*
: Y0 q4 _( P3 b - * edma_test.c7 q% ]% u g- {8 W' a; q, o* e
- *
/ H1 ~* P/ d; p; x9 k0 k - * brief EDMA3 Test Application& a5 \' A* x- {
- *# C' A- P1 n6 g9 {- j1 i7 O
- * This file contains EDMA3 Test code., e! A. O2 g6 i- f) y
- *
# F# r$ R, L( }" q" H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 u' K+ X7 b9 |4 u! h: T7 ^ n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ \7 [8 A6 }) O k - * TO CHANGE.! y, X2 X/ @4 w( X2 b4 D
- *8 K U! P$ A! J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& ^, }8 h6 G! N/ p4 J
- *$ I, q+ U3 C G0 z1 p, L1 x' }
- * This program is free software; you can redistribute it and/or
F; A9 F: O$ k) O. s - * modify it under the terms of the GNU General Public License as, R8 Q7 e. S a+ n1 @+ @3 i
- * published by the Free Software Foundation version 2." ?. Q* \" V' K' m
- *! j& ]) V3 D3 c) {6 [1 F5 [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 n& a4 s* d( ?) B3 l: p
- * kind, whether express or implied; without even the implied warranty$ b. T- N5 Y4 n' p0 i1 Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* s2 n% e3 y' F$ {# x7 L$ V: r& f( a - * GNU General Public License for more details.
3 P6 Z1 r1 A( r! U: i! B) j - */
" F& L3 `9 A0 ]: O" h3 N5 B3 V
) g; \3 N7 x# D- #include <linux/module.h>
: h' g- ?0 @" T L, A! | - #include <linux/init.h>( k+ [( t J) v# Q; _ R
- #include <linux/errno.h>0 `) T0 U9 M1 a2 ~
- #include <linux/types.h>/ y9 o0 k* S4 g
- #include <linux/interrupt.h>7 M1 @# p0 n7 }
- #include <asm/io.h>
7 i/ N0 Y3 D! t6 P - #include <linux/moduleparam.h>
0 {9 f3 W: s6 I - #include <linux/sysctl.h>
& ^ f2 ~" a5 ` - #include <linux/mm.h>
5 _9 v Z5 I8 `/ |4 r& M- D( \5 e% C - #include <linux/dma-mapping.h>
: L h4 f& I a$ E2 a" p2 B
/ F6 h$ f0 n, f/ R e- #include <mach/memory.h>1 \; g4 ~" i# f5 w. }1 s
- #include <mach/hardware.h>0 g( u5 B" F; z2 o) A
- #include <mach/irqs.h>
4 W1 }2 t2 {# U - #include <asm/hardware/edma.h>% D& j- f1 w p: y8 _8 a5 |8 e
- , u$ l6 W) G% k4 u
- #undef EDMA3_DEBUG
6 G, @9 `* E! I! g9 C* T# K M - /*#define EDMA3_DEBUG*/5 o" f$ a. {* z4 p, i( z
- - k0 C' j& Z: y$ T
- #ifdef EDMA3_DEBUG
3 j8 J" l. O3 I2 } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 M8 I& `; l. b+ W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 M; w% V6 p- {$ |0 ]5 ? I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% Y! x( X" v }; } - #else2 P O6 R. D: M- L
- #define DMA_PRINTK( x... )
) h5 v1 b! a! e& V+ X% | - #define DMA_FN_IN: v2 n3 w: m7 E1 D" I
- #define DMA_FN_OUT
! E. z# N3 s" H* x% m1 \0 J0 y - #endif
( C% a9 x- S6 j5 k - 9 M- d% K x# [: V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ b0 R! \, I1 Y* F1 Y5 D
- #define STATIC_SHIFT 3% y0 `# H8 V; M: u* `) }+ s' v' {
- #define TCINTEN_SHIFT 20" O; z1 h: d# d' G" A. D ~, c
- #define ITCINTEN_SHIFT 21
1 Z0 ^- w* [9 t F1 j+ W. ~ - #define TCCHEN_SHIFT 227 m' |& ` n* n; T* K/ Q1 E
- #define ITCCHEN_SHIFT 23' \7 N5 e3 p0 x, c6 z- O" R: V6 ~
4 Z6 k/ d8 V! W- static volatile int irqraised1 = 0;3 x& x+ q8 K+ I, y: r
- static volatile int irqraised2 = 0;
' c% B- z# ~# r5 e3 l& o1 Z$ B - ; |9 C) O* m) ]: u8 l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 G5 r& m4 M4 y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ P3 x$ m* A& x- | S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& z' w! X( M2 l" k
- / c$ e( X' i A: f; L6 @
- dma_addr_t dmaphyssrc1 = 0;& S* U& t6 C5 M/ D
- dma_addr_t dmaphyssrc2 = 0;
+ g5 Q9 k& I+ [1 o Q' r - dma_addr_t dmaphysdest1 = 0;( S* w6 m: R0 C' E2 q
- dma_addr_t dmaphysdest2 = 0;1 X1 A* h2 n' n2 I
- 1 B1 H+ @1 m2 |/ W) m8 } ?
- char *dmabufsrc1 = NULL;
- O! {& c$ _& ?# o2 I - char *dmabufsrc2 = NULL;& [7 f: @8 b& T6 j7 _# N
- char *dmabufdest1 = NULL;
Z; B( X) [8 T* F1 U* i9 N - char *dmabufdest2 = NULL;
2 ]+ i3 D: C8 d& _; |; s
" ]! [8 Y% E/ t5 ]- static int acnt = 512;) D6 {' c9 W/ }9 L
- static int bcnt = 8;
5 H0 S- M d( a# V - static int ccnt = 8;
; P3 k+ I2 ?8 U) ` O - # i% o3 z/ N6 e( D% i- D5 R
- module_param(acnt, int, S_IRUGO);; h! m9 C S6 r# t" [9 r$ S
- module_param(bcnt, int, S_IRUGO);
' P0 D8 m, e& U# L0 A - module_param(ccnt, int, S_IRUGO);
复制代码 ) {0 v( i# H" n2 Z% x9 S/ O
+ W6 l( B7 j: f9 N( k/ R+ Y% \6 |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( k( J$ K* C9 d' t) C$ p: L6 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& _$ I& f4 f1 r8 r! k% Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
J$ k( f) k; S% M8 N" _! {- e. y+ A) U' r( ^7 a
! d3 c x: o% D2 V' J+ V2 S: Y |
|