|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 f6 X' [; O* F5 @- [code]EDMA sample test application
/ z7 i: z5 n" B4 E4 g* o - /* q) i& W) r4 g! X9 Y+ p) [2 d* V. o
- * edma_test.c. d9 p, [5 h$ @" u8 `
- *
9 Y, O; [( f: @; a$ ]6 M - * brief EDMA3 Test Application
% ]1 [) m6 V3 B/ q$ C5 z4 [ - *
2 a2 _ r! o) j0 k+ j0 T# n! I5 q. @ - * This file contains EDMA3 Test code.
. Q# m" ?( M7 _6 M1 p. [ - *
. M8 Y: Z ~" E. s5 [# d' Q. M6 ]! z" d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ S# @/ R; t( b/ ^8 T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; [4 e5 v, \, Q; n- u) ~ - * TO CHANGE.) c8 c$ y( E9 }: n
- *5 A. z9 l8 o; q/ S0 V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 K' g P. K, ~, `4 ?
- *% h% {) u7 Q0 v+ N+ W; U4 m
- * This program is free software; you can redistribute it and/or
. S" A/ r0 U9 n2 M1 [ - * modify it under the terms of the GNU General Public License as
5 _- j% C% z- U( |5 E( ^/ ` - * published by the Free Software Foundation version 2.
v5 q7 M% m' f - *
8 @3 ~1 a. r7 G* K. { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 n4 I7 s* M2 u: g - * kind, whether express or implied; without even the implied warranty
" y/ `7 m( K# d6 N* L4 z, ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 U2 A6 S& m) j3 a) ^, y - * GNU General Public License for more details.* t6 N7 X+ \& k( l3 @
- */
: ]/ T+ `7 L4 h4 K. ~! y - - G+ H7 [ y# ^6 F2 w
- #include <linux/module.h>! ^% e) V: e' S+ ^! y7 f2 X& s8 O
- #include <linux/init.h>
' h0 N3 ]% ^$ L6 G% U - #include <linux/errno.h>& ]+ G. C) c {4 x4 ] `' o. }
- #include <linux/types.h>
9 C- V$ b% d `. t1 b0 Q8 {' e9 H. | - #include <linux/interrupt.h>7 s8 B3 c1 F) U- W7 l6 \
- #include <asm/io.h>5 Y4 ]; f* {3 P6 _6 g" O* ]
- #include <linux/moduleparam.h>5 t3 P0 U8 k. G& [: _. d6 z
- #include <linux/sysctl.h>
. `- J3 x! y* Z; X: I, @, t" V - #include <linux/mm.h>6 X) ~: i. N& K( ?; ~
- #include <linux/dma-mapping.h>( i" z# T7 l, Z
- / }* e, `2 U9 s7 p
- #include <mach/memory.h>2 J2 r" X* G& O1 h* K
- #include <mach/hardware.h>
1 q" G2 r- j S$ J; c" A) x - #include <mach/irqs.h>
0 H# Y+ O" U& a# m4 \! b" p - #include <asm/hardware/edma.h>
" L- D& q9 m" K% r - + H) @0 ?6 ~9 v9 |2 r/ |2 u8 b2 M
- #undef EDMA3_DEBUG
9 S7 q# L; ]# p- R( ~( [+ o - /*#define EDMA3_DEBUG*/
/ |$ `; a# v/ j. f5 S% n - 5 t3 N B: h7 G) y
- #ifdef EDMA3_DEBUG
5 l( F( A: H; ~5 Z, u- U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 [5 l% E" X7 I& D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! b: o+ B9 m4 U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ J1 I, C) l) ?) d3 s- ?4 ]0 _+ _/ w - #else
8 p8 _3 _% [6 H - #define DMA_PRINTK( x... )3 C6 p7 b6 b$ d$ @
- #define DMA_FN_IN
* `4 d% V9 h* C: ` - #define DMA_FN_OUT0 h5 a% C7 A2 N8 q; h2 j
- #endif
) r9 n: M1 s& M8 G1 g7 m - + K' i8 m, ]/ T. l! q0 ?3 ^9 m7 C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 m b+ i% |1 @6 `% D$ G% n. U7 P, l - #define STATIC_SHIFT 3# t6 l' k& O6 z7 u s
- #define TCINTEN_SHIFT 20
9 E0 X3 a+ j1 P- M _ T- P7 c - #define ITCINTEN_SHIFT 216 N5 y. h8 J) D$ q5 w# R0 H3 }& P
- #define TCCHEN_SHIFT 22/ y. n6 |; ?' q, u# B! c
- #define ITCCHEN_SHIFT 23
& B, l9 N v0 J+ W - & q- H# K8 Z; n4 m
- static volatile int irqraised1 = 0;0 e! @: V6 b, c. w9 v
- static volatile int irqraised2 = 0;$ B/ T6 z1 z0 X6 c& @* r
- 6 Z( T8 q, V5 _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ z; k8 C+ ]& H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ T6 D5 y w, W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 a8 _, C }. G; L! G
3 ]8 U7 Z5 E( Z. A0 F& M- Q- dma_addr_t dmaphyssrc1 = 0;
9 `% K1 y+ n @9 k& T# x1 ? - dma_addr_t dmaphyssrc2 = 0;! e5 L5 z& F/ a) B
- dma_addr_t dmaphysdest1 = 0;: P' B! G1 E/ x! E7 @
- dma_addr_t dmaphysdest2 = 0;8 ^9 C5 c2 s( i8 m* q
- e7 ^3 A0 I. P" ?! ?! f
- char *dmabufsrc1 = NULL;/ E; h4 e, n* m/ G) @/ D
- char *dmabufsrc2 = NULL;
: |5 \- K1 \1 K( ^+ b, } - char *dmabufdest1 = NULL;2 y* p" y" Z4 |; q9 h
- char *dmabufdest2 = NULL;
8 q$ `/ n9 t9 k; N - : N- V; r0 p- ~+ ` J
- static int acnt = 512;; S. Y$ X- @' H1 s0 j9 i+ w; X0 R% N
- static int bcnt = 8;
% y% [* J7 M) M: J6 e" v - static int ccnt = 8;8 y" C) z6 R1 T) R3 X3 m L
9 U9 H' m" A) M7 O' G( {) Y% c) W- module_param(acnt, int, S_IRUGO);. a2 ~* y. j; s! W' h
- module_param(bcnt, int, S_IRUGO);" E6 B) H# b1 C+ G2 s
- module_param(ccnt, int, S_IRUGO);
复制代码 , t2 {9 N. t# F* y8 v2 {! v* i
0 U, r, }* u, N6 T p0 ]; v" r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' P0 Z$ R: m+ v p# ?2 ~( m; l7 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 A( e, ~) e. Y1 q' A* e% E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) p& M0 h; X. G5 ?+ w
: n: I4 |/ q5 `8 V: Q1 L
" Z0 @5 {5 q, s, F
|
|