|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 x2 p5 y+ D& M; M) a( P
- [code]EDMA sample test application
: g& ^9 Z6 D/ s7 Y( p - /*7 k: f( c6 [6 y* p/ O* P2 a
- * edma_test.c `) r8 Y- ~2 W/ f4 T) P/ `
- *. w; B2 B8 U& H9 |% H8 ~
- * brief EDMA3 Test Application
' v" Y5 o% K$ s) ~3 | - *
/ x" A# ]2 H$ D1 _5 \- |6 L - * This file contains EDMA3 Test code.6 ]' [& H& U$ r+ M
- *4 y. t& l* ]& A8 h# M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, T: i% n) B, h0 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; @- A8 d* H% ?! C. ^
- * TO CHANGE.
+ Y5 }' l9 }' b( D - *2 d6 X8 v/ b9 ~& o# ~6 `9 I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# a4 f2 m! x2 V5 y P! C3 o2 ?& p
- *2 t& ~- {3 `$ ?8 W
- * This program is free software; you can redistribute it and/or5 s9 V1 u1 c# K" I) d
- * modify it under the terms of the GNU General Public License as
2 P2 F) l5 X* i4 A. r; U# a - * published by the Free Software Foundation version 2.8 q# A% V7 }: a- K2 |& ^
- *
6 T! v0 Z2 D1 J- A" l; w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& r' z- g' F n' U3 y3 o3 @% \ q - * kind, whether express or implied; without even the implied warranty% E! X# I+ c; @2 A' k/ C! g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) Z3 X F5 m, }- Z2 H; \ p3 [ - * GNU General Public License for more details.( p6 B' B; v0 ?+ B' J( q. R( n
- */9 s! s, v3 A% R1 _6 ?0 L
p4 x# B4 N [* Z5 A: W- #include <linux/module.h>
2 m: w. s3 x9 W$ o9 ~ - #include <linux/init.h>" p( X, ?/ N/ l2 @9 O1 g- c+ N
- #include <linux/errno.h>
4 a1 C2 q4 Q& @ - #include <linux/types.h>( K) |. J. L! R' A& g1 N
- #include <linux/interrupt.h>6 N# e3 e l% Y( E& n' ]% r
- #include <asm/io.h>
g7 C U" |( \, w& V - #include <linux/moduleparam.h>
; _! @1 n4 Y7 G* U; W/ F - #include <linux/sysctl.h>
, F( v7 ]( K, U* v1 D6 M' k0 z* U - #include <linux/mm.h>9 b2 g' b& C; F
- #include <linux/dma-mapping.h>+ m& {9 Q6 P( K4 u
5 s5 V! F7 C. N+ d6 |8 j: u- #include <mach/memory.h>
* j& X Y! L. H+ r) Y k - #include <mach/hardware.h>7 b7 l7 O& Z) ]% C: s
- #include <mach/irqs.h>; n( \& {' i9 L
- #include <asm/hardware/edma.h>; M" \1 t$ n% C, x- C# L$ l4 u+ o
( O. O$ b, p# \+ J: p- #undef EDMA3_DEBUG
9 z, x/ \* b% L2 M - /*#define EDMA3_DEBUG*/
3 J- q5 i) |4 a. f
) B# `2 a; x- h {1 i0 y+ N+ M- #ifdef EDMA3_DEBUG7 w, N+ c# A9 S8 `' K. B! W9 A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); L; \- e- {& s2 U8 C- E. a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ Y6 Y1 c- t" v! X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 `- l+ J5 d' x) F
- #else
% S" l! [) p ?9 @ - #define DMA_PRINTK( x... )# h- Y' m, V) l. E- `7 A/ M
- #define DMA_FN_IN
# G8 Y! |- H0 w9 S5 j3 p - #define DMA_FN_OUT
H. @8 P3 L5 s* ]: R" h - #endif( j9 f! \3 x7 M9 m; O
% j3 d+ o* s* o8 A1 F/ U* X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 P. p' |6 G* Y- r6 `, {
- #define STATIC_SHIFT 3
L" X8 u+ g* f A' F( X) f - #define TCINTEN_SHIFT 209 c% k- a/ r/ Z: a. f! e' n/ \
- #define ITCINTEN_SHIFT 21
( g3 C( H! T U: W - #define TCCHEN_SHIFT 225 w3 c' p1 z4 N2 I
- #define ITCCHEN_SHIFT 23! \- F" T" v3 @
$ A5 \" _- Y2 e% A( L- static volatile int irqraised1 = 0;
N; e* G; b& x3 I7 I; u* A, D! V6 n - static volatile int irqraised2 = 0;
& R D0 D4 J# L8 U
. l( s& ?+ x6 D+ x( [! O) u1 |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! C5 F t) S, o( [4 q9 Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 t( Y" X& i" M* d, S: p ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( s! X" q6 c0 @( N% w
- ; r& ?+ J+ @' I& m# N
- dma_addr_t dmaphyssrc1 = 0;) @* l( t8 j- A! l' n& O
- dma_addr_t dmaphyssrc2 = 0;, T0 W2 T3 I& @6 o- P# ?, [
- dma_addr_t dmaphysdest1 = 0; [8 o4 |& ?8 u
- dma_addr_t dmaphysdest2 = 0;
- k5 ^4 M# u: r - 4 L, j5 h2 d3 i/ J, I, ^$ X
- char *dmabufsrc1 = NULL;0 O0 }# }0 p5 w& }# [
- char *dmabufsrc2 = NULL;
6 d1 u" r8 }6 i) A* N; o$ [ - char *dmabufdest1 = NULL;3 Y) D; \0 q3 _
- char *dmabufdest2 = NULL;0 r+ V. ?" H4 ]1 m8 N0 g D
- 4 `! R" V$ N/ c+ A2 \
- static int acnt = 512;2 m9 N2 z) v$ T7 b5 W: C* w
- static int bcnt = 8;4 I% V$ K9 }5 J X6 k
- static int ccnt = 8;7 T% ?7 g% k9 x4 d
( }: h+ _7 ~* b% g: R! h- module_param(acnt, int, S_IRUGO);
+ o* J4 h0 d1 H8 b+ |: E! | - module_param(bcnt, int, S_IRUGO);, A# M) R* Q5 [ g7 a+ i- ]
- module_param(ccnt, int, S_IRUGO);
复制代码
9 \2 p% O* ]8 ^0 ^# F9 Q
2 Z8 a) {& B! Q3 w( G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, I" b/ Q# Y( W( X" carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 ^: I$ B1 U/ u3 ^- K- k6 c ?4 T- @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 l5 b1 S. P9 [4 v2 _
$ V$ X) Z/ e G
8 z/ C" g! V7 e- e |
|