|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 m, P) M3 b, D) Z
- [code]EDMA sample test application% f! s9 Z+ `& O5 c* V
- /*
; ~* ?1 u1 Y5 y - * edma_test.c
& R0 O y' }) i9 L0 v - *
9 _' z/ K& Z2 _0 L) j - * brief EDMA3 Test Application( z$ e- r4 n! h7 F$ r
- *
8 f3 A+ k% x2 O; ` - * This file contains EDMA3 Test code.( K: z9 M. K2 m8 [. K8 T( O+ |
- *
0 \' K& T/ q2 X1 Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 S4 C5 f2 ~4 q. P9 {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. b9 D8 _7 ]5 m" j1 T4 e) k - * TO CHANGE.
6 i: R6 D& s4 a3 D: O - *- Z& P, H, N8 q) D2 [9 a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% ]3 L5 J9 a! W# Z% g, m; s+ q9 c2 L/ C
- *
# H( d, M5 \6 J g. Q - * This program is free software; you can redistribute it and/or
2 E5 J- c0 S1 D+ t- o6 i - * modify it under the terms of the GNU General Public License as! |6 q4 D, ?% t) G7 I
- * published by the Free Software Foundation version 2.7 n8 Y) V0 R/ V+ f
- *
& K- m" u: G: U9 G! h1 J/ E r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 E: L; ]! A, T9 q - * kind, whether express or implied; without even the implied warranty- Z5 w4 O) H, F5 G; q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 c- Z( _* \: `0 w% H& }% f& ~ - * GNU General Public License for more details.
& R- A) r$ l! z8 F3 L - */4 [8 e) X7 Y; b5 P4 z& t
$ G, d$ U1 o& H& e- #include <linux/module.h>
0 {& N$ `" ?. V* W8 j - #include <linux/init.h>; q9 A; k1 \ P) P5 n% i( z$ d
- #include <linux/errno.h>
8 D% _# W. b; |( x2 F - #include <linux/types.h>
% z l8 P3 @7 N$ a - #include <linux/interrupt.h>
& h% p2 i0 j, U; u - #include <asm/io.h>
, g! j( a" A0 W - #include <linux/moduleparam.h>
; ?+ j' K7 m4 g0 S3 U - #include <linux/sysctl.h>7 W6 ]3 V! c& p: H: N& d- E% N) a: j
- #include <linux/mm.h>
: H: |( D1 w c! X7 q+ }. y' B - #include <linux/dma-mapping.h>4 A8 d/ P* b- F; q: W# j$ K
: l8 f6 l# [, d1 p9 ], ^+ T- #include <mach/memory.h>
6 ? @! O" T7 `7 ] V - #include <mach/hardware.h>
* R% M$ b5 {, ^8 j* t0 D- t8 f - #include <mach/irqs.h>
& O L+ r1 d: g9 x8 G - #include <asm/hardware/edma.h>1 u8 k% N% a$ Q }
- 4 G- b7 X+ }* f. c0 T
- #undef EDMA3_DEBUG4 H) f% D8 l9 D: E: p
- /*#define EDMA3_DEBUG*/
3 j& `! M K9 ~9 R1 g - " R! P, F! j8 `% j* Q' p. s
- #ifdef EDMA3_DEBUG
& o4 {2 e S2 y$ u( c/ _' g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 S) f$ @* b0 Z) Y \8 N4 u: a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 F: {- x) @' \+ ^: Q) V2 c$ X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 I. v, A' L( B9 V+ ]/ ] - #else( y/ p2 Y, _9 x+ S2 [
- #define DMA_PRINTK( x... )
3 S8 L; n9 F0 X! X - #define DMA_FN_IN
1 M! h' P7 m, I/ W$ r' s8 T - #define DMA_FN_OUT
- b' f9 B9 G# x( R ~* B: P4 V - #endif* C, } X T3 }1 \ Q3 s3 O" ]% K J* e
- M+ m8 H/ f2 r- d! f2 @' W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) G2 C, H7 V' W
- #define STATIC_SHIFT 3/ y, U- y5 U& h
- #define TCINTEN_SHIFT 20
' t$ q4 Y4 a6 Q) m: q - #define ITCINTEN_SHIFT 21
7 Q' T5 C& Y N1 j - #define TCCHEN_SHIFT 220 `) v( S! T+ D8 x1 W5 q# i
- #define ITCCHEN_SHIFT 23
* O" y. f! x. e6 G8 A/ x8 v
+ E# f# q! G2 x& V* t- static volatile int irqraised1 = 0;
/ v9 ^5 V J3 a+ A7 E: D; X - static volatile int irqraised2 = 0;
, t! L/ m* o& Z6 r9 y$ L - & M: C, H# R: ?% o/ H* W9 O2 O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. }% N0 l& Y# Y: I# I- r* y+ b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( \$ v+ y/ K4 k( q8 S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- W, {+ I# r. Q/ t, y$ ^
- # @' k% O- _/ W: f
- dma_addr_t dmaphyssrc1 = 0;
* [$ r7 o) H# z/ C# h; s - dma_addr_t dmaphyssrc2 = 0;4 z/ r/ D/ D! Z& p9 l( T
- dma_addr_t dmaphysdest1 = 0;) f$ V3 B/ h* w
- dma_addr_t dmaphysdest2 = 0;
" x# @6 T9 B- ^ - 4 E2 S0 T, T) l/ x( s
- char *dmabufsrc1 = NULL;
( n2 P( v" c8 I: M - char *dmabufsrc2 = NULL;9 n8 N5 V l7 X3 E
- char *dmabufdest1 = NULL;
, Z, ^& y) {# T: r6 G8 H9 c& O - char *dmabufdest2 = NULL;
/ A" V3 f& p6 o - * V( Y. |! M* e0 r/ ]
- static int acnt = 512;" S! s/ p$ y* r3 _5 c" {
- static int bcnt = 8;
# }( D; e* H! f+ F - static int ccnt = 8;: V7 G4 s( R& [
# y$ f3 B7 p5 [- module_param(acnt, int, S_IRUGO);
) E8 X& s3 ]+ w% N# x G( m8 P2 y4 h - module_param(bcnt, int, S_IRUGO);
* |4 E: A7 Z) A4 f" ?5 T - module_param(ccnt, int, S_IRUGO);
复制代码 8 i. e: x+ ?% r) O. S2 U9 O2 t: v/ m
8 b5 q6 M0 t ~( I& V+ }1 Z9 N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 y7 K/ y9 C* aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" P/ g' l6 s* Y! v+ X. o0 l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! S& D, [# D# ^% N
) W8 p7 K; q& r- @! N5 V# H! E1 V# n( H4 y2 _
|
|