|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& u' R' u6 X, a- S: R- [code]EDMA sample test application' @8 P. d5 t3 }7 {4 y1 c$ c
- /*
& b8 j" v" E: N* \! A2 |) c3 Q+ X - * edma_test.c& M+ y2 V* s9 i7 p5 W' C, ~
- *, N! ^& ?- _2 r3 k2 T* B3 ^
- * brief EDMA3 Test Application
% U& ~0 A# D" y8 j F4 N - *
) B8 T! U* U' g @ V - * This file contains EDMA3 Test code.
3 v" b( j+ Z1 Y% ~' ]5 Z+ p - */ {: K/ B/ O& {9 @/ W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 A/ t$ Y; N! i! [+ J+ \ ?' e: u: i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% B: l8 n7 a0 p5 ]: s - * TO CHANGE.# O& Y- v0 h$ {# N1 q4 n, H* w
- *$ c1 B: X; y5 v0 w( J2 P/ M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ R. L- K+ X u2 {$ a4 G2 { - *5 x- r( V: Q6 A% t' E* A
- * This program is free software; you can redistribute it and/or, R+ |& G* p& r! W7 l' f1 r
- * modify it under the terms of the GNU General Public License as+ J! u: Z4 g( l% y* Y0 s) i4 S" v
- * published by the Free Software Foundation version 2.
9 C- Y; S5 r, c" g) n& J - *- F9 ]1 S8 l0 p6 V9 m# D4 G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ F. v& i1 I+ U) ^; g - * kind, whether express or implied; without even the implied warranty
5 x4 P% C# K6 C* P. x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- F5 t/ w7 c- o' m+ g( x# G
- * GNU General Public License for more details.
A- O* V% m \. o# x - */
) I8 Q& R4 u$ N
5 I6 H* ^' C/ a. Z$ {, t- #include <linux/module.h>& a, ]$ R: O* z1 z; `' {1 Z
- #include <linux/init.h>' Z7 U' K& _# O# ]
- #include <linux/errno.h>
8 F- d/ O+ c+ |; _ - #include <linux/types.h>
) w% f9 U3 A" K A* `4 \. L% e# w - #include <linux/interrupt.h>3 R" o1 n, p. O" Y
- #include <asm/io.h>; M# T9 W4 W; ?0 h* u
- #include <linux/moduleparam.h>3 F/ @; v* l" R5 E; s
- #include <linux/sysctl.h>$ ~- g$ p1 f7 b, T6 h5 R n/ o6 m
- #include <linux/mm.h>
- |% W; e- B& @5 y - #include <linux/dma-mapping.h>
' z. M7 e9 @2 o6 D8 ?; I) i
2 E5 u. L6 O2 e8 G. i6 Y; K+ C+ W- #include <mach/memory.h>$ g6 g' D& j" d1 |; m) {
- #include <mach/hardware.h>
/ f; }- |. S, Z1 x - #include <mach/irqs.h>4 u! E$ S! V4 n4 O$ O
- #include <asm/hardware/edma.h>
' C9 @& k* f2 q1 f
0 v7 P) I$ o# ?- #undef EDMA3_DEBUG
9 ? E. P6 w2 {0 T6 @, Y/ B - /*#define EDMA3_DEBUG*/4 f) G0 C: L6 k0 g" [. J+ Y! N
% }) X8 N$ O1 G( q* H" j4 r1 t- #ifdef EDMA3_DEBUG+ N8 [5 P8 ]1 J+ \2 S% |+ ]; D$ G' V! T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ E& Y5 o" }& }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ _2 I4 ~) z. c' e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! n' O6 v( J$ k' j$ ~$ U" U - #else3 P0 v q- K" i. u! @5 {
- #define DMA_PRINTK( x... )
* L' |7 B! T: D+ s& t& G6 E$ I - #define DMA_FN_IN
' l# s! f/ U7 a4 d' g - #define DMA_FN_OUT
4 U4 A! A: |7 c$ @ - #endif& I, u1 m- x3 m+ z, j1 s$ b4 C
- / H# I5 F' C# D( T# j1 A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 X3 s# H& K% `% g - #define STATIC_SHIFT 3
" a1 l1 H. _$ u2 D. ] - #define TCINTEN_SHIFT 209 Q- P, s3 g- I, X6 O' o
- #define ITCINTEN_SHIFT 214 K' s* E8 I9 a( ?1 P; ]( Z1 y
- #define TCCHEN_SHIFT 222 y1 P' B, p5 v
- #define ITCCHEN_SHIFT 23" f3 x6 i5 W. q* U# d5 O
- F5 ~4 e% [. ^; d: |
- static volatile int irqraised1 = 0;
% K2 c C8 I0 h2 |; V7 O5 v - static volatile int irqraised2 = 0;
- x C; v6 d* ]$ \" b% ]* T3 Q U A - $ P8 l$ f. r* R' U) u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 F6 ^- Y+ R& a; | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 H$ U4 q3 h& N0 z+ |2 f/ x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 ~$ S, O7 u' I4 F8 t - : i& ~! e+ M, j3 s, Z$ G
- dma_addr_t dmaphyssrc1 = 0;
. o1 T+ r/ u: u5 ~' v* u - dma_addr_t dmaphyssrc2 = 0;% W; H0 o- E; m) \% D) M3 M
- dma_addr_t dmaphysdest1 = 0;
I2 L: [. a& | - dma_addr_t dmaphysdest2 = 0;
$ Z" o, i6 L+ Q9 |2 U8 ]6 S
) z6 y# }' h( C& f- char *dmabufsrc1 = NULL;
0 s( \! D5 T! x1 |0 i! R - char *dmabufsrc2 = NULL;
- `" @& J/ p5 b. `% I - char *dmabufdest1 = NULL;0 I4 q' T0 M: K; h
- char *dmabufdest2 = NULL;
2 L, i; f( l/ \) f* G- F - " T* }, L _. e; y6 R! v
- static int acnt = 512;
) z9 A/ I' F" m3 U - static int bcnt = 8;: D& C! g+ [! ~: ?" K
- static int ccnt = 8;# k h' |8 A+ j0 h, r
5 v2 T1 S- O! }% Z0 E- module_param(acnt, int, S_IRUGO);$ D" T6 J1 X' o) A( m7 ~! B4 M
- module_param(bcnt, int, S_IRUGO);
) e7 [$ M3 s) y+ {! U, G - module_param(ccnt, int, S_IRUGO);
复制代码
, M) ~! c+ M, X: d/ l4 j& C0 m8 ]) D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) x; U# O3 h6 u( k1 Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 N: x* d, f% C% r3 T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! R( r- V9 y' J% s+ i
, T# X, ~' q/ p( f: G$ V/ w; P' q. z1 P2 Q: Z% t' B
|
|