|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 A+ H3 w$ f" Q' |- [code]EDMA sample test application. l5 e5 g: h( M1 \. i8 p
- /*
* p6 _5 w) U S {. ~ - * edma_test.c3 ], l( ?2 W4 [( b
- *
3 }, ~* ^, k* U7 f - * brief EDMA3 Test Application: c$ A, j/ E0 H4 W' W- |
- *: P. o( D* X; D
- * This file contains EDMA3 Test code.8 Y( [6 H) B8 ^+ x1 J5 _# P; N
- *" c8 ]! E. o$ H5 Q# c0 J( y4 g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" O4 }- K! X4 Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ f7 U+ B6 n8 g5 m" k( h/ }
- * TO CHANGE.4 ?$ r, R) j0 k# Y
- *% r" ^- k7 E' s h" p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( a1 w9 e7 I. }% |; u d. H; m4 ^ - *: D1 @4 N2 Z9 _. J0 ~, p+ Q G
- * This program is free software; you can redistribute it and/or
. X! H7 {: t- [ - * modify it under the terms of the GNU General Public License as5 c/ z% v6 M6 e$ C+ Z
- * published by the Free Software Foundation version 2.
4 H. h ?7 c) ]/ j9 J - *
6 d9 n6 A) H* D3 U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* ?0 M) ^, T+ Z1 c5 [
- * kind, whether express or implied; without even the implied warranty1 ]' _$ ]% `! k$ x8 I- \7 a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ W- h) u( L' r" P
- * GNU General Public License for more details., `* W* u" e) [- D. g$ v% Z
- */
) q8 c; T1 \7 A4 Z1 @4 | - 7 p. ^3 c: ~) d% g
- #include <linux/module.h>
" \: u! h8 n3 _ o8 P; c; N - #include <linux/init.h>- o, f( b7 w, T1 W4 ?) P! |! z, z, g4 V
- #include <linux/errno.h>
1 z' E" |! G* w! m, f. { - #include <linux/types.h>3 I5 D |2 b% r$ [2 H
- #include <linux/interrupt.h>, B8 t/ n) v$ P% j5 t; ]" v" @7 h
- #include <asm/io.h>- {) T# u K3 R( [5 u/ }
- #include <linux/moduleparam.h>
/ H8 [$ I" [! o0 q0 \: G - #include <linux/sysctl.h>
# m$ ~; ^, c5 U. B - #include <linux/mm.h>' _, V* q5 q: j. e% m% t
- #include <linux/dma-mapping.h>; \2 [$ B. M: E5 H$ b6 s: o% p
- 1 c- n& J4 R Z% d4 `
- #include <mach/memory.h>
/ K+ s, S0 ~" U: } - #include <mach/hardware.h>& m3 E8 d( ], @% u. K/ X, w# o3 k
- #include <mach/irqs.h>
: O8 Q1 ]* E3 v7 ?) ~! F. ^9 [ - #include <asm/hardware/edma.h>
; K3 x4 V6 A- o# j/ ^+ M" p
- x: H( \9 D4 \6 }: C& C- #undef EDMA3_DEBUG: p& g3 K ?5 L/ ^
- /*#define EDMA3_DEBUG*/
! c3 M: s" F1 I1 w! K
. C) J# H7 W# T; q* Z) h- #ifdef EDMA3_DEBUG
7 K; ^9 j L2 v1 @, ^, R* Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 d, a, [3 |) k' j+ N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 h' m; h% K; [7 \4 H4 y# R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; z& `, u% c9 n7 U - #else/ C% b# l0 X; P; T k: v6 D4 F8 ^
- #define DMA_PRINTK( x... )7 V: e! Z- u+ M R9 e. P
- #define DMA_FN_IN
5 J3 H& p3 n* R1 R7 W* R' l - #define DMA_FN_OUT
( J7 }! M1 }: Y( v - #endif& ], A3 N8 P' D2 ^& P. N
- 6 `& Z9 z3 h$ [* Q6 Q( @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 `9 P* e. f: c; y4 D
- #define STATIC_SHIFT 3( Y( X; ^5 {& p
- #define TCINTEN_SHIFT 20- G! G* Q8 ^& I9 ?. B: ]; j
- #define ITCINTEN_SHIFT 21) c* b; F4 Y; r$ a
- #define TCCHEN_SHIFT 22
8 X- ~, E$ c, i* Q" v' G - #define ITCCHEN_SHIFT 238 G& d- W- V) }8 x, h! ?
- ' C$ y: M7 E2 g0 r! r; f) N( ]3 H) n
- static volatile int irqraised1 = 0;0 a3 H* k0 L7 d. y( F) x! W( l
- static volatile int irqraised2 = 0;
. T4 K; [5 S* k, r# H4 X
1 W" P6 u S* W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- l& \; d* m: [' s$ f) i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 X) E! D+ V( S5 p* T6 g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) o; g2 F) |% F
- " B9 S0 m3 Y( M& g% t! S
- dma_addr_t dmaphyssrc1 = 0;, c" L5 L+ B/ t: N
- dma_addr_t dmaphyssrc2 = 0;
! b& o- B7 e* l u - dma_addr_t dmaphysdest1 = 0;. o& T6 V8 t, N% `! U4 V
- dma_addr_t dmaphysdest2 = 0;
* U. f3 m2 x) O7 ^/ x! i
4 J! r: R5 L5 E0 z/ J- char *dmabufsrc1 = NULL;
! |& ^( |, E! O9 \1 m% v; v - char *dmabufsrc2 = NULL;* P; d1 x! K0 y! j& f l2 y
- char *dmabufdest1 = NULL;- s: T( @0 m8 P9 e8 _9 M6 }+ E
- char *dmabufdest2 = NULL;! [7 f4 h9 F* P5 N& f
- e( W2 h# z. Q9 j2 r- static int acnt = 512;0 @! a6 L4 x5 N* f5 I
- static int bcnt = 8;2 k) y# c$ Q5 Q- c3 F, g0 J" E
- static int ccnt = 8;' v+ m5 T: }! _4 m2 x$ Z1 y) [
, k# ~/ ^5 f5 e G F- y; S- module_param(acnt, int, S_IRUGO);
6 h3 Z1 K, }+ S% w* ]6 l. ^ - module_param(bcnt, int, S_IRUGO);4 m/ g: c' F p5 ^0 z
- module_param(ccnt, int, S_IRUGO);
复制代码
5 p2 k% J! _, ?: r4 N' x# u$ q) @/ W7 g# I% L% h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 D! u0 |0 B3 {3 O- u5 ?, Z6 d' T3 }6 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. Y7 e4 F; S3 u$ _; n( E- I$ ?3 p" A1 C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" |! E/ | m" c
- H- v( ?1 _ P
( H$ ]0 n% L# A2 U6 }9 Z- W) b |
|