|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ L' }6 b0 T: F8 H* l- [code]EDMA sample test application# t1 `6 e& a8 T% f" u
- /*
) X' N7 x2 \# ?( k - * edma_test.c; L' M) b4 A5 d* m: @' s% O
- *
; ~' ?; F' J7 Q. J/ w4 _" M7 @ - * brief EDMA3 Test Application# Z, A4 i. b; Y9 N. z$ }" U- J- W
- *
* V. g B. o7 u+ s: C/ `# C9 j1 G - * This file contains EDMA3 Test code.
% l2 k% b, j* Y# g. p J% q - *
: i9 s0 L- E/ W7 U- `/ S+ E% h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; k0 ~# D: g! ]& V- q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
I( O! S2 B( V; {$ x% W9 M4 s0 O- P - * TO CHANGE., i6 k* \2 K4 L8 p2 p9 q4 X7 E
- *5 b! f% m* M4 f. B0 R) \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
}" H6 z; k1 U! [7 Y7 }" t - *5 R& }# _4 t" J
- * This program is free software; you can redistribute it and/or: }9 n/ w3 H. l$ y: n5 h' S
- * modify it under the terms of the GNU General Public License as( u1 {: y0 k! T6 J/ R
- * published by the Free Software Foundation version 2. A' D) l* h# }( g9 v0 W. M
- *+ Z Y/ o( i+ A! [4 r. g/ I6 n$ _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* P! }( P9 U3 Q. v! F" I - * kind, whether express or implied; without even the implied warranty3 Y1 ~) Q3 c! L" B' s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; u v4 j' C2 d# _
- * GNU General Public License for more details.2 r1 f8 H6 G, @, k# w J' S/ P
- */: @+ e/ c( f( n6 e4 l1 s
& L& @, M- X; e$ k6 Y" j* L2 h: N- #include <linux/module.h>5 u! v+ `' P4 f
- #include <linux/init.h>& a0 @( U3 r) c1 C/ \3 @
- #include <linux/errno.h>4 F ~: d9 n" Y" q8 t& {0 C
- #include <linux/types.h>5 R3 }# f' Q( g) W( w
- #include <linux/interrupt.h>' w) W4 ~- C+ A7 {; ?# |( p
- #include <asm/io.h>
4 r$ U1 h: M5 [+ } - #include <linux/moduleparam.h>+ ]( @. R8 ]# ^# s4 v, L. t( |
- #include <linux/sysctl.h>
- ]8 _- m2 g1 A - #include <linux/mm.h>* t, L; d, z/ [
- #include <linux/dma-mapping.h>- n5 M j6 t$ m3 Z7 o g4 e
# \7 H8 ~1 C% R6 R: s- #include <mach/memory.h>) J" e8 |1 J3 l
- #include <mach/hardware.h>
y) _' Z' A% L- W& ` - #include <mach/irqs.h>( K9 ]6 ?( o, K* t, O6 U
- #include <asm/hardware/edma.h>
3 ]# ~7 B! {* p! W3 P/ I
$ F* H) q; L! r+ L2 o/ D1 g- #undef EDMA3_DEBUG
! x9 |& N! [: Z. z4 | - /*#define EDMA3_DEBUG*/9 @1 h+ y! F a6 Y [
- 5 g& a, n6 E9 E
- #ifdef EDMA3_DEBUG- a1 F" n9 H- ]% b; n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* S& B- B# N9 r+ E* f: ]) ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 q5 ]+ f) [5 `$ U! V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. @% J9 V! {5 O: A* Y; m! \ - #else
5 {; N" N$ r b" a1 k3 R. P - #define DMA_PRINTK( x... )6 \7 E, m% @( L/ L
- #define DMA_FN_IN' U" F* A% S$ K; r
- #define DMA_FN_OUT9 g* t& X5 z; K" @( R
- #endif
$ I2 Z, d: F+ w - : B+ m( f! o+ o- r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' ^6 _! v. x* Y' n/ e* a5 A
- #define STATIC_SHIFT 3* [! s ~; I* T5 ~
- #define TCINTEN_SHIFT 209 v2 r. i% [& A0 E% j
- #define ITCINTEN_SHIFT 21
2 [( {; L* G1 m- l1 { - #define TCCHEN_SHIFT 229 h# j% C- F6 F& }) l& F
- #define ITCCHEN_SHIFT 23$ f' _! i- g$ g
- ; ?: w' f; j, A/ [9 o
- static volatile int irqraised1 = 0;
1 }7 S& Q' A' e. Q. T$ g - static volatile int irqraised2 = 0;" o/ R$ \" j: b( H7 S" B R
/ v+ m) `% d5 J& t. Y' I, `- Y3 C& ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; A8 [5 N- ]. y: G! v" m- S5 c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ]+ @1 a& j7 N/ Z5 J- W7 B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 W2 L5 ?; L) s% X - 2 q+ R& e9 B$ q6 B* y+ T* I
- dma_addr_t dmaphyssrc1 = 0;
% j3 ^. _1 ~/ B7 N- | - dma_addr_t dmaphyssrc2 = 0;
- | H, v J6 _1 N5 ^& W) t - dma_addr_t dmaphysdest1 = 0;
1 {1 Y7 D/ L- g# ?! U - dma_addr_t dmaphysdest2 = 0;* p6 k0 a' }) g0 N6 Z( n
- " S! Z( r0 I2 K
- char *dmabufsrc1 = NULL;
+ [1 J5 C, e9 U: c - char *dmabufsrc2 = NULL;3 ?# P" s# P7 F f
- char *dmabufdest1 = NULL;
- l4 u6 |* Y" w! }8 _) ` - char *dmabufdest2 = NULL;! g' n z+ R2 C# C& ?
- 6 j/ ^' j$ H8 ?& V2 J( w: o6 q
- static int acnt = 512; S& q9 K" n0 E) N$ @
- static int bcnt = 8;
O R' p1 k; y* s7 e% B - static int ccnt = 8;9 E/ d6 C, e* i) v) M9 Q3 I6 H
- $ Y, `7 b5 D3 r% M" ?4 \$ n/ q# r
- module_param(acnt, int, S_IRUGO);
6 ~# h3 w6 |0 p5 V1 i5 Q! z - module_param(bcnt, int, S_IRUGO);
$ a4 G, V# y/ C: ?$ m" i9 Z D - module_param(ccnt, int, S_IRUGO);
复制代码
5 z( g0 Z3 {& U7 W2 C( m; U3 q# c3 t! m8 b) o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; d* |4 f& |; D" H$ s0 F& I! darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- I7 _' z8 R% x: n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 S# T5 l- {8 t% `% `9 q- b
( H. p6 V0 N7 G- Z5 o! ], U% L+ n9 T" Z/ d/ ~/ K% S
|
|