|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! z3 z$ }; \/ k) M7 T1 n8 M9 k6 x- [code]EDMA sample test application' D3 c, w6 {' S0 Z F$ ~) d1 P
- /*0 p& O4 L/ P$ |: n" J$ ~6 b0 C5 ]$ s" Z
- * edma_test.c
; c9 C! q' h9 b5 i% i - *$ K7 b: [% | `- |9 F# V% u
- * brief EDMA3 Test Application
! t; j$ X9 e* Q - *
4 E$ ~* ^5 a$ {2 ]6 x% q5 D - * This file contains EDMA3 Test code.
4 D% S5 P2 c, |6 p$ N - *
$ [$ q, d3 I ?: X* }& W' q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 ]6 b6 K' O# s* v4 H2 E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% g# p1 p2 \0 f5 `6 E" [1 _ Q - * TO CHANGE.0 Z! h7 z1 E6 |
- *$ Y! i3 S/ B% T2 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 ?8 _6 T! r2 J5 A
- *; R4 J8 K$ ]" H# b- t# y* U: E
- * This program is free software; you can redistribute it and/or
. ?% V% ~: n# Z3 h8 g0 \ - * modify it under the terms of the GNU General Public License as8 C- Q2 W, a' e9 u$ x% w/ l K3 Q
- * published by the Free Software Foundation version 2.5 y* W& u1 G5 V0 H
- *6 O4 A6 Z3 _8 N/ P9 s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ U. {: l5 _) e' \2 \# h
- * kind, whether express or implied; without even the implied warranty
: `' ]5 s& P i; R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 L- L( v6 ?! P3 s: N7 J
- * GNU General Public License for more details.# T6 e+ A0 h. h5 w8 m3 V- f( c
- */
( N1 l1 A& u. X; Z H, A* v/ K; ] - * R }4 M& u% P: [
- #include <linux/module.h>$ \$ k$ r) ]1 i& a9 R6 B, Q5 m
- #include <linux/init.h>
7 j5 U( W3 F% Z. O. [ - #include <linux/errno.h>( A8 ^' @6 M! N) N5 \
- #include <linux/types.h>
! M0 r* Q5 ~7 d, L- q! c - #include <linux/interrupt.h>) J) y* X% \ C
- #include <asm/io.h>
2 {$ R p$ ~! \# b' y; B4 F" H1 R - #include <linux/moduleparam.h>
& t2 r* Z( k; _4 I- G! Y& r5 m! Q - #include <linux/sysctl.h>
. z W$ _7 r& J5 a' ^2 N; e - #include <linux/mm.h>% s9 C( ?4 Q7 m3 T2 ?3 D( s' T
- #include <linux/dma-mapping.h>' w M& C2 G5 P4 ?5 s
- / C$ B5 F1 d& R2 w" t% J
- #include <mach/memory.h>: Y5 J# D. _3 @: ?8 \3 N4 e$ s
- #include <mach/hardware.h>; O" _0 s' k6 }: J
- #include <mach/irqs.h>
! E9 s5 a! K' H( \3 Y4 } - #include <asm/hardware/edma.h>* }( ~; T: V: a" L6 H W; {& `/ ~) i
- ! h3 r8 F f& Q9 K& i
- #undef EDMA3_DEBUG
; W1 q- d$ L: H2 E9 S4 b - /*#define EDMA3_DEBUG*/
- x* w" l: T/ }0 g+ F5 t
1 ^# i+ B8 Z `2 i- #ifdef EDMA3_DEBUG
& i8 N) F% X% F8 B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 @0 M9 j& }+ ~) H" b+ l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( ^# y# [8 a' \9 o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 U. X. C s% Z' L) L
- #else
# ~! c* E$ v P; B- [1 Q6 H - #define DMA_PRINTK( x... )
7 I! Y3 L, g9 V4 f) U - #define DMA_FN_IN
4 o) w( V. |; j8 k1 H! Y" C1 E - #define DMA_FN_OUT, C9 J- x3 v4 b4 w6 s5 D' N% T
- #endif. G9 @% S$ @* t9 E- }
: u( {/ O7 o+ U, m4 _# i+ @9 T; G- ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& }+ h. F |0 t& p- w; G6 Y
- #define STATIC_SHIFT 3 R2 R* k4 [( ^* Y4 D! ~
- #define TCINTEN_SHIFT 20: L0 C0 ?' k- X6 A0 g( D4 Y) R
- #define ITCINTEN_SHIFT 21) h% k' u% \. v( F4 g6 S0 c
- #define TCCHEN_SHIFT 22
2 _/ u; ^7 j! c; J3 b - #define ITCCHEN_SHIFT 23- k8 |+ k) S6 [# Y7 N v' p+ p4 _1 s
- / a4 S2 h! ]1 m0 b, v% w7 N# n9 ^
- static volatile int irqraised1 = 0;. U: i1 @( c2 h: @3 b
- static volatile int irqraised2 = 0;
- l2 [/ t- I) Y+ Y$ M+ j - 0 T m; @9 h0 b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% C/ F" d$ g/ e3 m8 v: a3 ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ v3 b- F& J/ Z, R2 N$ @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ A7 J( g2 M" e/ X; b8 C
5 M# S% n9 [0 z: K- dma_addr_t dmaphyssrc1 = 0;
, t1 k2 E7 M4 z7 J6 r. U' M - dma_addr_t dmaphyssrc2 = 0;5 v8 [2 V! U0 r) b
- dma_addr_t dmaphysdest1 = 0;
2 l% D) ?. Z( h. D' w - dma_addr_t dmaphysdest2 = 0;3 z! t5 a/ n6 O( \* F9 L( S
3 `5 g. O$ A7 u; _- char *dmabufsrc1 = NULL;4 T2 g7 B8 G2 P9 U
- char *dmabufsrc2 = NULL;
% ^! R1 H5 @/ h7 D, Q3 m+ d - char *dmabufdest1 = NULL; O$ W2 R" c9 L7 ~. F
- char *dmabufdest2 = NULL;
/ S. r% g9 d" c% L6 V - ! Z( H$ Y3 n+ t6 y$ u- g8 C: s6 e
- static int acnt = 512;
4 b* t+ D7 c+ h J5 @ - static int bcnt = 8;
# p5 ^/ X! v5 k: }, k' c/ \ - static int ccnt = 8;
) g" A' d, F6 V1 F/ C
?3 \' Z# x! T' S1 ], t- module_param(acnt, int, S_IRUGO);
4 I4 X/ h" t( y; m5 `! k - module_param(bcnt, int, S_IRUGO);) Y, x7 }. Z) W7 Z8 x
- module_param(ccnt, int, S_IRUGO);
复制代码
4 d F _) t. a# \0 ~. w
# _. B' D6 t& f* K9 k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; ]$ u" a" Y/ F" q2 u! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. I1 b: y% w! V7 S& C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 G# i, x3 k: S- |
: R1 ^3 h/ a* N$ k, x% @6 I r9 M! H6 q" e% A# s
|
|