|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' R% t2 y3 n. N. \# e) m
- [code]EDMA sample test application
) x5 m0 v8 R7 t" n2 Q" i - /*
. C# C7 I9 [! o9 u! Q1 T7 s - * edma_test.c: F( h7 `% X% g: x1 D
- *3 P, J( \$ e9 h5 e# Y3 ]
- * brief EDMA3 Test Application& J9 `& m4 a5 T2 O
- *
: i+ K7 O! O: w" G3 [" Z8 ? - * This file contains EDMA3 Test code.
( T0 t+ r) Z y4 Y' t - *, z- s" u; X+ \/ N4 F+ ~6 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& Z1 z% E+ y6 |. t1 R a4 \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 Y- q& R; }9 a; [5 \. f# |1 E
- * TO CHANGE.
- N6 c, W, h+ B# o! B/ G - *2 d. X) e! o9 X8 k, ?' ~% c3 G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( z0 e7 v# F8 ^& a6 z) n* l - *
z- d; C! `& G: J5 S2 E A - * This program is free software; you can redistribute it and/or
9 l+ J# J! B1 b# t4 N/ K% m - * modify it under the terms of the GNU General Public License as
0 V5 f2 t' n2 C5 ?; E' B) \ - * published by the Free Software Foundation version 2.7 G3 ? E J5 |- j$ J- W$ ^
- *; e- F0 w% h# b$ N+ d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- S& @+ Z Z. I, q; h/ o0 H7 r, F
- * kind, whether express or implied; without even the implied warranty; F ] o* r. b8 y' c: y; Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! z2 B) o o: n8 [% Z
- * GNU General Public License for more details.) _2 y; g# t2 e S0 C
- */ ^5 L* g5 ~! S2 Y! M) v
- - C6 z3 B( I# q+ o {
- #include <linux/module.h> @1 Y K) L8 E7 u6 J% ` T8 i: g
- #include <linux/init.h>
& P: v; r% D/ t - #include <linux/errno.h>) J8 ~0 O( _. d3 O' W3 Z# D+ N! V
- #include <linux/types.h>
0 U5 g6 _! y! {7 A% ^" ? - #include <linux/interrupt.h>2 \; y1 Y9 Q8 d0 [7 S" v: M
- #include <asm/io.h>* [# {0 ~% a0 w9 W
- #include <linux/moduleparam.h>1 I* v6 e* {, }* O
- #include <linux/sysctl.h>5 |0 F o9 V" k: b
- #include <linux/mm.h> J& l* z& L2 ~0 A# [/ A
- #include <linux/dma-mapping.h>" u) J+ b" ~9 O. Q! u
, _. n) O* j7 M* s! K- f, u- #include <mach/memory.h>* q/ ~: s. W2 P0 U2 ]- w; K
- #include <mach/hardware.h>
1 F3 e& [. W1 N - #include <mach/irqs.h>
1 w( K% b! z" S K- p - #include <asm/hardware/edma.h>" f0 A s+ }6 {3 S5 q6 q
% `6 H. G+ f8 [/ K0 z% ?* T- #undef EDMA3_DEBUG# N+ x7 A8 B; N
- /*#define EDMA3_DEBUG*/
$ E2 }2 K: W7 {9 [& l - * ]2 D) S" I2 F8 M9 L6 K
- #ifdef EDMA3_DEBUG
5 w/ _5 a+ O$ n9 `3 S/ g! Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
U0 G: R1 p4 ^' q# ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; @' d. q: ?( [ ]9 O6 Q6 i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 a3 V5 B' K! }3 R8 \ - #else- T2 a3 L% E- N* ?* P0 X
- #define DMA_PRINTK( x... )9 ]* x4 A* p- l& K; D6 a2 j
- #define DMA_FN_IN1 S6 P: D3 O1 h0 w. v9 B
- #define DMA_FN_OUT- N ` D4 ^3 V" c2 U- p
- #endif
5 K! `' C4 n; z& D) K - / j; [' K1 R" M1 u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); e3 G- [" X" y$ _4 @
- #define STATIC_SHIFT 3
9 A: D: v: N) O- k5 Q - #define TCINTEN_SHIFT 205 C9 R' y" Y( x$ ~; x' S
- #define ITCINTEN_SHIFT 214 P. f( `8 s8 o9 {( t% ?; _
- #define TCCHEN_SHIFT 229 N8 Y: H9 H' Y8 u% B
- #define ITCCHEN_SHIFT 23
5 K: w& ?& w0 V4 n
! w0 [$ v, n9 M3 X# h" j- static volatile int irqraised1 = 0;
) g6 v! n/ K3 p7 M+ @9 t7 w - static volatile int irqraised2 = 0;
& I+ J5 k# V# |& D2 s
1 O F; ~" u; b' r4 D) h+ P1 ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, H& _) L" K& g+ M' ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' q W9 v. i" ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ~% A# Z8 V1 F4 p; x6 m W$ Z
/ g9 ]4 B8 \+ b4 p- dma_addr_t dmaphyssrc1 = 0;( F l. R; X: x; V3 P
- dma_addr_t dmaphyssrc2 = 0;
+ K0 B% i S) E1 k3 Q' X0 Q - dma_addr_t dmaphysdest1 = 0;
; q2 F0 h& R7 r$ y. ~, u h) Z - dma_addr_t dmaphysdest2 = 0;
4 i( G; a3 `7 D3 C& c% q - : W- Q7 l+ y# ^: C# t
- char *dmabufsrc1 = NULL;3 i. d7 `0 ]' b2 O% t
- char *dmabufsrc2 = NULL;0 ~( Y/ y* m' F$ Z: b; [+ M
- char *dmabufdest1 = NULL;" S4 _6 {: Q) \ S' C3 U" w# n
- char *dmabufdest2 = NULL;
' p9 s2 s0 v, c6 ~6 L" U - % p# m; j1 [# G, f
- static int acnt = 512;5 @) D5 B- A k
- static int bcnt = 8;; z8 G% v+ j l. S6 Z! s0 {" y1 f
- static int ccnt = 8;
) K" V) G6 U& Z; Y5 w' n
1 u+ _0 h# a+ g) L3 M6 _; ~- module_param(acnt, int, S_IRUGO);
% [( g, w, X" n; t - module_param(bcnt, int, S_IRUGO);! B) E- ]: U' ]
- module_param(ccnt, int, S_IRUGO);
复制代码 0 u ^! v0 {$ c% H2 o* ~" ?+ O
9 a8 s, E0 [9 I$ v/ L# B8 Q4 \( s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" Y7 f$ n8 G" T- K G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ \" H, z" I3 ]; S3 x( ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. n1 u$ j/ G+ K# E+ _
6 N+ ^+ Q6 [" V- u
& I1 Z w" Y7 M# A
|
|