|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# v$ j4 U! u& G. M/ J% L) g; o2 M# m- [code]EDMA sample test application9 `* M9 y% g b \! H5 y
- /*" Q; Q6 m" W! ^9 `! ]/ P9 @/ f/ }
- * edma_test.c2 E3 F6 B. z3 {" c
- *
- h2 \2 I' Z1 g9 Q8 A \ - * brief EDMA3 Test Application% k2 M3 C1 b9 j* R' P* _* n
- *$ }1 C ?/ }& n+ X; J1 T
- * This file contains EDMA3 Test code.
9 D$ ?% s$ `' e! h6 @ - *" k7 w4 H U4 Q3 P6 d3 L; u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
~2 |/ m" ?+ O9 T* t$ q% Z9 W# k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; c. p. x# X d6 G
- * TO CHANGE.
" W4 U' W, F7 @( t - *. L7 r' c) Y! E7 k% X0 b& a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# e5 V: a i- B, N - *" b. `& V2 _5 v( z+ H; P. i& F2 U
- * This program is free software; you can redistribute it and/or
& z- g. Z* m& W' O1 k - * modify it under the terms of the GNU General Public License as! m; c5 z% q7 i7 B' n, C
- * published by the Free Software Foundation version 2.
# j, d- \& ?8 L - *
7 ?1 a- T) M4 i4 ]6 D3 S1 W, x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( C3 ^ v( z- P- `) u0 H
- * kind, whether express or implied; without even the implied warranty4 x: B y/ q1 \$ w8 S9 Q3 ^4 j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; r# Q# e! Y2 O, P' D - * GNU General Public License for more details.
& N- }4 C7 n/ v8 L, _' n# { - */3 R' @; [" O& b/ s- }0 T
- - c& ]1 I! Y7 |4 {$ b3 q
- #include <linux/module.h> ?9 k: x. k5 P7 u) H% X
- #include <linux/init.h>8 Y6 }4 V( P3 k8 p+ C2 U
- #include <linux/errno.h>8 j6 Z/ C' H3 r& W
- #include <linux/types.h>
$ F) a3 j: I2 y# G* R; ^0 r% }1 `- C - #include <linux/interrupt.h>
7 {" k3 K! g" ], g0 g - #include <asm/io.h>) z5 U, e. M$ ^( {2 a
- #include <linux/moduleparam.h>
% G0 j4 q0 v6 N, c - #include <linux/sysctl.h>
7 H7 [5 n9 m, I+ t r9 i' D# u - #include <linux/mm.h>
% x2 b: l. J1 s - #include <linux/dma-mapping.h>
" O8 w9 X! K5 x s1 T% [) N: _! y - * v( V' M$ {" t( j9 D# |
- #include <mach/memory.h>
6 E9 j0 s" p* F - #include <mach/hardware.h>
6 V( k* Z$ J0 O9 T+ F5 P* o - #include <mach/irqs.h>
% E3 c# F* L, n5 W - #include <asm/hardware/edma.h>
% ~6 N2 Y' ^3 Y' g* F/ K. a - 8 V/ q0 S8 [+ U# l [
- #undef EDMA3_DEBUG; e4 P: O2 s6 G- A
- /*#define EDMA3_DEBUG*/
- z& j" v9 g( F7 v( q& p. u
' ?: \1 x; w6 I: C3 ]6 N- #ifdef EDMA3_DEBUG
2 b/ L8 D" P2 z; R w; G; U: q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 j5 B$ t3 a3 {' U7 g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; z; J2 h' `2 g5 c$ s' q/ o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ S& S- n0 z1 m- B' l% F) }2 @; U - #else
' @. E: W8 p& |& t7 z" Z - #define DMA_PRINTK( x... )" a3 P8 e: E0 X5 I8 i
- #define DMA_FN_IN I2 ^* t" L) N$ K7 W4 F$ _
- #define DMA_FN_OUT/ J( j, o. K% l1 L. l
- #endif
. J& ^" ~+ J* h! u* h - ) w2 R- g0 [7 }- R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- _4 c2 Y0 u3 h, l
- #define STATIC_SHIFT 39 ^. `7 C& N" T* l _( q* g- j
- #define TCINTEN_SHIFT 200 Y9 }; \3 o9 i- K K5 p
- #define ITCINTEN_SHIFT 21* a4 p2 Q. O/ h- }8 E6 Z/ B
- #define TCCHEN_SHIFT 22
# A$ }- K+ n% b+ Q6 x( e( k C - #define ITCCHEN_SHIFT 23' R d$ V$ A2 M1 X8 V
- & H& i2 Z4 ?" u3 T3 C6 j
- static volatile int irqraised1 = 0;) C: Y4 v" e8 L: O! }( V2 ]- q
- static volatile int irqraised2 = 0;
- p8 c+ S; ]$ A$ W2 Z% n - ( \+ Q! c% ]9 h& j) l. A' e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ?4 n w( {) ]2 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# n/ n, l+ k& e7 ?& [8 x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 N- T6 F8 k) j
- ( \+ w, \$ @5 g: G
- dma_addr_t dmaphyssrc1 = 0; [, {: x. T; w, a
- dma_addr_t dmaphyssrc2 = 0;
# a) x1 n E8 X - dma_addr_t dmaphysdest1 = 0;5 M- G- P1 Z% d, G$ y* k% E% }0 m4 a
- dma_addr_t dmaphysdest2 = 0;. H- b) `% n" y- T
, r; W3 o: G* I5 n' j! T8 D- char *dmabufsrc1 = NULL;
4 f4 G) N& s) g7 a9 i - char *dmabufsrc2 = NULL;
: H* `- v7 Z) B - char *dmabufdest1 = NULL;
9 G8 ?3 N8 z7 F - char *dmabufdest2 = NULL;+ i& @7 C7 m& f, B9 e, o
- ( J( H; }8 P4 o _7 X. m
- static int acnt = 512;+ N$ |9 n) V- g9 ?# R. j
- static int bcnt = 8;( o- j3 T. o1 O" z G
- static int ccnt = 8;! e7 t' N0 }2 Q) s( D) e- u) L" j
- # e( I4 F' ?+ |6 j9 |# ^
- module_param(acnt, int, S_IRUGO);% N9 w4 x( I+ z1 Y6 B/ L' K
- module_param(bcnt, int, S_IRUGO);9 T! Q; Y$ Y' \2 U$ i. Z
- module_param(ccnt, int, S_IRUGO);
复制代码
/ b" `* ^5 \5 @; m
Z6 G0 p/ _; T6 \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% z: D6 z& P/ k% k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% i. F: t' x9 D2 F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, ` @- I# p6 M- e+ a9 V
- b$ a! y# @, u3 j
U8 b* {1 U0 _ m- m |
|