|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 ?$ M: P' ?9 g+ o- [code]EDMA sample test application
! |, y& F* n: @( b2 W - /*
$ _. @9 z0 J0 ]6 ?3 L8 Q - * edma_test.c+ i% p% S Q( S7 L
- *
9 B- x) @; I( M! `9 w; M - * brief EDMA3 Test Application
: n0 k3 A. y% Q' c" `* p - *: Z1 c$ F! h6 _+ W- z5 N' p4 m
- * This file contains EDMA3 Test code.
+ X4 W L4 ^' u0 n - *
1 T2 u8 l8 t9 G0 y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' l& {4 ?- O; m2 u) x7 a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% }5 B$ |% M. ~9 y! W5 x
- * TO CHANGE.
5 i6 G7 C7 [3 a( [1 ]- n! M& }+ G - *4 s- u* v: M' E3 ~/ h. ?, Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 U `: E% [1 f, F+ t' F* g
- *. P, f H7 J+ D9 r) Z- w9 U
- * This program is free software; you can redistribute it and/or
2 _ p0 }4 o; S8 f! X, p1 h1 k - * modify it under the terms of the GNU General Public License as% ~2 \% P2 O! ^$ z
- * published by the Free Software Foundation version 2.
* y' _, g# v2 Y; W - *7 g" e. x; U6 z3 g+ h b3 S/ }0 W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ?. O0 m+ i/ B) T& D* \
- * kind, whether express or implied; without even the implied warranty
, u9 n, B, }" P, H, w+ U* d- [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ t0 Y3 h/ K J \ - * GNU General Public License for more details.
0 J: i6 D( c D' H8 M - */
0 r; @ H9 g/ H5 g - . g4 x# p$ T8 h
- #include <linux/module.h> I6 G# N7 e2 r2 S" o1 ]- g
- #include <linux/init.h>0 \, g5 E2 L6 c, H; k7 l" U
- #include <linux/errno.h>
+ |* W- q6 G! R& Y+ F5 u2 R - #include <linux/types.h>. X2 x( ^/ [' w8 ]( @7 q
- #include <linux/interrupt.h>% M& t& J6 ?8 h$ n6 L
- #include <asm/io.h>, t# P% L8 K& n2 a0 n: R8 b
- #include <linux/moduleparam.h>
4 e6 G6 K9 \2 ^, \) p" x - #include <linux/sysctl.h>& h+ ]! l5 O9 l# Y+ Q0 B$ m
- #include <linux/mm.h>. h( X! G5 A; e1 [& x" n% x; G
- #include <linux/dma-mapping.h> ~' F+ i3 P/ K, @- c! j
2 e, Q$ @3 y& k; i- #include <mach/memory.h>- p; C0 E% x& N
- #include <mach/hardware.h>
# K7 g0 ~* E4 N) | - #include <mach/irqs.h>
8 ^6 r( }) h k h7 ?5 ]; R! U - #include <asm/hardware/edma.h>
% l t0 N$ V- p) q8 _ - ! U& f: g+ Q0 x; r5 J ~8 p2 d: t
- #undef EDMA3_DEBUG4 ?) _3 Q! n" \% r! a% @
- /*#define EDMA3_DEBUG*/6 }7 ^& e8 T" p# H" b
- ; \! K# y2 s y$ ~$ k4 ~9 m& L' c
- #ifdef EDMA3_DEBUG! r9 a8 D% t: A8 h$ x' d1 J# |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ k9 ?% r% ~8 ^; o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ o* w+ n4 ^" A3 o% M6 t/ x8 _1 ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) N$ h S9 s9 P5 w2 }
- #else
7 w+ M$ G) I* g4 r9 R - #define DMA_PRINTK( x... )$ P$ d* r4 U# b% f2 A& v$ X
- #define DMA_FN_IN& I) c! b! w1 T# L/ P w) t' ?( c
- #define DMA_FN_OUT
( z% d, {9 A* G+ p8 g# S$ t - #endif
|# U# x% b- U+ k7 ^. H4 A
, F) j& L& z) Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) q% q3 I V! w7 O9 A% T8 w
- #define STATIC_SHIFT 3/ T3 w/ e" p+ d8 K" X: y+ L
- #define TCINTEN_SHIFT 206 L& C" Y4 z0 Q0 f' x9 L) ^
- #define ITCINTEN_SHIFT 21
4 U5 |$ z, }7 O G% {0 K - #define TCCHEN_SHIFT 22
7 z) j* H' M1 }. y2 ] - #define ITCCHEN_SHIFT 23
) z3 r+ _! o6 x: F8 U) V
4 Q) { u; {) V; x' b- static volatile int irqraised1 = 0;" a- t! d1 l# N- X
- static volatile int irqraised2 = 0;
+ P3 u+ d4 @5 z. N& E# N: S
, U& n$ \: }: [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 c7 p: M: x! q+ g* H5 a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 u# P6 T3 A5 f6 p: Z% E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 H8 A* E2 w: T' ? - 9 Y0 t8 a% a7 ^7 A% d8 S8 a
- dma_addr_t dmaphyssrc1 = 0;( ~5 ?& o; S K: d0 p
- dma_addr_t dmaphyssrc2 = 0;: b1 \, h: A" O7 g& |0 @
- dma_addr_t dmaphysdest1 = 0;0 X6 @! x! o& U$ n f) Z
- dma_addr_t dmaphysdest2 = 0;
$ h5 B' b8 g& T2 C1 D/ J5 U- R - + N3 d1 W# H! p2 d8 ^
- char *dmabufsrc1 = NULL;
% U) j. I% j0 Z" p, l. |" h - char *dmabufsrc2 = NULL;
/ h( b; b; \3 r9 v0 x3 M - char *dmabufdest1 = NULL;
$ O; B6 C: p4 B% ~ - char *dmabufdest2 = NULL;& j6 w, K' G9 c1 {2 U( e
- s; Z! F( X5 L) [- `
- static int acnt = 512;4 k0 } ] `5 N4 w* m/ b: A
- static int bcnt = 8;3 P, p* C6 x& }) {" i Y
- static int ccnt = 8;
% {- B1 W% q( N5 c& O0 v% T; o
7 N1 @5 d. E2 }% D- module_param(acnt, int, S_IRUGO);
) U7 b: s' [2 W6 A" _) Y - module_param(bcnt, int, S_IRUGO);
' ?% O' ~$ z$ A- n' V! R0 x F ` - module_param(ccnt, int, S_IRUGO);
复制代码 ' [; s( X* D$ b9 _. \: W9 d
2 u4 H# [, _3 f" k: B5 Q3 w$ f# d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" O) `) i9 \1 O3 w o+ C% u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) M3 U- W! _4 I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 \9 T# \9 M' @6 Q& h; m1 `& ~ O7 Z0 G! q, u
1 L2 W+ t% y {0 w" O7 h. e
|
|