|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- |# a5 l4 J9 w* `- [code]EDMA sample test application
* \3 t. V) T% h2 q+ d; j - /*, L# P* b9 _$ k1 S
- * edma_test.c5 X" i! j. @! e. Q b
- *5 a" g5 _9 G( W' P/ R5 ^- f6 r
- * brief EDMA3 Test Application
5 ~& R) G0 P' ]4 Z8 b - *
7 }" F6 s) x4 R" m b: v( d% _ - * This file contains EDMA3 Test code.
7 {4 ?3 m c" B6 Z) ~ - *1 Q \/ e3 {9 W) B5 t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 d3 s+ x) L; h6 X! c6 f# L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% D% J2 I5 V/ ], m0 I - * TO CHANGE.
. w7 }3 h% v- E4 W1 L5 d/ q0 | - *" d+ ^: \! i8 N! ?5 w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% L, d# b0 R7 U0 y - *
: P8 @; W2 h" Y - * This program is free software; you can redistribute it and/or
7 O6 t: {/ k3 Y$ i - * modify it under the terms of the GNU General Public License as
$ E& a+ [5 [ _5 k - * published by the Free Software Foundation version 2.; K/ s8 a/ k7 [# `
- *6 E0 }! \9 \$ U& O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ W" w; D6 z' g r' Z - * kind, whether express or implied; without even the implied warranty
. F% j4 g0 s' l0 H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 w) d: F7 l5 k L - * GNU General Public License for more details.5 ?" M- W- _" U& a3 ]
- */
! t% V+ }4 n. e - 3 |% t. j) {; t B# n, p
- #include <linux/module.h>9 {8 y$ u% I5 p0 s+ ?4 U7 H: C
- #include <linux/init.h>
* B- _ ]- m) M2 @4 b0 W - #include <linux/errno.h>2 q4 P% d/ ]- c1 |$ S d# y
- #include <linux/types.h>
/ ^/ B Y. s( x. p s - #include <linux/interrupt.h># r3 p8 ?) M" a* B
- #include <asm/io.h>
2 ?) z% w/ z: c' v- I' I3 N, j - #include <linux/moduleparam.h>
6 D& j4 U$ i# T0 m9 ]: m - #include <linux/sysctl.h>5 f2 a3 e9 j/ i5 D z/ U# l
- #include <linux/mm.h>
# S! ^( o9 y. ^, O6 t - #include <linux/dma-mapping.h>. J9 |0 X% `0 Q0 G2 n
; s: f7 f0 T0 }( I/ T% [- #include <mach/memory.h>
6 L& _4 g$ t/ `6 S. X - #include <mach/hardware.h>
- h. O, I w8 k( w$ x: ~ - #include <mach/irqs.h>
3 I# I/ y* `- E* P1 M - #include <asm/hardware/edma.h>6 x+ F; D$ ~ [. a: V3 ]8 M3 s p
- & G/ P. r t1 A. N; b+ y. b9 E
- #undef EDMA3_DEBUG s% N, Y/ x& B6 B& Z$ }
- /*#define EDMA3_DEBUG*/
$ N+ h# J. l& ?: I7 F- p
* C3 N. A! }' Q- #ifdef EDMA3_DEBUG" D9 }" a8 @; f1 f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 Q9 V* _4 d7 ~2 B% i+ \% n, W" G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ X% m4 Y* m6 m/ G& m4 F+ a M. q) D, V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
l2 W! O, F7 H( D/ D5 I - #else5 @" b, o6 n2 {# t) f! O- F- j
- #define DMA_PRINTK( x... )
. v' Z2 y1 M/ e' E' Q" g6 Q - #define DMA_FN_IN
5 l" p$ |3 k1 r, f3 Q1 m4 p, e1 G - #define DMA_FN_OUT
* }) ~7 Y: _3 f/ R, L, S/ a9 b - #endif# ^ ]# c3 H) ^/ n1 F; b. K' b
- ' v! }' _* _3 @( [2 I. z" @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! i2 |1 m; u6 C9 G8 ~
- #define STATIC_SHIFT 39 m4 ^1 |$ R# |$ y% F- b4 [
- #define TCINTEN_SHIFT 20/ v4 ~5 I' g5 O _7 n; p" n- H+ X+ R
- #define ITCINTEN_SHIFT 21
- l: E4 [1 q, j x - #define TCCHEN_SHIFT 224 D2 R0 ^$ Y. D% O1 G
- #define ITCCHEN_SHIFT 23) _& k/ K9 ]7 P# A7 n
& V2 k& X% }: |( y! Q& \! [- static volatile int irqraised1 = 0;
. d% C3 x' \! v$ M; B% N, ^( E - static volatile int irqraised2 = 0;
7 }2 [4 ?5 X; c* n' B, y6 x( \ - ; W3 o2 L: V6 L% ~/ U+ P h c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 i1 Z8 x6 ^& q7 I J; k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 Q5 q0 v+ G* Q. t* K3 V# I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' e; m2 a s, M, ^3 k - - d3 k9 |, _' M$ Z6 m
- dma_addr_t dmaphyssrc1 = 0;
* p% K+ ^+ h6 _$ y2 O# o - dma_addr_t dmaphyssrc2 = 0;+ e5 d' S& @8 w1 S: u4 h; Z
- dma_addr_t dmaphysdest1 = 0;; o; _( D+ F4 _4 \7 Y% R& Z
- dma_addr_t dmaphysdest2 = 0;
2 G% m+ {6 ]+ ~: V* R1 P - * C+ o$ w3 f# }; u
- char *dmabufsrc1 = NULL;
/ P9 z7 ]1 d9 U8 m$ X2 j2 t - char *dmabufsrc2 = NULL;
; L7 s1 u* x, Z0 \4 V; K3 k - char *dmabufdest1 = NULL;2 j9 A! p( a" u
- char *dmabufdest2 = NULL;
3 U& ^8 R+ \/ K" ^1 l$ p! x
3 z1 A- F+ i& q/ R! U- static int acnt = 512;
5 q' w' w* i7 D8 R* G7 Z - static int bcnt = 8;! E% B* V* x: m7 w7 D3 Y
- static int ccnt = 8;
- V* u5 R. D M
4 D* w5 B5 Q. F- module_param(acnt, int, S_IRUGO);
( i! h5 @) @ x! [ d1 l - module_param(bcnt, int, S_IRUGO);
C. F* s. c4 w$ t' j3 G, ^ - module_param(ccnt, int, S_IRUGO);
复制代码 ! |8 ~6 a/ p- D: t8 w
! _2 q/ u& W a! `3 h2 K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 J5 ~* Y4 |* `, ^5 o7 A/ ^) s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 H: F: Y- O3 h' X+ l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 W( g0 p4 D3 R( S9 j$ l7 v' d% Q2 v9 M) a" q, d
0 E, n" b3 U/ Q, B: E# z$ @( o) f
|
|