|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , Z# \; X9 z8 ?% `/ g4 T
- [code]EDMA sample test application
) P( F9 n% g" E/ @$ X( U- ~+ f - /*
! k" ^ e* ]- h3 p; K# j0 u - * edma_test.c
; @: n- u5 e9 T - *
$ {- `" L5 H& {# B$ L8 T - * brief EDMA3 Test Application
" i" m }& U. ^ ^: m - *2 O& h( B7 X1 \$ O4 U7 g
- * This file contains EDMA3 Test code.
I- a I2 l; A7 A# ~ - *. T+ t3 Z( J6 W: x' o6 t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. f- Z& I( \1 N& \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 W2 L0 o% H4 ^, V0 a2 ~6 L9 }: |* q
- * TO CHANGE.
6 F2 L7 C! \- w \6 e) b - *
% ~4 x' P; M* I: ?' L# h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' a' P8 W2 P c. r$ h) M. |) x1 f8 [
- *$ I: j6 I N9 |0 _: `* ~) q
- * This program is free software; you can redistribute it and/or
0 o; e$ V" m3 ^6 u: X3 d6 W - * modify it under the terms of the GNU General Public License as" x/ e e/ V7 q% y3 ~9 E
- * published by the Free Software Foundation version 2.
; Y; P6 J6 o! W; c% j- H8 { - *
9 C! H2 x+ ^! o1 `& X" W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 N6 t9 `7 W6 Q) I: g* C - * kind, whether express or implied; without even the implied warranty
0 s+ K& L( N8 p& U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 ^3 N# ^* M& X
- * GNU General Public License for more details.$ F, d. t5 q. U' R L
- */
4 a! g# {/ D: c/ V; O
; [5 m) C$ S; \, G- #include <linux/module.h>: m# Z7 \" u4 S6 G: }9 i& o
- #include <linux/init.h>2 Q7 m$ j) h3 p1 F. o6 S7 N3 l3 ~
- #include <linux/errno.h>
+ B1 _6 |$ Y8 e u1 a9 k - #include <linux/types.h>) Q, y! K) Q; N& F7 I0 C* Q
- #include <linux/interrupt.h>
8 a1 j5 N d# n) \5 F8 G' Y0 v - #include <asm/io.h>: S! }' v* M6 E- [; Z
- #include <linux/moduleparam.h>
% G' q& K9 x h; q - #include <linux/sysctl.h>) G# i0 C- [. k0 U
- #include <linux/mm.h>6 f* R: I& j. |
- #include <linux/dma-mapping.h>& S5 n+ q. o- T# J( c1 J8 r
) P/ E8 h8 l5 U. [3 Q- #include <mach/memory.h>
, W& {5 l) X1 a - #include <mach/hardware.h>
' G5 x& O: _; u7 A0 a: w0 J - #include <mach/irqs.h>7 p9 f! Z( x* p% l* {- @3 ^
- #include <asm/hardware/edma.h>
: i/ V* M& l; X M - 6 S( E6 V! J/ c$ ^3 g: s
- #undef EDMA3_DEBUG0 d2 V- v: }) d0 |
- /*#define EDMA3_DEBUG*/
# W& t. f! M3 @$ D9 T* d
0 {. q C" b- k& Y7 n- #ifdef EDMA3_DEBUG
6 z7 l( S: @. G/ _4 v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. v+ S6 w- |6 y, I0 M" d8 i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# N" C* X' V5 _$ Z- F( H1 q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 d$ O4 y5 G; e2 w. Z0 o - #else
/ W/ W, S: D. ]0 y5 H6 U9 Y: D3 ] - #define DMA_PRINTK( x... )
; c% [5 M6 |7 {6 o - #define DMA_FN_IN; T9 v4 d- u- d+ ^1 [! v9 {. w3 V! l
- #define DMA_FN_OUT
1 |3 r# s/ ?: k' [* K" o - #endif
; u) A6 y1 T8 \+ R+ |- Q0 T - " Y$ l& L0 _1 b1 {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# r* ]. t+ H: b: R! ]' } } - #define STATIC_SHIFT 3
# ~( R+ l+ F5 l: W6 k4 x# d& ]9 Z - #define TCINTEN_SHIFT 20
. J, c8 s! ?- t3 ^ - #define ITCINTEN_SHIFT 21. D' Q; ` m6 [4 h% c
- #define TCCHEN_SHIFT 22; [. X! M4 O, A3 I4 ]
- #define ITCCHEN_SHIFT 23
+ T; F# A7 w4 S7 W( G5 d - ! d2 n7 S. [8 h. W. X1 q
- static volatile int irqraised1 = 0;" S$ A" P1 A( B3 r9 s8 x$ S
- static volatile int irqraised2 = 0;
+ W; v: G6 Z2 i) l* O - " Z5 H9 e3 t! h. T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" Z( F7 z2 R: u) k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 } ?. e5 z4 ]7 K. `0 y7 _/ I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" G4 }/ Q6 R; E/ K
- f0 r/ R& x& J! {) b8 e6 x) h- dma_addr_t dmaphyssrc1 = 0;
$ \! J8 a0 B) V& Z& O$ j A - dma_addr_t dmaphyssrc2 = 0;
' k4 O5 I/ J7 Y6 Q( N - dma_addr_t dmaphysdest1 = 0;
, E# b0 ]) G! K7 l; N - dma_addr_t dmaphysdest2 = 0;0 d) a/ Z( ^1 A6 w. `/ Y
0 M* g6 ?' n; w0 q4 J, I/ F- char *dmabufsrc1 = NULL;) G4 H, H7 @9 Z. ] A7 P
- char *dmabufsrc2 = NULL;
. [/ P4 l8 D. v8 ?( G! U" W9 x - char *dmabufdest1 = NULL;4 p* w' q0 F, z( D& n- V. W) @
- char *dmabufdest2 = NULL;, ? D$ a; M( Y9 S
7 A. {9 p3 ]) o* i" N- static int acnt = 512;
, R& K/ |) Y# [% x5 W - static int bcnt = 8;
* V9 t; {' w/ a5 f - static int ccnt = 8;
: X6 n, J, L* c" A) q N1 m
+ \# s* t7 Y' { t. X2 x: W- module_param(acnt, int, S_IRUGO);# l: {7 w. M, p9 p0 L
- module_param(bcnt, int, S_IRUGO);
6 M: }7 e2 Y2 X - module_param(ccnt, int, S_IRUGO);
复制代码 ' f& b( M8 O( F6 y6 c: O5 B. A" M
" @. i- ~9 o+ a8 J3 @' ~) E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# O) T8 k. E9 o4 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' U* i7 Y- I" t2 Q' H ^0 G* v- `, A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ ~) O) X6 B2 W3 g. x: o( f% V6 c7 r
( n5 T3 g4 \9 l3 _( v
3 s. ^( B" X0 p6 ^. H |
|