|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 J' X3 O, I) X$ J1 @: X' K
- [code]EDMA sample test application
7 n; m% g ~& A$ l, G - /*# G0 ]3 j$ n/ L( c2 g8 u# M5 {* @
- * edma_test.c f: e# d; E2 @" O! Z* \
- *
2 L; O5 ^. @9 V7 W - * brief EDMA3 Test Application
# S; X7 l6 L0 j' W9 `2 y$ V2 N - *
0 |% _# X }/ v: N1 f$ h - * This file contains EDMA3 Test code.
, R( H& t3 I; ^8 R3 L* o7 s - *
" q3 v1 a+ H/ a$ A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
Q- v: d* f0 }2 G, ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 ]- b0 j2 @% E8 t; D. Y
- * TO CHANGE.
( u0 i5 Q9 l+ w: N9 G/ e; c$ M" d - *& N) M5 I6 l0 O3 f2 `' e- X' x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 n3 E0 |7 z' A/ G8 S' c* @. t% B - *: f, A" U; z* V* N+ _6 L+ O
- * This program is free software; you can redistribute it and/or
! P" \! _4 z0 Y, ^4 k" g) H - * modify it under the terms of the GNU General Public License as
1 R7 C# N8 a- a! @ \2 o - * published by the Free Software Foundation version 2.
( z1 ]: C. o$ x6 X6 `' c, j - *
( H7 x) T: B' q1 @2 y4 C: k: R' X( U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 d( w z3 O5 T/ C( m - * kind, whether express or implied; without even the implied warranty
4 }" ^9 w9 {) }0 C9 M$ \/ P- } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- }, z2 W& M: R' z: X - * GNU General Public License for more details.) L" o: M7 t$ L' e! W" j
- */
' a3 t0 _0 t. g6 L1 [
4 z( `2 a) K7 x4 J- #include <linux/module.h>
4 |" M! ?' A* I! f& g* O - #include <linux/init.h>
* C( o: r' {) G* o! _' C - #include <linux/errno.h>
) d7 y2 j6 O2 @ - #include <linux/types.h>) ^# W7 g" L7 m: p
- #include <linux/interrupt.h>/ G( s9 y9 X' R" m0 v" m5 m
- #include <asm/io.h>
; A3 A: `2 [$ a' d4 j/ S - #include <linux/moduleparam.h>; h; Y. }. o1 _! Q7 N& @$ [5 Y G
- #include <linux/sysctl.h>! A) A) p9 L0 u" g
- #include <linux/mm.h>8 p; r# h4 l* k2 _
- #include <linux/dma-mapping.h>, k1 Q: n8 u2 N
- 6 d1 x- |# N" B8 D; U4 d
- #include <mach/memory.h>
, k* O: ^2 n: I6 v' j - #include <mach/hardware.h>$ e5 e" Q1 T( i4 }- `& H9 V
- #include <mach/irqs.h>
0 |6 b& A6 D! ~' x: G - #include <asm/hardware/edma.h>
- v5 @3 n! ~; O5 A6 F; R h+ f8 h
" q: y/ O5 j9 b+ \ I1 O+ ~0 n8 a; {- #undef EDMA3_DEBUG
" t! k: s( t* W - /*#define EDMA3_DEBUG*/5 I) l: Z( G% ]& ^: v" K8 [7 `
- ; E( z1 Y* E. O
- #ifdef EDMA3_DEBUG
! }2 p. J4 h8 N; `) L) d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 m4 O( v" d7 e' Q- u, N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 d X6 X4 r! `* K9 m4 g# b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ Q+ U U( N! O! m( T! q8 E( i x& f - #else
+ W5 p0 X& w, @- | - #define DMA_PRINTK( x... ): h" L4 h8 r' E' L# h
- #define DMA_FN_IN
% z) R$ U% a4 ]. ^3 _( h8 e6 T3 r/ x - #define DMA_FN_OUT
% Z0 Z7 w3 t3 R: I1 n& P% @% R - #endif- ~4 [/ c' e* m. K2 c; ~+ g2 M. U
- , E8 `6 ~$ x6 V; u Y% J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 }) H* i% ?$ W( D9 j2 y
- #define STATIC_SHIFT 3/ |# v/ q% ^" T: Y: u
- #define TCINTEN_SHIFT 20( w' }# Y/ F- L6 G% f3 @+ |
- #define ITCINTEN_SHIFT 21
: _7 Q( B8 B+ N - #define TCCHEN_SHIFT 22 |$ [7 a9 i. s
- #define ITCCHEN_SHIFT 23# a, `2 `) J R+ F+ D
- & U/ m- N0 M" E, B( e
- static volatile int irqraised1 = 0;* H* A6 I" O0 P- W% n
- static volatile int irqraised2 = 0;& }, Y+ u0 t7 Z
4 {+ n: p0 V6 K9 E; s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 D/ @; `' y/ L; `+ s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' U y2 G" H1 \6 ?" d% P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# H6 s6 ]7 L3 }! Z2 H
% X& s, h" c4 p5 H- dma_addr_t dmaphyssrc1 = 0;. Y2 e7 @ B T8 H% T
- dma_addr_t dmaphyssrc2 = 0;
* n4 T/ R$ F+ B4 Y - dma_addr_t dmaphysdest1 = 0;
5 q! x5 d# P( N" e1 E - dma_addr_t dmaphysdest2 = 0;; c& m5 U1 Y3 ?& L- y# Z( c
- 2 U$ f6 O# P" T$ C; f* {5 L$ i
- char *dmabufsrc1 = NULL;1 L2 ~/ y3 v9 Q0 A+ k% z' y
- char *dmabufsrc2 = NULL;1 p# B2 y2 b) T, _
- char *dmabufdest1 = NULL;
/ g6 d/ _! |) s5 s. _0 I - char *dmabufdest2 = NULL;2 C' k- u+ ^0 z- K
6 w( x4 ~, r6 r3 t9 R+ j2 _( |- static int acnt = 512; f# `. z8 i' S" @
- static int bcnt = 8;
) [, m* A: E4 j! K - static int ccnt = 8;
' O! F" s1 b5 u0 _' Y- I6 D* l1 c J
8 m; ?- U$ P! W4 S) B- module_param(acnt, int, S_IRUGO);" @( e5 G9 q7 r8 e
- module_param(bcnt, int, S_IRUGO);( i+ J h) ~4 B) d0 B! }3 C
- module_param(ccnt, int, S_IRUGO);
复制代码
$ g) x3 B* W: |3 Z& H- r! n8 s/ f+ E! S6 h/ ~8 \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( c" ^8 Q+ K% e6 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 k5 O Q |7 O5 V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 G6 H- P% [* N: n1 W1 H
: F- n4 P" V; A! b- U) S& N, y3 {1 w3 x- N
|
|