|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 F v' }5 D' Q8 s _. C! [- [code]EDMA sample test application
! @7 s- c' b7 v) l: P - /*
! m2 R- o2 s$ P* ]( H( B5 O - * edma_test.c9 h0 a' Z, x: z$ Y
- *
9 Y, r9 |2 F9 a8 }0 c - * brief EDMA3 Test Application
6 ?2 R3 j' D6 C$ x D% A - *
& C& x3 L9 `: V* A! K, |" D - * This file contains EDMA3 Test code.1 U9 s% d' m7 m* i8 I/ Q) Z# o
- *& W" z6 g( u$ D- C& q: p- R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 n6 S2 q: V4 R. ^: J! z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
[. u w1 f7 Y) F H6 d+ i: o, b - * TO CHANGE.) O: n9 \7 ~1 q6 ~" {. J
- *
% o( B( E0 W( T! | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 s4 s+ o6 {/ t* v. G - *
7 O' H& k. l2 ~( d( M% ` - * This program is free software; you can redistribute it and/or% v6 a% z( a. S7 h7 m
- * modify it under the terms of the GNU General Public License as. L! y/ U2 y" A2 D2 v$ s" ?7 T
- * published by the Free Software Foundation version 2.
$ g) ~, ~: R* L$ X; @: s8 K - *7 j8 z$ b! P" _! E7 k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 G+ O5 U; @# T6 z - * kind, whether express or implied; without even the implied warranty0 U: y7 h$ I6 _6 P8 F* O8 @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 q, C5 {: I/ q' h
- * GNU General Public License for more details.
6 _' i9 Q" g. w! C. H } { - */ E; ]$ z) a9 l9 r, E1 g
- % I* q x- T- e
- #include <linux/module.h>
0 U+ E, }- [. Y; { - #include <linux/init.h>
" Z$ A% ^5 M3 |+ B$ u - #include <linux/errno.h>; y. v% e+ {2 k
- #include <linux/types.h>( r& s1 p q& Y3 B$ E
- #include <linux/interrupt.h>
* Y ` t8 P: |$ B# S( H - #include <asm/io.h>& C f; B# ], f4 ~& d. i
- #include <linux/moduleparam.h>6 P; J: H3 F$ C5 `. J
- #include <linux/sysctl.h>
2 I$ w# o3 I; S1 C4 @+ }3 p- i - #include <linux/mm.h># @$ |$ ]' ^3 F0 n* n7 e# ~/ d9 d6 a
- #include <linux/dma-mapping.h>
" _1 F9 T) a y1 ]# p5 q - . l6 B$ K8 j5 B8 T$ u/ }/ K
- #include <mach/memory.h>. \; q8 x W6 q; p; E) _6 t
- #include <mach/hardware.h># H4 @; c1 a! r' g) g2 }& j
- #include <mach/irqs.h>1 z" w. U3 E0 b$ F) p t8 w+ a4 _2 z
- #include <asm/hardware/edma.h>$ |: s$ c) ^7 [& _8 B
' r! r: {* {6 |- P: s4 Y* k" Z- #undef EDMA3_DEBUG
& Y0 L" a; a) H6 _- I - /*#define EDMA3_DEBUG*/
x' z6 ]( I4 O0 W" F6 q - 5 U6 H4 c3 }- z5 b3 c
- #ifdef EDMA3_DEBUG
/ ]9 C" ^# q( y- D- c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 ~4 x. ?7 ^, e0 l& y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 @; w) y0 }- E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 Y% J2 m, O3 U( ^/ L8 p6 u @$ }
- #else
" J7 f. D7 u# ]9 v - #define DMA_PRINTK( x... )1 T* r! N; m$ C/ }* n' V
- #define DMA_FN_IN* J3 M: Q! s2 L# L3 n3 h8 H
- #define DMA_FN_OUT( k4 P" g* T7 i8 K9 K
- #endif
- ]5 x* a( l9 k - + v, N& w' g: f+ Z/ H9 c6 E: S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 r9 N! k, s5 a9 G! u - #define STATIC_SHIFT 3
9 d6 d; ^, ^# x3 J- \ - #define TCINTEN_SHIFT 20
9 I6 e- e! K5 a6 V& ? - #define ITCINTEN_SHIFT 217 ~4 n1 f3 \6 C$ O V: W
- #define TCCHEN_SHIFT 222 q8 i8 P. j4 c0 i# C( ]+ @% w) t
- #define ITCCHEN_SHIFT 23' J2 }: A* g3 ]% i+ u
3 W3 [$ v( s6 I* S3 N- static volatile int irqraised1 = 0;) F& n3 O- M, @4 Z" d
- static volatile int irqraised2 = 0;, b: E E7 n8 b* o
- 4 I: d: @5 z$ \% q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 _+ L# u! C M/ @ o" b, l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* q( J, a6 |9 J6 [( _0 g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ A" _ e5 z. h$ _5 C9 M
- ^1 v1 }& \8 M8 Q: r* V
- dma_addr_t dmaphyssrc1 = 0;
% q$ p) D7 R3 e% B* M - dma_addr_t dmaphyssrc2 = 0;/ y" u" I& s% Z" M
- dma_addr_t dmaphysdest1 = 0;
0 @- O5 F# F( c9 `' {1 ?- y% q3 W4 G2 { - dma_addr_t dmaphysdest2 = 0;+ o4 V% P$ h" r: t
- 5 u, Y& q2 n- T* F$ z! U' a6 e& C
- char *dmabufsrc1 = NULL;
$ |0 S% `# Q9 |) r {8 T - char *dmabufsrc2 = NULL;
) d7 v/ I; J1 p, Y8 t3 o" ]6 O - char *dmabufdest1 = NULL;
) }+ v. e$ S- i7 h, l- q - char *dmabufdest2 = NULL;6 i( _: G" t; s
- " D: O1 _2 y+ @4 s( Y
- static int acnt = 512;4 T4 } L7 ?+ T- ]+ b3 M. Y) d/ _
- static int bcnt = 8;1 J0 _8 b$ F; v w* N S/ z
- static int ccnt = 8;! v3 T4 e4 ^5 w: U
% s5 d3 e7 r% A' _- module_param(acnt, int, S_IRUGO); ?) o) L6 j% V* L; t6 A: |) U
- module_param(bcnt, int, S_IRUGO);
% z/ p; _# U# s8 | - module_param(ccnt, int, S_IRUGO);
复制代码 & x/ c4 w# k( m& ^8 P% T8 ]) @/ G
c" k( D, s6 d: W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ i# T& x, u* M2 Y! [6 i9 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' p0 [+ |0 R% v9 g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: c O. {6 M3 }' e
7 O4 s+ {0 x ?* W) r
$ t8 n# P! n+ P# H |
|