|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
L' A ~. {* l1 b: l- [code]EDMA sample test application
, Z# a, t- E8 P( w - /*
/ T8 r& @; p+ u; R - * edma_test.c
5 ^0 o% \: p6 z3 q0 E! E - *
. |" f. H3 k6 u/ H - * brief EDMA3 Test Application
" A4 S/ `. q$ Y+ ~8 Y& J- ] - *$ ^& ~8 R W* _$ D9 @$ _
- * This file contains EDMA3 Test code.
. r7 F9 a2 N4 P% X, t) T5 [ - *. m O9 Q4 c9 @! ~% o/ h3 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: i3 C: b2 d4 M: K; T+ J) O6 s/ K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ i# @5 K; R8 R' p, ~2 |
- * TO CHANGE., `. I" s8 z3 Y
- *
9 x+ X2 `3 J7 t9 y* q0 m# s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* P$ z1 ~- F) _$ z/ h% c - *8 h) o8 y# D% H, ^! T
- * This program is free software; you can redistribute it and/or# u$ e8 _. p6 ~, n5 K, G
- * modify it under the terms of the GNU General Public License as
4 W0 J- ~9 U; Z$ B8 D e - * published by the Free Software Foundation version 2.
' ]( ^( O/ f, u' s - *2 b5 y" R3 b! ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 a, G, i1 P; c4 u3 @
- * kind, whether express or implied; without even the implied warranty
) m8 G* D8 ~" D& d$ q1 E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ W% u' S1 j: } - * GNU General Public License for more details./ w( t0 L3 E9 Y; U; ~$ e. ?
- */% ]. y0 q `2 k' S9 D1 Q5 W9 z
- 3 m: W6 k8 a9 _7 `+ N/ b
- #include <linux/module.h>
$ C$ i& @: O* {3 m+ K - #include <linux/init.h>% {" `' N5 u! V% y' O
- #include <linux/errno.h>5 X1 r- T. H6 X3 t% @, w, d
- #include <linux/types.h>
+ Q; O' p, I) Q# w. q5 ^* q - #include <linux/interrupt.h>
& x' q: e, R( x1 j3 F; B - #include <asm/io.h>
2 E) C* r) t9 N* d7 r; {& o; O - #include <linux/moduleparam.h>- l( a! A& O0 {) }1 E; ^# t8 }
- #include <linux/sysctl.h>) A7 x' t# M$ u. l; g7 B
- #include <linux/mm.h>
3 Q( Y" s9 K2 ^1 z$ B) O- t: d - #include <linux/dma-mapping.h>- C; C p$ k2 l
9 l8 r% O0 M5 l# ]1 x6 F- #include <mach/memory.h>
3 ]* N- U; w1 Z/ w! V( G b - #include <mach/hardware.h>
. d4 b3 g6 U4 _" N+ C1 I - #include <mach/irqs.h>; N, C/ F, ^9 t' g
- #include <asm/hardware/edma.h> r* [3 L e1 b! q* c" `
- 9 q. l, k* M; K$ g! x0 a \
- #undef EDMA3_DEBUG( }2 A: M& g9 T4 G5 a4 G/ u
- /*#define EDMA3_DEBUG*/. }( R S' G" Y0 h E
- . l5 b$ V$ @8 y a' B
- #ifdef EDMA3_DEBUG9 k$ r8 S2 y# _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 s* e! w; \ ^1 s2 O& J; H3 j4 A1 X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 I; j! [0 y4 c4 m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 Z& P( S% }! w( Z5 f8 @
- #else
" H6 ~1 n W! y/ ^3 F - #define DMA_PRINTK( x... )
7 R$ c$ Q$ x+ U - #define DMA_FN_IN
. l/ q) T( t8 {# J$ q9 Z2 x - #define DMA_FN_OUT$ s9 w9 L- |2 N* d ^
- #endif' h; Y% r, J( ]& l) v; I( S
- * @' x( j7 c2 z" L3 m, [' r# Z# [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& F# u% M/ p. Q- M+ h2 t/ b* h
- #define STATIC_SHIFT 37 r/ w' H* G( j! |, L& y8 u# W
- #define TCINTEN_SHIFT 20" e1 s0 ?" O# n! r7 T
- #define ITCINTEN_SHIFT 21
7 c% _3 v" t! L; J - #define TCCHEN_SHIFT 228 t* S# g2 J3 k$ O
- #define ITCCHEN_SHIFT 23
6 I6 ~( o# E- z2 G - 3 s& c" f) ?$ V! z3 ?
- static volatile int irqraised1 = 0;" t" S5 C8 \- |5 l: H* ]6 n+ @
- static volatile int irqraised2 = 0;- m# ?9 a! s2 e
- 1 Q- f3 L0 a7 Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, N# ]3 E+ d3 n6 D) g. S6 \2 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 r5 _+ [. p. i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" [, H# M% Z7 O s
& ]0 g+ h: y$ o H* E0 _4 ~. B- dma_addr_t dmaphyssrc1 = 0;
+ c& _; `4 M! B' {# w6 r - dma_addr_t dmaphyssrc2 = 0;% A2 w( c n- _# {
- dma_addr_t dmaphysdest1 = 0;: D/ {2 Q, l+ \
- dma_addr_t dmaphysdest2 = 0;
. n A+ ^' X, v+ v4 Q& l - 4 _/ B( e0 _8 D g; ?
- char *dmabufsrc1 = NULL;
8 p1 \3 K* P5 U% J0 d+ D# c( ~ - char *dmabufsrc2 = NULL;
% |* G" i& b5 n K - char *dmabufdest1 = NULL;
/ c( a' j) a) A4 t( w1 k - char *dmabufdest2 = NULL;
9 P4 M7 E* S+ ~ - " \1 P0 q. Y5 m W
- static int acnt = 512;/ _& j5 N4 A- Y* Q/ }
- static int bcnt = 8;! _0 \/ G$ R% o
- static int ccnt = 8;
- B3 M& g. N H
' W4 o. t8 H5 N- module_param(acnt, int, S_IRUGO);
6 O1 F2 G( C, P. g - module_param(bcnt, int, S_IRUGO);
- Y( F, |6 l6 A; \: } - module_param(ccnt, int, S_IRUGO);
复制代码 * A7 V" E4 q+ u8 l' k
3 i! v/ V) ?( I7 Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 ~' C! R0 e9 \6 ]) X$ y' L+ L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- K% d7 J* ?4 h# Q' i2 h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: F- u+ f3 I; b2 Z$ }1 {! ?/ \' d
) b+ I6 r# y4 g! [$ T" Z- K2 U% W& z$ V% W% W
|
|