|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 o5 _6 P1 l/ E$ u
- [code]EDMA sample test application$ R, T3 N' R" s$ D- m t7 G- L8 G
- /*
6 W5 E0 O$ m+ n: ?- | - * edma_test.c" V% U d3 V; S B0 G. l
- *
3 A7 K( x* I& G+ x3 r f4 e+ d - * brief EDMA3 Test Application
# q T; H+ s1 K" G3 [ - *7 n4 y1 @ s6 s
- * This file contains EDMA3 Test code.! f3 d2 i3 k4 S5 o: u+ ?" H7 M4 Y
- *
; P* s# @, N8 a) h9 @2 U4 ^- g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 b l. E2 m* j' c/ n' o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. n5 f9 s2 j$ _. x! Q7 T - * TO CHANGE.! A1 u( f' ^) N$ R
- *# ^- \9 v& o$ C- W) j" \/ y1 k& M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 X6 K5 E6 H5 B
- *
- _5 l0 T6 r; p" a - * This program is free software; you can redistribute it and/or
, m5 E! \# m) J8 `! e; ~7 v; Z - * modify it under the terms of the GNU General Public License as: n: @/ K% S$ W0 M4 e
- * published by the Free Software Foundation version 2.
0 B" E% b9 u% Y6 C* T; r& @ - *
4 j4 T$ u! c2 X8 t' E; s5 q7 Q* c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" q4 d* ]: ?9 _& Y
- * kind, whether express or implied; without even the implied warranty* w3 w/ A- i. c: C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ F* p6 ]1 O5 H/ d _
- * GNU General Public License for more details. ~ [) b, ?; Y! a! }0 T, g! ~
- */
2 }% J# k5 e- s1 J5 p - 9 h" k6 f- O/ g3 e5 |8 q {. }3 ?
- #include <linux/module.h>
. K, O; Y# d' y - #include <linux/init.h>& `; V" v% |' Z4 J1 D7 I' [
- #include <linux/errno.h>
& T J; |& Q0 \2 q w- N3 I2 V - #include <linux/types.h>/ g e6 v2 K' b
- #include <linux/interrupt.h>$ Z4 k. | E, b$ r5 W( h* C" }( _
- #include <asm/io.h>
2 P' G T. | X8 a) m) v - #include <linux/moduleparam.h>
; L L% A8 `* \3 f9 t) a& o - #include <linux/sysctl.h>
4 i5 o+ B: G% X- c& X Q8 P. ~ t - #include <linux/mm.h>
( ~$ I1 G9 H- | - #include <linux/dma-mapping.h>
) f/ O O9 G; |' c
% L: D( ?, B0 Y1 W- #include <mach/memory.h>9 l: B n; m( T# q3 T
- #include <mach/hardware.h>
' {) _8 [" w c2 S/ k - #include <mach/irqs.h>& h2 L: T% f8 Y1 k% _# D
- #include <asm/hardware/edma.h>
7 h1 ^" ^- j- e( _. ~! h - 8 l+ i, E" w) j d/ D/ X: P& O$ Y6 u
- #undef EDMA3_DEBUG! i' j6 N1 {) M1 j. U+ W3 D
- /*#define EDMA3_DEBUG*/2 H+ e" N. x% p6 F/ Y1 M
- " I$ d/ v! L: ?) n/ f% c {2 E
- #ifdef EDMA3_DEBUG
9 S G) S; g! D3 I6 o$ f' u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, }+ O- E0 I( a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' ?, `. j* ?0 k4 T7 [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 h( \. H& w& E" ^# s
- #else ?+ A" T6 A l j# A
- #define DMA_PRINTK( x... )
; R% u2 [- {0 F; r; c- U& @9 j - #define DMA_FN_IN+ P) b$ p+ a5 W- n
- #define DMA_FN_OUT
; S( @ Y% ?5 g6 ^- d2 S: O - #endif
- z" {+ N. m* m3 a - 0 P! z. d: U; _. C% I$ y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); i: p- B& a, u% R
- #define STATIC_SHIFT 3
8 l( P( V8 X- d7 A/ @: M5 f - #define TCINTEN_SHIFT 20 u: u$ X; x! M" z5 N6 s
- #define ITCINTEN_SHIFT 213 S1 N4 |7 {5 X' H0 a
- #define TCCHEN_SHIFT 22
/ \& w) W& N2 m- S5 n }+ j5 H3 s - #define ITCCHEN_SHIFT 23, O/ L. |- t3 z' q8 ?- G
- ! {9 l" H: J/ M6 M5 v
- static volatile int irqraised1 = 0;
) k; b' G# @( I: |" O - static volatile int irqraised2 = 0;
2 `9 R( Q3 o6 R C$ M- [ - 6 U0 K2 i0 H7 Z+ X; X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- `2 N( W$ V0 q, P2 x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' f2 ^) x$ ?5 U4 c3 @0 n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! J. w( F% |0 j! _
3 P, h9 J4 _7 n- dma_addr_t dmaphyssrc1 = 0;: L* M4 G6 z- }+ r$ j. s0 ~% G5 l
- dma_addr_t dmaphyssrc2 = 0;
2 x) X4 F4 ]! v9 ^& j4 H6 T' a! h! @# m5 W - dma_addr_t dmaphysdest1 = 0;
. j* V3 {9 }) J( `7 k! z, S* N - dma_addr_t dmaphysdest2 = 0;& O+ p+ I: H! n
" v6 W1 @! \- [/ ^/ b9 p1 y- char *dmabufsrc1 = NULL;
- b2 T( S5 @4 O" f7 M - char *dmabufsrc2 = NULL;4 {8 o% Y7 j+ ?
- char *dmabufdest1 = NULL;2 r# g* ]4 Y" w. B
- char *dmabufdest2 = NULL;
0 @" Q5 j/ @- }- \* H0 O( {; @ - 8 {& l1 A$ r/ Y$ t7 K
- static int acnt = 512;
/ P4 q# ~- n" N, b# L - static int bcnt = 8;
8 ]# ~' T* C+ X! p$ t+ Z - static int ccnt = 8;
/ v M7 g9 d* O) e - : p% ]8 n: l- g- @0 ?" W9 u
- module_param(acnt, int, S_IRUGO);7 w5 j% W$ U# Y* ^; ~- V6 s
- module_param(bcnt, int, S_IRUGO);
I, w! R0 h- [$ T - module_param(ccnt, int, S_IRUGO);
复制代码
' U% j$ d. L/ e/ w4 d# p0 i6 p' s% P% V8 x% n, u: V2 P3 s+ {" S9 Z( z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 w" X+ b6 m1 _8 G9 o: w" L* o( warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% g2 k$ D& ~# Z! m, ~. \/ n5 _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 l! x! Z0 J$ r" x4 n5 @5 d
+ h+ h1 {# V! n
% ^, Q, n3 b, i+ `8 X. G0 R$ a |
|