|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& {. \1 A/ |0 \0 Z- Y% d1 c! {, l- [code]EDMA sample test application
1 f& |1 s, c$ ]5 r. b - /*3 h' a s. \' \4 B* F+ w
- * edma_test.c) A+ A7 w- L( Y2 N& v, Y$ |; e% U
- *
3 H; a1 Q) D, Y: f% G: b @4 N - * brief EDMA3 Test Application/ u2 J& O* C# `9 s4 o$ l- C
- *
K! t8 L" r3 v: ` - * This file contains EDMA3 Test code.* _4 Y' s" F9 D! J1 r/ H- c$ s: c: U
- *
0 h- A5 u/ @8 v% k4 m' X( v: g. r% j7 K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 e6 x6 x w8 z, W) i. s$ ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, |0 A: q! Q: O
- * TO CHANGE.+ ~6 i( d# K- f, v* d9 K7 q
- *
5 \5 A4 Z( d% y, |( ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. B/ N. u$ K! C0 f4 L" F
- *
8 _# H! F2 Q* |, U3 R: y - * This program is free software; you can redistribute it and/or
( {; e' D$ |5 \- E - * modify it under the terms of the GNU General Public License as6 x6 a; ~* r: @, U# @6 I- }% O
- * published by the Free Software Foundation version 2.
: N' N. y, _; {9 o2 Z - *3 {3 M( w& y$ T( p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ F1 I( f4 T' ?3 I W - * kind, whether express or implied; without even the implied warranty
' N" {% e5 P; @) Y2 M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 \3 P- I+ c2 Z( t, ~& H8 ?5 R
- * GNU General Public License for more details.* R" f I1 E0 J: S# t
- */
6 S4 t6 K X; E4 U9 Q
' ?6 N0 U! C$ ~- #include <linux/module.h>
! n) U( E8 K7 U" e9 }- g - #include <linux/init.h>/ g, s9 l x& G% n& Y& Z
- #include <linux/errno.h>9 c/ f, x% m+ d% B
- #include <linux/types.h>9 y9 Q6 g' _- c% l" D
- #include <linux/interrupt.h>
4 r. b1 s; K( M% X6 R# X6 p - #include <asm/io.h>( n. |# ?" h4 f" L1 h; F: O& _
- #include <linux/moduleparam.h>3 \' B8 f0 S8 B9 E
- #include <linux/sysctl.h>; ~ \ R- d, o1 T
- #include <linux/mm.h>
: i! P& _- X$ |! Q - #include <linux/dma-mapping.h> H: s9 n6 n% r. @' w" T
- 0 c, A k8 n! v" ?# ? \
- #include <mach/memory.h>
. n& c( C+ c4 I. X6 X - #include <mach/hardware.h>6 {& O- _( Q h% r6 ^2 |% d+ E
- #include <mach/irqs.h>
* I b# ~ \; R" |2 V9 A - #include <asm/hardware/edma.h>* @* Y9 X! N4 _9 ?, S Z
* x# d: {6 i7 R5 E- #undef EDMA3_DEBUG
# H# \2 B( s! m. E! \! E - /*#define EDMA3_DEBUG*// Y0 i# A& ^1 b9 o% X& q+ {) ^7 P
% {3 Z$ |, w2 `& O- O: \" D- #ifdef EDMA3_DEBUG! b0 Z7 `$ k, D* U) L2 V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 @ N* W7 h9 \5 y$ X' j( z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) e* D1 V8 i6 w( G0 ?0 m' q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 |9 w* j' u- ~- n |: X - #else( e9 Z/ j$ L4 b- _; I
- #define DMA_PRINTK( x... )0 |4 \& \5 n2 ~2 c5 }9 d
- #define DMA_FN_IN
, e% o3 `- @- b, d+ N* v# { - #define DMA_FN_OUT
0 [2 o) |$ s' w/ {% H - #endif( I6 \# f* Y8 D5 i/ |+ m$ Y% k
- - q$ i, x% I, a( u' Z2 _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) V9 G& ~/ H9 Z+ U! C) K) u
- #define STATIC_SHIFT 3
5 M' }1 F. t& B2 d/ ]3 l8 C - #define TCINTEN_SHIFT 20
# K: t! u0 z2 @9 K* ?4 _4 z! ~" x9 b - #define ITCINTEN_SHIFT 210 Q3 H' O6 z8 B6 r% n5 i
- #define TCCHEN_SHIFT 22
/ W& G( Q+ Y1 T) J( C% m- j - #define ITCCHEN_SHIFT 23
8 j/ v& p0 a8 q9 t/ |' L, ~( o6 x
3 M/ O) x7 P& }2 ~- static volatile int irqraised1 = 0;! g$ V4 a/ s* k/ [8 S8 [9 S
- static volatile int irqraised2 = 0;
2 m- }$ q, A- o9 Q - $ t' Z, n7 o& \% j& H$ m7 |4 ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
X6 B, G7 ?. k0 R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 g5 P/ Y# _$ Z" X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; z S9 Z+ i6 h+ h' u
* P3 \* P0 \& }) Q; q |# P9 f }- dma_addr_t dmaphyssrc1 = 0; t M7 p7 z1 X5 m% _: ~
- dma_addr_t dmaphyssrc2 = 0;0 f, D2 o: J) `
- dma_addr_t dmaphysdest1 = 0;
6 x1 a, X! W+ n: y6 M3 o9 u - dma_addr_t dmaphysdest2 = 0;
( d. }& L, m4 T; y- s$ @5 k
' Y+ v7 l7 f( L; C( e$ @3 p: l' h- char *dmabufsrc1 = NULL;
) y7 W- S" l4 r3 ?% K' l - char *dmabufsrc2 = NULL;
! J! r/ }' k) w1 O - char *dmabufdest1 = NULL;/ d; K1 h& D- j' h
- char *dmabufdest2 = NULL;5 w+ ~1 w. t' W/ h- B- f+ n8 }
; D3 Y1 c, h p- static int acnt = 512;/ ?2 v' ~# G3 X' i) ~
- static int bcnt = 8;. j/ O3 o1 ~9 E" A( Q% v" V) L
- static int ccnt = 8;8 M1 q1 d/ W: g( r/ }
. i2 l' B, M- s( V0 ^2 \. V- module_param(acnt, int, S_IRUGO);7 T# E5 g- g) Y F" J6 y6 I
- module_param(bcnt, int, S_IRUGO);7 x G. R, P7 [' o4 T {+ e
- module_param(ccnt, int, S_IRUGO);
复制代码
* G2 c3 Z6 m. a y7 ?0 S8 E/ M4 Q5 t d' c% n1 x" P; S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ o! |% f9 J# x3 S, O% `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# d7 X, r0 d n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, w2 e9 `8 X% n. ?
- U, G# j/ g; @4 k, S$ F' h- j8 q" C4 C5 Q
|
|