|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ o$ u" K! [6 L' r* j- [code]EDMA sample test application6 {: e/ @9 Q9 F" Q' ]9 u( [" M+ j
- /*' U0 ]* X |# N. L" D
- * edma_test.c
9 u5 u( V8 u% a0 q& D) S - *
" m: w$ k" a/ d7 G - * brief EDMA3 Test Application
# @% v! T) z& p z I - *
) [' _/ R2 Z4 O* p% Y5 m - * This file contains EDMA3 Test code.
7 \& n- \3 V8 y! p2 o% b0 |' m - *1 x+ m) i6 F& P( r/ I/ D2 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 u/ ?' _; v8 Q- L0 s* y9 ~1 ], n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ x# H5 P& L; e1 G& o
- * TO CHANGE.) z( r' H+ E; {+ q2 h
- *
) _: V7 s" u. G$ E" N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// `9 T1 M/ y3 J) @0 Y
- *
( r* J- p5 B+ \7 h5 } - * This program is free software; you can redistribute it and/or
, D8 l8 n, H" n" a% i8 Y - * modify it under the terms of the GNU General Public License as8 k# P H; H. o0 g+ }
- * published by the Free Software Foundation version 2.
- @/ M8 z* R# [* d% B - *
, R& ?) c9 |+ X4 ^/ Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' b% s$ Q+ j( ~: \
- * kind, whether express or implied; without even the implied warranty
' J# s# ]/ S0 T$ { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# o. T4 ^7 f7 S* u - * GNU General Public License for more details.
% R5 i. p1 D. G- u) C) H/ v: L2 E' w - */1 N+ E) x5 H1 i
4 R. @ i8 d1 t& @- #include <linux/module.h>, K5 [( I5 E3 D$ a3 [' y
- #include <linux/init.h>7 [9 Q+ X2 V" e1 E2 c
- #include <linux/errno.h>* `! X& D6 b# G4 E0 w/ M7 Q
- #include <linux/types.h>4 b8 d0 O+ w' T1 ]9 v% e r
- #include <linux/interrupt.h>/ e6 `5 L. X( k" D/ f( T+ R6 u2 H
- #include <asm/io.h>
; t/ h, S$ s3 r/ x2 }1 e - #include <linux/moduleparam.h>9 ~7 l* g4 U7 V c3 W
- #include <linux/sysctl.h>, j; g% y2 J! F/ Y* l7 T' ]8 d
- #include <linux/mm.h>9 F$ l1 r8 W# N' n, n/ I" S0 g
- #include <linux/dma-mapping.h>
- O* u# q q+ s- c! l1 d
" F8 K2 M" n# {# [# g- #include <mach/memory.h>
( _7 p) }& H3 \( v2 w+ Z - #include <mach/hardware.h>7 }# t ]& z8 ?- I7 B) A
- #include <mach/irqs.h>3 e# |5 d8 W' ~+ @) y& I
- #include <asm/hardware/edma.h>
' U0 e* y! Y! R$ i- J! F - . F3 A3 ], ]" |% ~" J, r
- #undef EDMA3_DEBUG
2 V8 _+ D' q& _5 B1 [$ b$ S - /*#define EDMA3_DEBUG*/
6 Q* f7 N7 c) l' S' } - 8 [* U; x5 C7 e" ]& a: f
- #ifdef EDMA3_DEBUG* T) v! Z( O; j2 j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! A0 I+ y0 i8 Z* y6 I6 x# _/ F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' N, i- ?/ I* `; j! U2 ? I2 ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 W! ?, ^6 N( O% s2 v h" k - #else
$ e+ X9 |5 E& g. x - #define DMA_PRINTK( x... )
: G/ e6 N0 Z, H - #define DMA_FN_IN
$ ^5 U) [7 o3 d; h" N2 a' K8 }/ l - #define DMA_FN_OUT- d8 K8 Y9 W/ Q7 t/ ]( f& `! \
- #endif5 R6 c- r" L/ T- {: y5 N) y. b$ @8 P% s0 F
- 6 s# T; z$ |1 j) L" V! c3 _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 F9 A1 U( ]3 ?
- #define STATIC_SHIFT 3' p: H* A! `9 T
- #define TCINTEN_SHIFT 20
! p. s: [$ Y$ Y - #define ITCINTEN_SHIFT 21& U7 S# K- }- t5 `% z- s
- #define TCCHEN_SHIFT 229 D8 ~7 M8 k: B/ q
- #define ITCCHEN_SHIFT 23
- f1 X! u' i' w9 t0 y
2 J2 C# z" T& _ R' R) G* w- static volatile int irqraised1 = 0;$ S; j( d, x# d1 O7 V& W
- static volatile int irqraised2 = 0;7 B2 \. T1 ?5 L: y9 z
- " O% X' f) }( J+ c4 [( c" q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( u `1 C$ c: l- T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 {( \% D5 x3 r+ G+ v+ d3 J# e5 P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: [% r* W& a8 H5 ?+ G4 K! b
( u9 m! d) r: s- dma_addr_t dmaphyssrc1 = 0;
7 \$ ~ Z! X! f) A% r+ f - dma_addr_t dmaphyssrc2 = 0;2 c) Y3 Q, S) C, w! `& F
- dma_addr_t dmaphysdest1 = 0;) D4 f0 r; k8 d: m5 j
- dma_addr_t dmaphysdest2 = 0;
8 E" a s, D3 X n4 N8 i& o - 1 j h. M9 m% G" i, w0 r& K
- char *dmabufsrc1 = NULL;
v: `1 k% y; w, B* f - char *dmabufsrc2 = NULL;
* @9 N7 R/ Z, o; K+ z - char *dmabufdest1 = NULL; w" B# D$ x) K6 T& e6 O: O
- char *dmabufdest2 = NULL;
* Y4 w' e8 `9 m, X/ t
( q/ i* |4 n- W& ]: Y! g- static int acnt = 512;1 P6 ]( O' l3 X$ X. x @, f2 Y
- static int bcnt = 8;
9 g: S0 T6 O3 l1 ^* B2 j - static int ccnt = 8;4 A% `0 P: [" Y% a4 k
9 r: p3 ?# G% X- module_param(acnt, int, S_IRUGO);
! ~6 S8 o7 ^$ _/ x - module_param(bcnt, int, S_IRUGO);
+ x8 C1 ]3 B* {' L; t0 Q' v - module_param(ccnt, int, S_IRUGO);
复制代码 7 M+ [! \. K7 I/ Y& [
9 t$ F3 ]3 s( d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# u q7 H, ]% \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 A) v( Z; t4 @$ G. a+ _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 Z: z. e) p' U3 f# V
' q8 s, ?; f: Z( ]0 X
% J$ q- p( F+ W4 @2 W |
|