|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 e% Q, `, v" X; ^8 U
- [code]EDMA sample test application' T* r" z. y; R6 ]
- /*. L5 E. b: ]6 E Y& _: x
- * edma_test.c0 v0 b8 ~! Q5 t7 T9 s% I
- *
7 O' h. R3 o% c& S* u) s/ A - * brief EDMA3 Test Application' i. Z* M* ^! ~+ P
- *
_7 C+ z ?9 H9 ]% q1 Z - * This file contains EDMA3 Test code.+ N& u, }4 A* `# k! K& z) r
- *4 x/ j$ M* } @& S- R- L, z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 t" N, H( {. x0 E$ V3 ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- y' W, N# r4 `8 W2 W, _
- * TO CHANGE.( L3 D$ ^& F% }$ u
- *
+ ^5 i o+ J) R6 r; m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ z) L5 E1 O, O4 C+ r v - *( w% X) @" @6 C
- * This program is free software; you can redistribute it and/or
/ m. x7 c+ z5 }+ m& K# X& ] - * modify it under the terms of the GNU General Public License as
4 n- ^/ J) {, k- O: E& |: c - * published by the Free Software Foundation version 2.
, B5 Z- F" N: h s - *
6 G7 l' R) s: P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- E% h4 K, f! W - * kind, whether express or implied; without even the implied warranty
: v! _: G( y& [: g( a9 | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 Q% ?$ J D: k - * GNU General Public License for more details.
/ _0 H2 |8 _$ v0 L# y5 N/ [ L - */
& `9 ^( S# H$ M; A2 N6 t( f - # \# f5 {! {. j5 j& z2 W% d
- #include <linux/module.h>9 G3 ~8 B% i/ t; x# N6 ]! W
- #include <linux/init.h>3 x+ F c$ o# b6 l# c/ i
- #include <linux/errno.h>
) [1 V a2 Z G2 f0 G, [9 n: | - #include <linux/types.h>
8 u% Q% ?3 a; t/ V2 Z: |6 Y - #include <linux/interrupt.h>
3 j0 b% e$ {" m7 w5 I6 V1 t& e n - #include <asm/io.h>7 \" s5 Z; [1 H
- #include <linux/moduleparam.h>5 o7 _5 j% j/ P# {+ X9 |
- #include <linux/sysctl.h>
4 `" B% i7 P. h5 ]2 t* Q& W3 U/ p - #include <linux/mm.h>1 f4 a0 ?+ d, v! _4 S. \
- #include <linux/dma-mapping.h>8 b% I+ k- Y- r9 s' o i' m9 ~
- ) k# ~4 c5 c8 X) m& x
- #include <mach/memory.h>
0 s2 m/ k/ e: K/ ~ e$ P - #include <mach/hardware.h>
+ s' Z% }/ {, Q4 w - #include <mach/irqs.h>
2 [8 o8 x, M6 m+ {0 q - #include <asm/hardware/edma.h>
5 O( c; ?* L4 F t$ U6 l
" e) k. m: w2 ~ R4 C. E- #undef EDMA3_DEBUG3 h+ ?7 p5 @! P2 M1 _- l* U
- /*#define EDMA3_DEBUG*/
' o# W- ~% S$ H: d, O1 y# p2 ]% U
) Y: I/ G* E9 G4 P+ {5 a& O& ]' Z- #ifdef EDMA3_DEBUG+ Y. O3 @; K$ ]: G& M" m( G. a. G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ X( S: z& ?9 ^4 D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 J; B% u6 M; u: b9 C9 O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% ^) B D; `: ?! _" y - #else2 g- r0 T9 h+ Y: Q, G
- #define DMA_PRINTK( x... )$ {+ ~$ |( w% r* B
- #define DMA_FN_IN
) ]) w1 B# T! n: } - #define DMA_FN_OUT
' J8 K: ?2 D2 Y" `: d' i - #endif+ M7 S* P0 _* i" K
3 o5 n% ^8 H1 E7 |& O- m- K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" E D8 {% j: D9 _& _ - #define STATIC_SHIFT 3
$ m$ B; @6 |2 L1 ]2 I" Z - #define TCINTEN_SHIFT 20
+ [$ B5 V" D+ r. B6 e/ ?! ?4 ^# \ - #define ITCINTEN_SHIFT 210 z. W9 c; R0 f$ N! K1 Z9 I! J
- #define TCCHEN_SHIFT 22: T1 z2 `1 z7 Y+ e
- #define ITCCHEN_SHIFT 23
1 ?6 C, F% q0 H3 T9 j
& f, N. k, U( X) E% S- static volatile int irqraised1 = 0;
W `4 M* l$ `1 S: X5 d - static volatile int irqraised2 = 0;7 D) Y9 y3 y: j7 O2 F. C: [
- v ~- c2 E9 E2 B, W; j2 X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 y6 g) H' O% d" |- M: [$ T a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) G1 y! B2 y( c+ x G- H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% I7 r1 j }- M2 j5 C
8 |5 T* m( w$ v" I |- dma_addr_t dmaphyssrc1 = 0;
3 F0 h) N8 t! s% k- g- t! n* d - dma_addr_t dmaphyssrc2 = 0;
6 q- M1 e6 F: A/ c% W; U - dma_addr_t dmaphysdest1 = 0;. a) U( d5 d7 \& Z" Z
- dma_addr_t dmaphysdest2 = 0;3 w1 O9 [6 f8 _1 M
9 i: \( z' [- B6 v- char *dmabufsrc1 = NULL;
) D9 N6 C& k6 k. [( x5 T4 N - char *dmabufsrc2 = NULL;( {% }2 \0 ?: j; \) p1 X/ k5 t
- char *dmabufdest1 = NULL;& l) L5 G3 ?) ?+ K/ h( T
- char *dmabufdest2 = NULL;) T/ Y( y0 e: @
- / E/ C% s6 U' b) t4 c$ F
- static int acnt = 512;
" w- w9 s$ Z K7 [ - static int bcnt = 8;
# \# l+ q! i; l( J - static int ccnt = 8;
5 ^! W/ g' S5 X" H3 k9 B - 7 [* P* e( F! j' J) I# x
- module_param(acnt, int, S_IRUGO);# [: u" m/ y% A/ u
- module_param(bcnt, int, S_IRUGO);
: m) Q4 k2 l& q - module_param(ccnt, int, S_IRUGO);
复制代码 2 s1 ^5 T6 S+ C* ^
( v. |* o) `* W" ^0 J/ E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' w) i* v0 q3 q9 |& J9 p& carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% d* T5 C2 {3 o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 U4 b$ k- m4 r5 g2 K3 l
6 T' a g0 H+ K& l) X V( |/ M; k# x
7 e, D6 U) Z7 }0 `5 b |
|