|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 N& f2 }" U4 r# L# q0 j5 o, s" N
- [code]EDMA sample test application
( d% l" ^2 H3 v; W2 N$ V2 f - /*- v+ j" w2 P, l2 r$ t- I- w2 W& w
- * edma_test.c, Z: g# a0 H+ F! m
- *
8 s- R$ m1 t3 B3 y2 m% l - * brief EDMA3 Test Application4 G& ]4 \7 `0 o6 }
- *& {4 X* s( T; T& j0 O
- * This file contains EDMA3 Test code.
, s A' S: g" ~2 {( ]/ [ - *
2 B" t+ o! [9 R2 J- W L# l+ R: _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 p! I& w! X( A, }/ _) q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 a$ @1 m! F B
- * TO CHANGE.8 K) a8 G$ f' i! x
- *
& p4 M# A" [" E6 {) ]* U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 W$ T5 _' [4 W* V) K2 q
- *
- M R3 d5 F9 |* h - * This program is free software; you can redistribute it and/or; @8 ~. n* Q( |
- * modify it under the terms of the GNU General Public License as
( c+ [% r* s9 G( ~7 N/ z4 H9 d - * published by the Free Software Foundation version 2.
/ L! S% v$ b- l( ^) K/ |) w - *
7 I$ [* T$ q1 n( r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! H6 ?9 N( e* X9 L9 P - * kind, whether express or implied; without even the implied warranty
5 g! q5 s/ p+ s, e' T7 U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ p+ M( ^$ E9 k# n: A - * GNU General Public License for more details.- a9 `2 [( y, t/ Y7 K
- *// i. s$ I5 W" y; V; W: W4 D& p9 ]
+ _; ~; a4 k* Q+ S# P- #include <linux/module.h>- T/ K& T' [- y
- #include <linux/init.h>' Y8 s0 h; H7 Z- b
- #include <linux/errno.h>
3 r7 B0 M" _4 j7 a) Y - #include <linux/types.h>
1 K5 H) F9 z" C+ h - #include <linux/interrupt.h>. H, X% F9 Q& p
- #include <asm/io.h># v7 j. I: `% W, `3 G0 d
- #include <linux/moduleparam.h>
1 H7 V6 e5 n; {6 m0 m+ z - #include <linux/sysctl.h>
( y: n# ]. P+ w- v' t8 _& E - #include <linux/mm.h>
. T3 }4 }/ P3 N0 Y! c7 \# v6 h - #include <linux/dma-mapping.h>
4 U8 e9 ^" K5 g+ c4 E( q* X - ' T# U8 e9 Z( S' T" Z" `) ^' U
- #include <mach/memory.h>
8 J- o( }& Z0 r6 Q - #include <mach/hardware.h>/ C, C$ b/ C1 W: V, C
- #include <mach/irqs.h>
s2 ^* t, D, v6 D/ L7 S - #include <asm/hardware/edma.h>" ]1 h! Z$ ^8 X" C$ A
1 ?1 ~/ l* z6 j4 W2 g7 X& N+ {- #undef EDMA3_DEBUG' f6 X' i: g: d
- /*#define EDMA3_DEBUG*/$ o; m. x, s o: E1 j
- ; P" \+ K2 W s) I! E& p2 f
- #ifdef EDMA3_DEBUG
+ O- L% e) p2 e$ o2 _8 N9 x7 G5 A* a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- V6 [, ?4 U9 d( \' ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ W) ]8 b! m- C2 K1 q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 n- k: ?& e" U4 @* }' G6 Q! h
- #else
8 _' S, u# `$ e. I: S; Y3 ~7 i - #define DMA_PRINTK( x... )6 [$ M( M( O; B$ s& |- U+ N
- #define DMA_FN_IN! c# }$ R7 R/ V$ [
- #define DMA_FN_OUT# R% d6 z# U; o: C3 O( J
- #endif0 |4 l% g) G0 A0 w
- 8 `8 v/ v- z9 a: O' w1 e( h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# n5 A! X, P6 S& N* M, y - #define STATIC_SHIFT 3
6 T5 v- B! e% O - #define TCINTEN_SHIFT 20" F: N% U) a# _- Y) G9 Q. I" y i
- #define ITCINTEN_SHIFT 21# S5 H+ L- t" y6 y8 O# p
- #define TCCHEN_SHIFT 22
; \* S4 }# a2 {" k' s - #define ITCCHEN_SHIFT 237 a; E8 m! n" r$ E$ S" S
8 R R7 _- c: K6 C# J3 l5 Y- static volatile int irqraised1 = 0;- ^+ U1 W, P) _: `2 [( B: h
- static volatile int irqraised2 = 0;5 |7 L: w; j, K, O
- / w* a( C' [: s: V0 q0 d: d0 o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); g* D [6 k; U" Z8 C6 t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 t$ W+ ?: @! H$ }' @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 E9 Y$ l/ _% }' s# @1 d$ O8 Y' ~7 s m
- $ f: K! T5 c5 u3 T: k% s9 U
- dma_addr_t dmaphyssrc1 = 0;1 g1 [9 n, U4 R9 G
- dma_addr_t dmaphyssrc2 = 0;
/ o' W. M6 |0 Y - dma_addr_t dmaphysdest1 = 0;
' s8 F6 D& C. ?( N8 K% _# E6 @ - dma_addr_t dmaphysdest2 = 0;
8 m" k* K. l3 v6 N$ j9 l* t
6 Y2 n0 S# N7 K2 d- char *dmabufsrc1 = NULL;9 E7 b; M1 b* g
- char *dmabufsrc2 = NULL;
/ J- {! r! D" l. s# o0 s - char *dmabufdest1 = NULL;( c" w0 c! R, G7 `6 t0 Z
- char *dmabufdest2 = NULL;# P% }8 g4 ~5 T; b$ i6 b
: x( n+ d# \/ q( r' j- static int acnt = 512;
[5 u; U g& E6 _ - static int bcnt = 8;
4 G' A: ]- u6 A o( G1 W6 a - static int ccnt = 8;
% `4 r( d8 P4 M8 q& m0 s
, }. H Q9 _ k4 O- module_param(acnt, int, S_IRUGO);# \8 Y J# r7 o9 a/ z2 c
- module_param(bcnt, int, S_IRUGO);7 L2 k3 L, m) V; Q( O7 z
- module_param(ccnt, int, S_IRUGO);
复制代码
) M6 k' M% C& q J+ m( K" Q! s. B
' @" C$ ?& p! V( K% B" J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- c( f U+ b: i, D9 z! r/ Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 A$ X3 }4 v; _6 e7 D' @* @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# u* m$ z/ _. _
5 N) d6 W* A8 K }% i Q# L# P0 ?$ B% z+ n) i& T1 m) w
|
|