|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 t. [4 c5 A4 _* x- {0 G: x1 j4 V- [code]EDMA sample test application& s$ q( @6 k0 Y. B
- /*1 m! y9 B) [2 @, x1 q+ y
- * edma_test.c5 x& H# V) C& [" n1 [! W5 Y
- *0 u8 t3 {' g/ v2 w" i% c
- * brief EDMA3 Test Application
^* d6 c2 e# C3 a+ m - *
@4 X4 ?4 g9 c1 ?& W. M- } - * This file contains EDMA3 Test code.
$ R7 I+ d) X4 Q( e% v) \ - *, d/ q1 y; p2 k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( g; ?$ H/ Y( r9 O7 f8 S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" ^9 V9 I2 E% P2 R9 v1 g$ ?2 p
- * TO CHANGE.
# d. A* ]7 ~& w: j5 `4 a - *
2 W* y% t% ^" P& W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 R3 R. ~$ K, t* i2 I% [) T - *0 @/ R8 [$ g$ K9 g r; D# Q
- * This program is free software; you can redistribute it and/or
( u. l4 a8 H) n9 _+ I - * modify it under the terms of the GNU General Public License as
. |0 K4 I; r( f( V3 w5 g - * published by the Free Software Foundation version 2.& L# V& [: c& D+ X* f& ~' p
- *& S2 }6 s s- b2 L/ N) |9 {7 _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 e" [* ~: M6 J* T8 u8 P0 [; g2 G
- * kind, whether express or implied; without even the implied warranty
) ]- G; l6 `6 X1 k) L* Y, i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. E/ o% W# {" P+ X* T5 }2 s* _9 e
- * GNU General Public License for more details.6 n7 F% a9 R/ u3 i9 }
- */) @/ A8 J1 a! c8 E6 B& G
- 4 C( K, @1 \0 U4 e* Q
- #include <linux/module.h>
% M6 v+ @( r7 \4 s5 T+ v0 s8 \ - #include <linux/init.h>' w8 C4 \; T- P7 k& F; |' O) w5 v- _
- #include <linux/errno.h>
( G: T* @0 n$ R9 d- b, Z8 t( @ - #include <linux/types.h>
6 p# k$ j6 w, T# z) n7 g - #include <linux/interrupt.h>
/ \ j2 w* F* j7 o- Z( Y; _/ H - #include <asm/io.h>
" E/ @ _2 Z6 W7 Q2 E - #include <linux/moduleparam.h>
8 s) { b- o8 k1 ?: A& } - #include <linux/sysctl.h>
+ J: ~- E# P. h% z6 e - #include <linux/mm.h>
2 G& d! E1 ^/ ?0 V2 T( N - #include <linux/dma-mapping.h>( _ m, R: a. H- x1 W. f
& A- _5 I. u" F6 O. j: S- #include <mach/memory.h>
: `* |/ `0 `" [' t# }+ x' E, a - #include <mach/hardware.h>- d( g( D6 h* p* N4 Q5 t# {2 m
- #include <mach/irqs.h>
# B- i. a2 P7 K8 ?7 Z l, R' q/ W - #include <asm/hardware/edma.h>
4 ] a! {/ L1 Y5 n- l$ B8 u& D. T7 {0 Y
6 \' U# `! }0 V- #undef EDMA3_DEBUG
7 M7 f4 h* L1 w6 L3 i6 d' O/ ? - /*#define EDMA3_DEBUG*/
! d' P& ^ T& q( Z2 [ - $ F7 }+ {& {2 I
- #ifdef EDMA3_DEBUG3 o- V- ?; `+ f3 E9 h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) K' ?, j/ ^" k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), W9 \* Y( D' F; L8 Q: ~! P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" e% o7 S8 `5 W4 b
- #else
6 U# q8 r! p% T - #define DMA_PRINTK( x... )
/ R Q, \( p3 S# F0 ]$ v - #define DMA_FN_IN
6 O7 D: ^( ^ H/ _% s3 w( s: R D - #define DMA_FN_OUT1 P7 B2 Q; P" o
- #endif5 @, s0 n+ _# E& N2 `; [
- " J" W+ j9 H/ N. ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" E7 [. n) q# N1 M - #define STATIC_SHIFT 3
* P- e3 f: B4 } - #define TCINTEN_SHIFT 205 t+ E. z6 @2 G* Y- }$ R
- #define ITCINTEN_SHIFT 21: G, x4 {2 Y! b' j5 G* a5 E
- #define TCCHEN_SHIFT 22
; ~3 u' Y; b9 y u - #define ITCCHEN_SHIFT 23
' Y* }4 @, I# Q% C - , L+ _1 V' f( y" A
- static volatile int irqraised1 = 0;
5 G2 P$ B* s9 J% l - static volatile int irqraised2 = 0;7 ~) r- p" i; ]* E' T- b
- 3 y8 x% _, F) [# @) m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. V% ?: q% E8 M+ W8 p/ _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% o3 \' O3 v/ I) d$ D) O8 {( K: g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, k! J# P; g- P: }( B
- 1 G1 Q& |% |+ s9 A
- dma_addr_t dmaphyssrc1 = 0;" t, s: E( t1 c
- dma_addr_t dmaphyssrc2 = 0;' k" ~- _" i1 j
- dma_addr_t dmaphysdest1 = 0;
8 F- u4 `& q+ @7 j2 f - dma_addr_t dmaphysdest2 = 0;4 E V' c' a) W [8 j+ O
1 g2 d/ k& N9 e) b* r- char *dmabufsrc1 = NULL;
; ?6 b( H# ^+ c - char *dmabufsrc2 = NULL;
7 O! R$ S: Z0 O- P/ n& }5 Z' I7 I0 `3 { - char *dmabufdest1 = NULL;
}$ X% X0 D3 @6 G3 w! E4 u/ { - char *dmabufdest2 = NULL;
* q C# @: B* P! R. R0 K I: h - # ?! y0 I2 [2 I6 ^4 z* L
- static int acnt = 512;' |" A$ k, @- ~- Q: _
- static int bcnt = 8;
4 }1 Z( ?. L* B: `; C/ F - static int ccnt = 8;- B* W5 A5 [( n0 D
: ^1 [* [" J2 e9 {& O& ], G- module_param(acnt, int, S_IRUGO);3 Q$ Z: P' x$ g! `" |9 f
- module_param(bcnt, int, S_IRUGO);
0 g' ?; L" M. e - module_param(ccnt, int, S_IRUGO);
复制代码 ) |( {) m0 p0 A4 A1 L
( k: S1 x1 Q2 f! E) s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' I9 h5 N; w2 Z5 H ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" {& G6 B8 O" ]$ f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 u+ \- E* o; T7 C1 ?0 D+ L0 f( g6 s, N' v) B8 l
% T3 x# [2 q- ? d- H |
|