|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # {2 b( @7 @$ H4 E7 `5 K. v
- [code]EDMA sample test application. J6 U2 Q# ^1 f7 Y, p0 D* v
- /*
" h9 S6 `0 `2 k5 ~3 P - * edma_test.c1 R0 w D1 m) j
- *
+ h( q. u, T8 x8 m, d& X - * brief EDMA3 Test Application
+ i+ S- x: z9 h/ O3 j - *. \2 e1 {, B/ R, e! G
- * This file contains EDMA3 Test code.0 o5 f" m8 i6 z: c' s3 n# J* y
- *1 e! m; u( Y8 Y. `5 R3 Z* L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 `( f& x% I+ @) o1 J% x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- W/ g" _' X; e - * TO CHANGE.
9 E% W6 j% q* q - *7 p0 d' n1 U1 q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# h! T3 L8 l Z
- *1 z( {/ T* Q0 T7 E
- * This program is free software; you can redistribute it and/or
. @ t, o7 C3 b6 h& S - * modify it under the terms of the GNU General Public License as, h1 o" X# q& }% T g7 Z
- * published by the Free Software Foundation version 2.
O& \% I* j( C! V6 A/ D - *# s+ r. u2 f X B" O5 s3 O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- q8 w4 _: W; y9 C9 p, c
- * kind, whether express or implied; without even the implied warranty- `% C( q9 \. _, R) y& x$ v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' p V% B% c) ^ - * GNU General Public License for more details.
" |0 I9 w# W+ h/ ] - */+ t; {& H; f. z) @4 v8 I
; A- ~* Q: z8 h' D B" _1 L: c$ X- #include <linux/module.h>
" v0 J8 i+ u' d- l6 [) t" ~ - #include <linux/init.h>
7 k' d0 [+ x: w0 d) ?$ ?7 p - #include <linux/errno.h>
. U1 j% R% F4 H; C! ^7 L, U/ A* G) L - #include <linux/types.h>+ Q( \( Y5 n; P# y
- #include <linux/interrupt.h>
/ ?) E' N. y/ v5 e: Q0 O5 I - #include <asm/io.h>0 X8 ~5 W& M0 ?: |4 b, ^/ z
- #include <linux/moduleparam.h>
5 m) ~" Y; z- J1 k4 { - #include <linux/sysctl.h>
0 d% c. g3 z8 ^; s! V+ g5 @ - #include <linux/mm.h>
. V& Q# D6 i1 g# W# X - #include <linux/dma-mapping.h>
, Y3 `, [! S6 b v9 \( c - 4 L U0 H _. B# \1 N
- #include <mach/memory.h>
2 w! F! C" e H! g0 d& V* m - #include <mach/hardware.h>
6 S# ~' g$ o7 \; }9 b' h - #include <mach/irqs.h>8 N9 k& ]: e5 C1 A* K; B
- #include <asm/hardware/edma.h>
$ t; z7 @0 s$ ^3 i+ v
7 H. v% D8 M5 P' B/ Y N3 G2 y% K- #undef EDMA3_DEBUG- Z `/ X7 Z( ~' a1 a% X
- /*#define EDMA3_DEBUG*/' r* w1 N; r f1 p
/ X: h/ c6 d1 _: ?& a6 M1 Q- #ifdef EDMA3_DEBUG
3 B: A1 y% M' J8 ~" ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 h$ p5 T- d* }8 I: s! w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ Z" Q7 _& f$ w0 m! P6 a1 S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 N1 c& O2 q! W' ? - #else4 n6 Q5 g; E9 T
- #define DMA_PRINTK( x... )/ m$ F n! e9 F3 X: \
- #define DMA_FN_IN# h! n9 j# M' o
- #define DMA_FN_OUT- u% ~: Z8 v' @9 T. q
- #endif5 J. V( `6 t7 c/ Z c) H
1 Y' B' n5 ^. h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 f6 r8 @! I: K6 u1 O- {
- #define STATIC_SHIFT 3
5 q: d8 |. y+ @: C' r2 [ - #define TCINTEN_SHIFT 20
3 [4 H, p3 q( ]- C) P - #define ITCINTEN_SHIFT 21
( X7 N+ M3 {) S' }, L5 Y, ` - #define TCCHEN_SHIFT 22
" f" Y6 [4 r9 s6 O1 I+ h - #define ITCCHEN_SHIFT 23
1 }3 ?4 L6 t2 M' b7 E$ s( @
$ s& ]7 Z- R, T( v" f- static volatile int irqraised1 = 0;: |1 x; T- b$ I# ]2 l1 U/ S
- static volatile int irqraised2 = 0;! ?$ ~( V2 w. b8 J: ?9 f% R C
; R6 u$ l; L. S* R0 O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# L; d7 a9 B1 c) {% g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% X$ `, x" J# p2 f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# F) X. ^& r G! p! d: D3 S - J! s W0 G v
- dma_addr_t dmaphyssrc1 = 0;
4 n E* e0 e6 P( `# ~ - dma_addr_t dmaphyssrc2 = 0;
4 ]0 K- U6 R/ w) g! c6 J - dma_addr_t dmaphysdest1 = 0;& U: A' y; R$ r) _. h0 z5 \9 V
- dma_addr_t dmaphysdest2 = 0;
) U p& H2 Z D+ e' m - : q6 G5 u# O* r0 w- }# L
- char *dmabufsrc1 = NULL;
4 I2 U6 H/ M! J9 j5 e. Y - char *dmabufsrc2 = NULL;; H! J# z- |/ L
- char *dmabufdest1 = NULL;
% m) T& {: M, ?$ z# Y( g0 |% W - char *dmabufdest2 = NULL;
" e9 X) p1 J. @' N$ O - 0 b. u; h! i0 P- ~+ F2 W+ _
- static int acnt = 512;
7 C. T4 E& X! k, ~$ O5 F; D - static int bcnt = 8;
( R; h9 O# e6 S- U - static int ccnt = 8;
2 i# Z/ o9 |4 v - & z3 k0 E" U% M9 t5 E
- module_param(acnt, int, S_IRUGO);
% o. X2 M7 J- V- l7 j1 Z6 }3 w - module_param(bcnt, int, S_IRUGO);
" C6 }0 {0 m" ~3 M - module_param(ccnt, int, S_IRUGO);
复制代码
8 h; L1 R U& d: T/ k2 W8 L ?
3 g; r# w# e1 e3 b8 f4 B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 ]' ?( Q4 d: L' P; x2 X* R3 U d$ v) z ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' W4 M! L0 }) I: j- P8 K1 e4 s, A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- U' i8 F; H! E+ Q- z
+ \: ^" I3 F% G7 v \' c! e, j: v( w6 V& [9 L
|
|