|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ O! g2 G" [' t* s
- [code]EDMA sample test application& K8 N/ n$ }8 ^
- /*
0 ^. M4 ^# |3 ^% J - * edma_test.c
0 I1 Z3 x$ p# ^- c$ i4 l5 W6 p - *2 X5 V& O% Z" q
- * brief EDMA3 Test Application0 P& e7 M5 M5 X3 P9 h5 O
- *. j9 J1 r$ @1 Z+ y% _
- * This file contains EDMA3 Test code.
4 I' s: R$ }" G/ X$ T - *1 C1 h$ f- V/ @1 w$ d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 t; G1 x" S( j- [0 ^; I; V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ n! ]. e5 F: Z7 M- H/ u4 @- L* E - * TO CHANGE.
: y# n* O9 _5 Z/ m& G - *6 M& x* \" P& v, E- q' f4 ?( Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 S( P9 p6 Q* s, ?" Z" a) V9 r - *9 \5 g# k. Q! {& V8 _# Z( h# v0 K
- * This program is free software; you can redistribute it and/or
9 F% O7 R& M2 P& p/ j$ o( x - * modify it under the terms of the GNU General Public License as& z) ?3 C- Q# A9 g( v
- * published by the Free Software Foundation version 2.
4 v: W h' j% o8 y - *: q% Y& {% l+ L. x S6 N: B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; H6 a' O! f9 O
- * kind, whether express or implied; without even the implied warranty i9 T" r/ J J. V2 C5 X! A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 x6 d$ | P% F& K# F
- * GNU General Public License for more details.
; Q7 O8 h( a( V+ d* U% H2 ` - */4 I Q9 Q0 e% s1 Y, j
- ; r, G3 J1 _2 u4 U0 C0 T3 ~' L
- #include <linux/module.h>
3 m0 y9 `& Q: y$ O - #include <linux/init.h>
2 D; v5 x( M; g - #include <linux/errno.h>) d, u, A: I$ w7 q! p
- #include <linux/types.h>
+ f) c# m, j# k7 J# T - #include <linux/interrupt.h>, [( p$ ~0 N/ |, h) F. n
- #include <asm/io.h>1 |4 Z0 m. E2 q: p$ j" _9 P
- #include <linux/moduleparam.h>2 I6 h7 r" T0 m. W+ M
- #include <linux/sysctl.h>/ f1 H' }1 {& l% a
- #include <linux/mm.h>; F$ c& u0 n8 l6 B: b5 b( v v
- #include <linux/dma-mapping.h>
# W# H7 d ^# b( g- `
' ~# A( e3 D; N- #include <mach/memory.h>/ n1 c+ z1 |. u5 }
- #include <mach/hardware.h>5 Q m' f$ ~9 \! c9 O q8 f3 a: t
- #include <mach/irqs.h>; u5 U* b8 t) H
- #include <asm/hardware/edma.h>8 ?% n( [ S$ I8 q5 c G, E0 Z, _
- 2 n) p. `6 u7 B% E
- #undef EDMA3_DEBUG1 K8 `4 d5 q+ D- Q* ^$ D; Y
- /*#define EDMA3_DEBUG*/# U( J( ?* q }3 t' K% @
- 2 G- E2 s% M, N0 X1 i
- #ifdef EDMA3_DEBUG% W: A# D% e r( a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 W, @5 X- K: {2 g% G- a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: `0 z7 r2 X# w. S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% R4 T" j n) p8 t* N& B - #else
$ k; i4 r) O6 m' h- T7 B0 q - #define DMA_PRINTK( x... )
/ _; N& k, l) n - #define DMA_FN_IN# ]2 k2 j( b# k/ f2 Q D; h H# V% z3 O
- #define DMA_FN_OUT
{' _ K. p% ?/ V# Y# I - #endif- [4 i% ]. o# g& ?: _9 q6 x
8 Y j% A; o" ^( x3 L" V. p1 p, N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' i" a0 I; @; A$ n
- #define STATIC_SHIFT 3, s; Z7 W- V- Z: ~9 f1 ~
- #define TCINTEN_SHIFT 203 a* z1 V4 o7 c
- #define ITCINTEN_SHIFT 21" S: M: _' b% M0 b6 @: z
- #define TCCHEN_SHIFT 22! n! P4 o+ _/ z4 R
- #define ITCCHEN_SHIFT 23
. q' h* y5 n6 r* a$ \ n) _- A
$ d# Y0 E1 J" o4 h2 B/ p9 ^- static volatile int irqraised1 = 0;: _& ^1 Z" e4 u7 p6 b# f
- static volatile int irqraised2 = 0;
: ]% l( T' {$ M: U - . B2 b1 v( D8 M( ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ]: Y( ^2 o0 |3 ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& a+ U, C1 g% ?& A; Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% R, f6 {6 i1 O& H& I
: d8 U' z9 H: E8 M% L- dma_addr_t dmaphyssrc1 = 0;
! V! x: N$ _$ a3 W& s - dma_addr_t dmaphyssrc2 = 0;7 a# u0 v A) ?
- dma_addr_t dmaphysdest1 = 0;
% t( r# E3 Q# q3 d7 E: v - dma_addr_t dmaphysdest2 = 0;6 ]0 B* U2 V9 z: V
5 r) j T# V; P- char *dmabufsrc1 = NULL;/ P/ q y" \! T% s e# ~
- char *dmabufsrc2 = NULL;* R9 q& R$ Z8 d6 W ~
- char *dmabufdest1 = NULL;! M2 l' D# N5 n
- char *dmabufdest2 = NULL;# }0 ~" t9 _! z" R/ A% W
- " T- V. i: r0 e; |
- static int acnt = 512;
; D- j0 i! f8 j" J4 ]6 H8 h - static int bcnt = 8;
) \4 X& g+ u. c- _. J$ q) d7 v6 R - static int ccnt = 8;
( c% \; A/ L) b- m( k/ @
% o; z% a0 Z; B m; ]8 L5 a, K- module_param(acnt, int, S_IRUGO);
) K/ o7 R% e2 L' o - module_param(bcnt, int, S_IRUGO);: p6 J) |- [" y
- module_param(ccnt, int, S_IRUGO);
复制代码
, F1 K/ X/ d! V" L# D9 S2 i# _4 u5 l! O- ]0 p9 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; z G0 q7 E8 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, W+ S( f( c q% [6 _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% @3 t' L5 O G/ S' Z. n8 a7 p
) s, b4 Z! b2 i. D, M3 l
! t& f* @9 R* d" `9 b- e; ] |
|