|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 o S! z; P, K& z2 ~& ^ f
- [code]EDMA sample test application
/ S3 m; b$ W; C% C - /*$ m }% i; ^6 i- C- e6 o% }
- * edma_test.c9 r, |+ V/ o& O1 f
- *
& ?, P9 ~4 T" P! X/ c" Q x - * brief EDMA3 Test Application! Z. \6 A( `: h
- *
6 n/ D5 V# N3 \- N* T1 T, j* V& u - * This file contains EDMA3 Test code.
" U" G+ _# K. G% g8 d' c0 V - *
# Y! z' A4 [2 T# X! B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 w$ x; u& k3 ^! f- s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 t2 x5 J+ T; C5 U& V [0 `
- * TO CHANGE.1 a) ~2 @. X& |
- *# I! `& w" i. r3 o' C/ ^& c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 o$ { _/ f+ v+ w4 Y4 f
- *
* j! }# ]; Y [9 b - * This program is free software; you can redistribute it and/or" T: r8 J2 l: b/ Z+ A4 |
- * modify it under the terms of the GNU General Public License as! w' N9 E) _" |, t7 L. M* @& d4 a3 K
- * published by the Free Software Foundation version 2.* e$ m( e" U$ N5 L6 y( C# v: W( z
- *$ {7 }6 V8 \) I' [8 ]. y5 m) [& C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& g% { k" y! n/ V4 U/ a - * kind, whether express or implied; without even the implied warranty+ u, k2 Y9 F2 w- e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& w. a5 Q d4 g" I/ u - * GNU General Public License for more details.
3 ^1 O# t+ A5 _6 m3 \+ z6 N7 G - */) A G1 Y9 O9 N# \# r
- V; G8 D4 Q6 p# ^& o5 Z
- #include <linux/module.h>
: i) r0 k q0 G$ v0 H8 s8 r* M - #include <linux/init.h>6 w1 e1 B0 O' \) ~
- #include <linux/errno.h>
7 n9 y; X5 G( ^5 _) M - #include <linux/types.h>
; D+ i( m L* t; y( P/ V5 r' w7 O6 @* _ - #include <linux/interrupt.h>
9 ^' z8 e) Y, Q0 M; _2 }& O8 | - #include <asm/io.h>5 A6 X1 @' H# b! [
- #include <linux/moduleparam.h>
[' w4 E9 \: x' j$ I) Z$ O - #include <linux/sysctl.h>
8 u6 S' l# @0 b( x - #include <linux/mm.h>
! \2 m4 ~+ Q" \% I: I( I/ x - #include <linux/dma-mapping.h>
0 H' R' C( I; ]1 q: j - 6 d2 x6 w7 v2 e* E
- #include <mach/memory.h>
- R2 G& k0 r. U& ~, A, z. T - #include <mach/hardware.h>; \, y7 n) J V ]# S
- #include <mach/irqs.h>
* _# C$ m$ n6 E6 P7 D7 F$ b - #include <asm/hardware/edma.h>
- D9 v% b2 z' Y. I. J& d% D
, e6 M8 j; g8 {$ m1 k/ i2 F- #undef EDMA3_DEBUG }0 ^/ _" D7 k Q4 |
- /*#define EDMA3_DEBUG*/" n' K1 L0 w1 M2 |1 [; W4 w8 N
1 A$ a5 y/ u% v7 ?% X9 ?- #ifdef EDMA3_DEBUG
+ G& ^ O9 i3 _4 @* _: `3 f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), |8 v C# o. A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! }2 C* m6 Z2 ?! e% w9 L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# d# O' t+ o9 t! V' N
- #else$ k- {2 T6 r9 ^; {$ c" i. L
- #define DMA_PRINTK( x... )& m+ |+ k0 L7 [8 t
- #define DMA_FN_IN6 H, D( P# }& T. j) u) ^
- #define DMA_FN_OUT
4 v1 G- J( w! }6 N8 x2 @ - #endif* S/ P5 [$ m( R
h( n8 V- t$ ?3 I. [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- V k. C7 c. \ L - #define STATIC_SHIFT 3: x% L( N } ~! ?. ^ U' Y
- #define TCINTEN_SHIFT 20
' M A5 P, e9 F3 `7 Y4 A% e9 F8 d - #define ITCINTEN_SHIFT 21+ X+ q9 R0 O* j$ J! a- A
- #define TCCHEN_SHIFT 224 X( I7 m, U d& z! `' I' c
- #define ITCCHEN_SHIFT 233 [1 D/ S- N3 N% O6 }% g
- + ?5 z: z% U2 o0 z3 W% n
- static volatile int irqraised1 = 0;2 J% \$ Q6 H0 Y1 ?) v& b9 U
- static volatile int irqraised2 = 0;
8 _1 }0 ^# q* u2 j - 8 b B" @1 v0 L1 H4 p' X" G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* R' I$ c& D$ n, r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( a& h4 ~$ R, ]1 c; z+ R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. m% q! K2 ]: S9 I% z, v1 ^
& Q! x) T( j! H; @- J, g9 S7 _- dma_addr_t dmaphyssrc1 = 0;0 ~/ M+ Y* y! \2 K, q6 A
- dma_addr_t dmaphyssrc2 = 0;9 g: f3 |0 N/ h- I
- dma_addr_t dmaphysdest1 = 0;* I* O: D7 O H* C# B2 C9 N' o7 l
- dma_addr_t dmaphysdest2 = 0;
& N; X7 [/ E9 s) H7 o
7 e2 {+ R3 [" [6 E* e- char *dmabufsrc1 = NULL;
- T- I) A# b, Q3 b$ t8 l - char *dmabufsrc2 = NULL;
$ w0 V6 c, t r! w7 l - char *dmabufdest1 = NULL;
1 F, a: [# s- A3 o1 S' J) Y* m - char *dmabufdest2 = NULL;
& R, F$ d+ K5 `. s! Y0 v+ O. f - 7 q) R0 C! t- }6 Z6 C& {
- static int acnt = 512;
. R0 R% W" \5 Q0 v) N - static int bcnt = 8;
3 L/ o9 f% S$ U4 M/ N9 z - static int ccnt = 8;' E9 n! G Q8 @' y( Z
$ K: E% `; o0 j& d& w- module_param(acnt, int, S_IRUGO);
: f0 s B/ K" M. Y1 H- h( L0 W - module_param(bcnt, int, S_IRUGO);2 O4 A. o5 C- p0 r
- module_param(ccnt, int, S_IRUGO);
复制代码
( H1 T* _ e, ^7 T9 {& Z( ?+ }
+ f( @' J( H4 x. T6 P, u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 r% o. s5 [, K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! m1 ]1 i& ~0 z# {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: N7 R2 a6 [- n- W/ M3 U
& k/ f: A) Y7 Q# \
2 V/ m6 i1 f, q! f/ j |
|