|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 j0 g4 U% N' R
- [code]EDMA sample test application5 l% d B! T. V+ @# L' J
- /*/ Q2 r8 B2 L% o: K0 _6 ]
- * edma_test.c
5 a; d |7 m/ ] - *
2 j* a K2 `# O# s - * brief EDMA3 Test Application6 Y' x0 ^: w4 g, [/ d! S9 i: f
- *
2 k( R5 X; ?6 M* u/ M ~% ` - * This file contains EDMA3 Test code.( x& E' J, {; G! c# ? h
- *0 W+ b) H% ^6 j7 V- J( e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) ]7 W3 E( t- C1 F8 Y- t( f V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 g# S/ b1 b* z& y- y5 C
- * TO CHANGE.$ w& j! j& Z" l, A9 u% O+ r
- *' S# c3 I8 i4 s- _4 i; K8 S6 O5 W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# }7 |2 v& q, L% C- n - *
4 A4 c Z5 r/ d0 _6 I- s; H - * This program is free software; you can redistribute it and/or2 K3 }0 c& C( Y
- * modify it under the terms of the GNU General Public License as, g) A" ^+ \4 ]+ l/ x: O0 U( c# C0 E
- * published by the Free Software Foundation version 2.1 B$ U. t" _/ C
- ** p6 N! m# ~3 v/ _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 S# U2 |# e/ k6 {. _% M$ z - * kind, whether express or implied; without even the implied warranty/ ~, d7 ]2 ~5 E# m$ K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the V0 U, N1 U$ L
- * GNU General Public License for more details./ D9 L" J8 ]! z: z5 c
- */
7 c2 X& ?' {0 p+ v1 _- P
8 n% W2 m' a( X" c4 l! z- #include <linux/module.h>
& D% V( a2 l. X - #include <linux/init.h>4 z* g; j$ w# x9 ]
- #include <linux/errno.h>+ l- b+ }! T7 F' m8 E. U% F
- #include <linux/types.h>
# ]8 @& C6 p+ \9 ~4 ^) m - #include <linux/interrupt.h>) K2 G/ O" K; P- ^/ z
- #include <asm/io.h>7 X5 V0 D9 g4 R" G8 W3 ?1 s8 h
- #include <linux/moduleparam.h>
9 j* b }3 T2 P; w5 l- g" S+ \ - #include <linux/sysctl.h>- N: _4 F- @6 t O0 z
- #include <linux/mm.h>5 |) [+ J3 R* d$ W
- #include <linux/dma-mapping.h>
0 g5 K- r/ g1 H/ v - / g: M$ e' G3 k4 C& y# U; I9 g2 P
- #include <mach/memory.h>
% }) z) ~$ J9 q) B+ w - #include <mach/hardware.h>! G/ I5 H [- y! ?* ^
- #include <mach/irqs.h>
5 N* \+ q) H o3 q4 Q/ ? - #include <asm/hardware/edma.h>
& ~ y' b. v/ B+ Q2 |0 n4 g
4 }8 Z: E0 `3 B$ ^ z- #undef EDMA3_DEBUG1 D5 M m$ O1 ]% r
- /*#define EDMA3_DEBUG*/+ p) Z. d) D) ]+ s- r+ p5 g) m
- 6 L* z: W7 p5 |! m D z
- #ifdef EDMA3_DEBUG0 h; Y+ F/ } X5 x6 \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ l& Z6 a/ a5 g8 L+ n& o% V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): ^7 p% S8 r. O8 Z, {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 p" e3 n9 q9 D - #else
2 S7 I: V; w1 ~! o3 p6 N - #define DMA_PRINTK( x... ), ~2 A: w- r% g, r! X. F) Z) ]
- #define DMA_FN_IN) o6 k7 g- x" V! `
- #define DMA_FN_OUT
7 O: s9 _+ p' ?* A - #endif& U- m6 c7 x' t' d' h
- ~" Y1 Y/ H: @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( `' T `5 R+ p5 z& ^: G
- #define STATIC_SHIFT 3
' y8 _8 q5 h1 S2 J8 D0 S - #define TCINTEN_SHIFT 20
. z4 y8 r( W2 G9 m+ I6 |, L: u% ] - #define ITCINTEN_SHIFT 21
# r- V R" u9 h+ I6 [0 k - #define TCCHEN_SHIFT 22! q4 m% T& u5 i
- #define ITCCHEN_SHIFT 23
5 e( U5 m* E, k) c* o# H W
3 g; k# j$ L5 [; c9 [/ h, J* D% J- static volatile int irqraised1 = 0;# k! J3 f+ K4 S% z
- static volatile int irqraised2 = 0;
% ?; |5 f8 b e3 \0 L5 x - 8 J; Y6 V# y$ B3 |6 ?: T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 Z/ l; S) P0 g+ q, G! n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) a9 s# E" _2 M. @3 } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; c, ^5 T$ }' m1 W: _: u; q* G/ V
( l) H2 N2 |1 d$ U- dma_addr_t dmaphyssrc1 = 0;
R2 d. Y0 D) h: z; W6 X2 e7 |: y - dma_addr_t dmaphyssrc2 = 0;
4 o8 l$ B# W) S, u6 w; j* \ - dma_addr_t dmaphysdest1 = 0;
( z8 X4 {3 k( _ - dma_addr_t dmaphysdest2 = 0;5 u- R0 f8 ~2 b" t
4 c8 n1 y' F$ [& J- char *dmabufsrc1 = NULL;
B6 [) P; T) @& [* z7 J$ x - char *dmabufsrc2 = NULL;
5 n. V# D2 m1 W0 B" ~5 ^ n* s - char *dmabufdest1 = NULL;
V0 X& y1 j5 t - char *dmabufdest2 = NULL;0 _0 v" \8 E$ O7 N, ?, Y! r/ Y
' _ F, c# x8 T s6 a, p- static int acnt = 512;1 M9 I( K2 j4 n$ n
- static int bcnt = 8;+ }; K- f" y# {& D" o$ @! P; Y
- static int ccnt = 8;
( C: ^+ Z5 ?, B! ^: ? - - D6 q( S5 H" m8 {
- module_param(acnt, int, S_IRUGO); L- v4 f/ t1 Z
- module_param(bcnt, int, S_IRUGO);
+ Q7 M+ V# ~* g - module_param(ccnt, int, S_IRUGO);
复制代码
6 |6 w' O+ `0 K( o$ r0 a- O% h
3 l4 F: j8 L j9 ^/ Y& ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& v, N# c b$ I) c5 @* farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 o" ~) D0 o6 k2 a k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) R0 a- x, q W# e$ m2 m$ ?4 ]" _
g' F- G6 W# T. h0 u0 Z- b9 k4 o N6 h; t
|
|