|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : I8 {$ C1 Y; V. Z) }
- [code]EDMA sample test application
' y; I8 e3 f) D- T - /*1 I8 z3 b) G% A4 B( o3 n
- * edma_test.c) J- ?6 v4 v# C+ _! f
- *
. O; ?; b4 Z R( | - * brief EDMA3 Test Application' s, m; ? E, u0 ~6 H. r
- *
@, ?* h; l! J& [& ^9 d - * This file contains EDMA3 Test code.
+ c- s! X# P! q7 E - *
9 M( d) g6 `( _- r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; `+ I0 D% @1 f: k1 K1 D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% t7 H* [! i7 F- ]" X: Z7 R: Y - * TO CHANGE." C. {+ m/ Q" \) [# v: W
- *8 d) Y* _0 S% X7 i* v) @. Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// a0 d j' l, c$ \' L; c3 C5 z
- *
& U6 Y% o/ S8 i/ Y2 O - * This program is free software; you can redistribute it and/or
8 B2 R* I! |2 @. O. x - * modify it under the terms of the GNU General Public License as7 F1 ~8 o' N/ v" d
- * published by the Free Software Foundation version 2.4 M1 v) W+ x. \0 o/ s
- *
& `7 W1 ~ E' |" d$ \& V- o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 f1 }) x6 O2 A# N$ t - * kind, whether express or implied; without even the implied warranty) b V8 b" w$ z! V: k: h& w L. [6 M R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 w L) A) Y: G" b- [+ G - * GNU General Public License for more details.
% r: I8 \/ q' _ - */% j! h6 H. U' y% Z% n6 t
- + w7 J% v0 Y9 n' X9 H3 v
- #include <linux/module.h>8 O. k, V" z' R) o; K2 V: g0 y
- #include <linux/init.h>6 c% v1 d: s- F2 Q% B
- #include <linux/errno.h>2 Z& S# Y0 S, c7 y2 k; @, J
- #include <linux/types.h>
- P+ T3 L3 L: ^0 _% c$ V& W7 n - #include <linux/interrupt.h> N2 h4 J: c! p6 G ~ v
- #include <asm/io.h>: g' s( f4 B. Q
- #include <linux/moduleparam.h>+ F& |* J! K( A5 h) H
- #include <linux/sysctl.h>
$ c1 R6 l7 D: b- C5 y - #include <linux/mm.h>
) f1 q, H: M u - #include <linux/dma-mapping.h>( u* |2 a/ U D1 f/ d" X
- 6 T1 B* V( P- m6 z% _: |# @# o
- #include <mach/memory.h>+ u1 v% G: Y' ]- U0 k/ [
- #include <mach/hardware.h>
/ L+ Z, A- [) X/ \ - #include <mach/irqs.h>
$ b! n, U* a0 ~: H6 S5 m - #include <asm/hardware/edma.h>
2 g; M% u0 m" l" X [+ J& f* T
8 ^- s+ a; k7 U! s- #undef EDMA3_DEBUG6 E, Z( t+ v9 a" j
- /*#define EDMA3_DEBUG*/9 G( B/ } z1 X9 u6 u4 ?
- $ Z$ r8 z6 J- t: C2 z* z: m
- #ifdef EDMA3_DEBUG" W7 t# A. k4 S4 t' r/ s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! A/ }2 W0 @( f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) \; v3 z5 J6 ]( q, x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 n. |8 [2 b- | A: k7 \
- #else5 U3 u" K: r; V. H. E4 V! O
- #define DMA_PRINTK( x... )# ^" Z% \" [9 P- R: W5 V9 B8 Q
- #define DMA_FN_IN
( D# W o) H$ u; `. ?* C& b- k! J - #define DMA_FN_OUT1 j$ u+ }% M+ V" M& X% N# _
- #endif
; X. G, `0 P- o `; | - . r5 `) @7 F) }8 r3 I' ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 @& P T4 M- Y" `# v: U5 l
- #define STATIC_SHIFT 3
3 c: h8 ^& U& X - #define TCINTEN_SHIFT 201 f& Z# t! R8 I
- #define ITCINTEN_SHIFT 21
* }8 ?8 r k) f4 x) w+ [5 A - #define TCCHEN_SHIFT 22* e" j$ l8 ?8 @6 B E
- #define ITCCHEN_SHIFT 23
~% F( A# O' R& y
# E! S& D, q/ Y* }, f" ^- static volatile int irqraised1 = 0;
2 L7 E% v( X' x; y: i% F ~" Y - static volatile int irqraised2 = 0;
: ]# h! `9 ^9 q( `0 w4 F - ! l' m. U/ X1 b3 r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' {/ Y3 L" P+ b, s8 q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 i# F% x" r& { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 y4 j+ m) h, C/ R
( e# z- S8 @: ]- dma_addr_t dmaphyssrc1 = 0;8 B! t% l7 h- @0 Z& J3 E6 _
- dma_addr_t dmaphyssrc2 = 0;3 o$ e. y2 O; I6 K3 g/ r1 d
- dma_addr_t dmaphysdest1 = 0;8 d9 l! m- @: [$ {4 I
- dma_addr_t dmaphysdest2 = 0;
, }% N4 b6 p; F$ k9 a, \ - % i6 x" q1 Y8 W# Y4 |1 e& Q8 [/ G
- char *dmabufsrc1 = NULL;
& n/ F; q/ l( ?. ~/ V2 ^/ g [9 R - char *dmabufsrc2 = NULL;
! s+ D$ U8 k8 q& T e$ o - char *dmabufdest1 = NULL;/ R o. a+ H7 Z
- char *dmabufdest2 = NULL;$ w2 @; g% K/ Z7 }) D
0 o# O, x8 w2 i5 \6 C7 a& J. Q- static int acnt = 512;2 C) K9 W, V* d3 J
- static int bcnt = 8; l0 T" ?+ ~- D5 I+ {9 e$ |
- static int ccnt = 8;
& n1 z5 l, j5 B' P5 l# F
, X5 K& {+ T: s) i' N- module_param(acnt, int, S_IRUGO);
6 v7 A T* s! ]2 v - module_param(bcnt, int, S_IRUGO);5 q$ `$ A1 F6 _# h2 u) Q! d+ Q
- module_param(ccnt, int, S_IRUGO);
复制代码 ; U z9 Y4 A! a# P% B P
$ J* Z9 H4 Y# B0 ]7 Q% T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" ]$ H- j* @2 [. {' W& G7 `2 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 S: _- a$ \4 s' U3 I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' J6 v$ F7 h, v9 V* j$ s
5 L+ |. P0 P. T
5 G& ]5 p$ A* |$ }- L |
|