|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. a8 V! u' ~" x/ a- [code]EDMA sample test application( _1 N9 J3 i2 K
- /*
0 E S) i0 o- d n - * edma_test.c
$ \8 x* P: h$ P - *1 ^) L- g7 u: u
- * brief EDMA3 Test Application
5 Y& H. b6 W) ]6 k6 U; {9 A - *6 D" Z3 I: J) m( F0 |, Y. J8 b
- * This file contains EDMA3 Test code.' h; |3 r$ V. N3 l# ~! M
- *
$ L, E8 [. {3 c ?) U' ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 _( U: J) s3 j0 O6 T9 _# r |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, \6 f# p- f# K4 d
- * TO CHANGE.
# w. F8 s3 J/ {9 H - *) {! X2 ~; |$ G- Y6 E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
w6 j' k: J8 L0 R' A4 X9 {$ \ - *& k! s4 J5 a3 E7 i# k3 W! g& d
- * This program is free software; you can redistribute it and/or
+ B; [" G5 r% I - * modify it under the terms of the GNU General Public License as
: g8 G0 _5 p* m2 U0 E4 d - * published by the Free Software Foundation version 2./ q( i6 j: f# [- |( H7 R8 s# k
- *
, g4 a6 x9 _3 e4 O+ G/ `( I- I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 A; I1 `2 q- V4 T9 | - * kind, whether express or implied; without even the implied warranty8 g. h5 \$ t0 s6 Z6 K% x* K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! U7 a: i6 y r/ Y - * GNU General Public License for more details.9 g: K, e5 o/ o3 C6 s7 B m6 x
- */3 @# M4 b* l X) |# h! k' M/ e
$ ^9 A0 g' o9 C- #include <linux/module.h>- T O" H' K& s9 p" c* n) T* ?5 L
- #include <linux/init.h># B2 ]7 o% @5 j
- #include <linux/errno.h>- A2 F; S" L% P. Z4 e
- #include <linux/types.h>
V4 f8 a2 \. n4 G* m; Y% G# \1 w- P - #include <linux/interrupt.h># a- U4 c% v2 f9 R/ @3 O+ L( x7 {
- #include <asm/io.h>
) G7 [2 l g U3 o - #include <linux/moduleparam.h>
/ T7 K$ o: I* M& Q* j - #include <linux/sysctl.h>& K1 p7 v% J. {
- #include <linux/mm.h>
6 D1 k) T4 I' {) V9 M - #include <linux/dma-mapping.h>
# M/ h3 w! L! t1 [9 Y$ y2 Q8 o - 7 z3 a9 N' k( k% p# R2 X9 W% Z
- #include <mach/memory.h>
% E1 ^* h2 R) G, ? - #include <mach/hardware.h>
$ A8 b, |+ n2 {$ O- A7 H7 p - #include <mach/irqs.h>
/ f2 R& t: e$ z, h$ g: y9 O - #include <asm/hardware/edma.h>
% z2 h: o. ^6 G. v2 i$ O! F8 R. s
/ X3 ], Z' m6 ^; {- #undef EDMA3_DEBUG
6 z+ N% c! u R7 [( @7 r4 |2 K7 c - /*#define EDMA3_DEBUG*/
! U: `5 ^" A6 d4 |# @5 N) s( s - : @" @9 m5 t$ q* r3 V4 y
- #ifdef EDMA3_DEBUG, u8 U6 j8 e' C+ [" y+ D7 v; h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
N. h! {$ W. {' c" u# e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& S! i8 G, s$ b, S; I$ }- p. V/ H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' N( J ~' r: }- j$ M& i
- #else& u* h+ O9 `) T% U7 ^ _
- #define DMA_PRINTK( x... )
) w8 J& `4 d; ]7 `$ Q- ~ - #define DMA_FN_IN7 G, k) ?- t+ O) k3 x- Q. U
- #define DMA_FN_OUT( [2 k4 i. l& J. y# A
- #endif
. X8 I! g2 f3 ?# i; C. B2 g5 E- j - 5 V# d; t+ l/ a. x, f: [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 x: Y7 F/ G3 Q - #define STATIC_SHIFT 3
5 U1 D9 A% S! v - #define TCINTEN_SHIFT 20
- r8 M: E* C% `- o6 l* y - #define ITCINTEN_SHIFT 21
1 S, T4 l$ X' b- r* T \ - #define TCCHEN_SHIFT 22
( _$ C9 r7 J' | - #define ITCCHEN_SHIFT 23
+ c) q* {& ], [2 t
3 R5 M. U! Q' S) [- H- static volatile int irqraised1 = 0;) v; d' E V: m+ X9 ^
- static volatile int irqraised2 = 0;! t! E# v* T, }% R$ @' k! G
7 [# Z# ^6 A6 ?0 Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ Y& `+ N4 K: ]$ u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 {/ f8 s: d4 ^/ q# {- q1 {7 p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ T: N9 @) Z2 b) b& M% @6 ?8 Q. y
- , D( [* h% V. C( B" f
- dma_addr_t dmaphyssrc1 = 0;+ l; s8 D; j8 E% K2 `& B8 C
- dma_addr_t dmaphyssrc2 = 0;7 Y& I9 |2 I% E
- dma_addr_t dmaphysdest1 = 0;
5 a. p9 C/ T9 {- \ - dma_addr_t dmaphysdest2 = 0;
$ }# z3 _) Z0 U4 ^
$ \3 Q8 F1 Y, o' r- char *dmabufsrc1 = NULL;
) x/ r' _6 C" N. d - char *dmabufsrc2 = NULL;
& K) m# U* p0 z3 t/ ?8 s - char *dmabufdest1 = NULL;
) G: S/ x2 _4 ?5 ^8 \$ b - char *dmabufdest2 = NULL; B! L- j0 p& |1 Q
- + t' g8 Q1 I7 ^/ W# w
- static int acnt = 512;7 ]7 } w- w+ x$ s* N
- static int bcnt = 8;
( |* E# o/ r7 Y9 M- S - static int ccnt = 8;: L2 `; z$ A% |8 p' x8 B
! y! B; \, ?0 R; F# U% Y: a$ p- module_param(acnt, int, S_IRUGO);
6 s: D7 ^' o$ I$ \8 b7 k F - module_param(bcnt, int, S_IRUGO);
5 J5 w8 b+ Z* P6 G9 F, _ - module_param(ccnt, int, S_IRUGO);
复制代码 ; E7 h+ U u! M8 H% p" J$ g8 ~
% W9 g) P8 q! }) }1 a" o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& b& l: h# O' X1 P; n8 L* m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
P2 N, K# X R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 m E& X. i1 c/ e
/ ]6 C, S9 u, I" S2 j. {. p B- @, O3 Y* x; M9 L7 o. u: w* `# }
|
|