|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ e6 k% l+ m; h- [code]EDMA sample test application
0 i) k" f* G, v; _2 T! t - /*
! Y' {. K$ o V - * edma_test.c
) L' l" G: s+ ]* C5 J* H: {7 o( F - *' ^4 \8 N" d) c) a# b
- * brief EDMA3 Test Application5 w( M! Z) a) g4 p
- *- j3 A8 g: P1 V: a. _) E- U5 s
- * This file contains EDMA3 Test code.# C! @3 [. A# h$ N( y1 b9 n
- *) D9 d$ c8 S8 u5 N5 _5 L, m, e6 @6 @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 r( m6 b# ^( y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 ]. \! q& m4 E+ K& {
- * TO CHANGE.
8 w$ I7 c* b. g! s2 Z) u - *
3 k# P( h: I; s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% s2 J/ `' q- ~* V# k; Z - *, F' ~. @7 [' b1 j# x$ B: \
- * This program is free software; you can redistribute it and/or/ P) h% V. T5 C& ~- Z$ O1 H
- * modify it under the terms of the GNU General Public License as3 |. T$ S9 K4 u9 ^& e; f9 c1 r
- * published by the Free Software Foundation version 2.6 f6 N5 k5 I- W, @3 t6 v* [6 U9 T
- *7 X' X# h3 h$ k) I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" W6 ?; f2 W' B! {9 l1 K
- * kind, whether express or implied; without even the implied warranty0 L. Y: e! H3 X) J$ z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 D" E( G- P8 V. A2 K - * GNU General Public License for more details.
! _+ K. N7 f+ ~. B9 R; `6 ]+ M3 v - */
9 h7 U# S6 H# l+ J4 c - . c0 R( J( R1 }7 d. m
- #include <linux/module.h>
* G5 a, r' R, s5 w. F$ g7 Z' w' ^ - #include <linux/init.h>
- X4 C, L6 s) }5 d% W& q8 t - #include <linux/errno.h>' b1 H$ B* O- o) j5 g' b
- #include <linux/types.h>3 X) z9 \+ B! e6 ?8 P+ u
- #include <linux/interrupt.h>4 O; {6 q4 r) [
- #include <asm/io.h>
4 N/ f" C' B/ a4 T - #include <linux/moduleparam.h>
& r2 r+ L4 f. {- {- n7 \, X/ | - #include <linux/sysctl.h>
! q& f" `( R1 N p" F8 H3 f - #include <linux/mm.h>3 K( h: l9 `, t3 F
- #include <linux/dma-mapping.h>$ [1 H' W- E# L1 z S
5 O. R+ j5 [2 ^, h$ P( L; S- #include <mach/memory.h>
5 i _2 E6 N! \8 a - #include <mach/hardware.h>
8 x" A# b, R" H/ C/ V - #include <mach/irqs.h>. S& E( X2 ^ t
- #include <asm/hardware/edma.h>5 J" ^" g% I4 w- a4 _8 w( ]- b# K
" }# T5 J1 S3 H7 }! c* }8 x' s- #undef EDMA3_DEBUG. B% U6 ?; g' d/ b/ x/ D
- /*#define EDMA3_DEBUG*/* g' ]* ]! [( o) V! z
1 F" J4 k5 a7 C; h% I8 Y' D3 s; J7 Q$ I- #ifdef EDMA3_DEBUG+ }2 ^( ~- j) @7 V( x% S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, o5 F0 \" H; `7 K6 V: s2 h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) @* I; d9 K" N& _4 L3 k& ~: U8 g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 {- M3 w4 `. ?$ s8 A% o! U+ X
- #else
2 D* w" L: y; W; k& m% ~ - #define DMA_PRINTK( x... )7 R0 [8 a+ K; `5 v
- #define DMA_FN_IN2 r4 B! B3 j6 S/ R
- #define DMA_FN_OUT2 X# F1 I o- A* K! K; T
- #endif
0 X) h/ ?, y! Z6 J# W, n8 y, ]
6 A) s6 a7 w9 ]. N i" H+ ^' {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' l5 u, A3 T7 H2 {/ Q - #define STATIC_SHIFT 3
& K8 Q, M+ a% }1 n8 E& I - #define TCINTEN_SHIFT 20
5 S% ^4 ?0 V% h8 N1 k) x - #define ITCINTEN_SHIFT 21$ t; i0 E$ b$ v6 i( |
- #define TCCHEN_SHIFT 22
" `! F/ |, u5 b3 G! u3 E, s$ `, u! e - #define ITCCHEN_SHIFT 23& Q: W5 Y4 J7 x) x* ~
* `6 z" R! F9 y8 z6 j- static volatile int irqraised1 = 0;
% l( x' s( {$ Y) T( w4 k' A - static volatile int irqraised2 = 0;9 k( M% m0 l8 g4 U1 b2 @
+ d4 ]" _( B) |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ~- I& P; v! f: }9 z3 M: x3 M4 ^6 } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 w" _0 P* H( X% `0 l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( _- [1 H( j) K7 N
: f6 z z! p' B- i: N$ Y- dma_addr_t dmaphyssrc1 = 0;
. [+ J( O! }! H1 H& f+ } - dma_addr_t dmaphyssrc2 = 0;
9 C* e' _+ o3 T) b/ d$ c) J$ w - dma_addr_t dmaphysdest1 = 0;8 O9 C$ v5 k0 K) c
- dma_addr_t dmaphysdest2 = 0; W5 e, ?; S) V: m) p: h+ R5 Z
- - ]" C7 d( z6 @9 N7 e3 Y' p
- char *dmabufsrc1 = NULL;
/ r/ j! [) t9 Q" N - char *dmabufsrc2 = NULL;
9 j5 l6 J) x9 R1 D9 n - char *dmabufdest1 = NULL;
* ^) J; }. g' l$ [$ y$ } - char *dmabufdest2 = NULL;
' U1 B% V$ G1 z$ e1 o - " x2 E3 I$ I1 i2 s% D3 k; u
- static int acnt = 512;
- O6 a- b4 r' n! w; x$ F( j% I3 u& G - static int bcnt = 8;
5 j9 C5 O( V2 `7 V - static int ccnt = 8;
+ j$ h# Y" E: d$ @5 x' F
$ M) Q2 Y- C2 g2 ]- f9 A, G- module_param(acnt, int, S_IRUGO);$ X7 ?# B. y d( q: ?
- module_param(bcnt, int, S_IRUGO);, X7 D9 S* D ~: t( M' W2 K0 H
- module_param(ccnt, int, S_IRUGO);
复制代码 ! j; {* m1 J- H, A! y5 R
! N# c# L# f3 k/ m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! }* ]. `4 }, c6 E1 i$ ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 U! q8 h0 b/ k) ]: V* g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
g ^, q8 ~6 C- E# }& d- ~/ t5 P& p+ o
+ a4 ]( e, `1 b4 ~1 M |
|