|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. b0 ?0 h I8 [8 [- [code]EDMA sample test application# i5 B& l* r9 m- u
- /*6 ?, @3 _' h e; R/ V) f$ g, j
- * edma_test.c
0 H# M$ u. b# E - ** C, i7 ~' w5 V* E9 P
- * brief EDMA3 Test Application+ a" y5 ^: Y/ n
- *
0 O0 U, w0 w9 T) n4 d9 n+ Q - * This file contains EDMA3 Test code.
8 F( m4 }, j. J, d) i: Q - *- |) p) J% _% r0 {# N/ v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 C; t# R0 s6 P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' W% `: ?/ O: X7 w$ t - * TO CHANGE.5 g- ~+ r* {" O) g: _
- *
% q: t L4 ^7 o6 n+ D2 b. [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# y. e/ W3 Z3 i
- *4 W8 t0 j7 O" J/ {& U$ `
- * This program is free software; you can redistribute it and/or
$ ~ Y( \7 y3 n& R* o; |6 O' F - * modify it under the terms of the GNU General Public License as$ Z9 F. D9 l F3 h3 G3 Q
- * published by the Free Software Foundation version 2.
& u, |! W; C# o5 }1 B! e- f - *
* U- j! \# O. q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 [' P; `/ k6 g" d0 b0 _ - * kind, whether express or implied; without even the implied warranty( j8 ]2 E4 q$ g/ N; H) j+ M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. \1 Q' q1 n4 u - * GNU General Public License for more details.
2 w) N7 @" b, D! `% h6 V' O4 Q% | - */. K+ q9 T2 ]% p4 D6 L R
( @* N$ r. m3 ~8 Y7 m- #include <linux/module.h>
4 P9 E, |" b& @& M5 s - #include <linux/init.h>
- z" j8 d5 \' \ - #include <linux/errno.h>8 H+ V. @0 [9 {
- #include <linux/types.h>
4 L. Z: i% z1 U* t: y$ a G - #include <linux/interrupt.h>
$ Q% z, [/ v, r) V/ R9 H - #include <asm/io.h>
3 u4 F- x8 b+ l7 E& H+ R+ f/ ] - #include <linux/moduleparam.h>' [# l( `1 n& V' Z3 u
- #include <linux/sysctl.h>) V1 C/ f f' P- L0 D. M
- #include <linux/mm.h>
- V# C, U: j. o - #include <linux/dma-mapping.h>; Y2 z# R7 t) Z0 x( u0 z
2 `9 Q c m' y/ |- #include <mach/memory.h>. A0 T/ Z4 {3 Z
- #include <mach/hardware.h>! j' y& k' X' E& h, V
- #include <mach/irqs.h>
7 N4 L% z/ F0 l - #include <asm/hardware/edma.h>
! j x! B3 |2 c1 F7 r/ V
7 J, [+ N, H# P L" F8 b- #undef EDMA3_DEBUG! a y/ n. z% k# E
- /*#define EDMA3_DEBUG*/
6 X: f3 |- ^: U0 ]) O - 7 e6 m V# y' e+ Y2 M
- #ifdef EDMA3_DEBUG
& F& |+ Y6 i1 n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 S* u; C$ C' u5 v. I0 a# d: o8 o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 E1 j3 V! T- L1 E' h) ^$ G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; q% _6 w3 w# e9 n8 @ - #else
* p- p5 C; {0 \8 E# c/ V - #define DMA_PRINTK( x... )
+ q8 `& c) y8 w2 q% X8 J* \* _ - #define DMA_FN_IN2 u( m- S' ]) [* s3 M/ t
- #define DMA_FN_OUT
( r8 ~' n: j. J2 r* ^ - #endif
" A; E& O5 b I( L0 I. Q# ]% n* y* h3 [ - " i e+ ?: F1 M; j/ d% k# a! j$ I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% _0 O; p% n* |# Z3 X: v - #define STATIC_SHIFT 39 A S7 H. J) ^+ {" w5 J* l4 i
- #define TCINTEN_SHIFT 20+ U1 E6 K) {0 f% X" E
- #define ITCINTEN_SHIFT 214 X6 z$ b+ [/ j
- #define TCCHEN_SHIFT 22
4 _6 M, k" o8 z& ` - #define ITCCHEN_SHIFT 23
. a" H; S) C, q: `& t% `, }
u9 U5 U n! q% d. e0 R& N* `5 F, r5 h- static volatile int irqraised1 = 0;+ i0 J; t# _, C* b8 Q3 [# Z; F
- static volatile int irqraised2 = 0;; F+ l* y& q- x, ^
- " L- e F7 _$ r, A0 }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ d p( l. o3 J& n8 r( J9 o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% R& W8 Q2 D" W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. d9 p( l$ K8 z; \" I$ O
; m z/ v9 T) K% i- dma_addr_t dmaphyssrc1 = 0;4 C% \1 P5 O% {2 P3 K
- dma_addr_t dmaphyssrc2 = 0;1 s% k7 c! i' t' y% Z8 ^) c
- dma_addr_t dmaphysdest1 = 0;
, L% M% M: l# b+ h! } - dma_addr_t dmaphysdest2 = 0;+ p' e3 _( ^8 Y0 y) H
- ' `: N$ A3 a, C# s- D) ~2 z g1 K
- char *dmabufsrc1 = NULL;3 X$ }. t, `5 c3 D+ ]; e- e) P
- char *dmabufsrc2 = NULL;5 v- U9 d3 ~; p+ _1 M) [" C
- char *dmabufdest1 = NULL;
5 ~# i7 u- A/ i5 Y - char *dmabufdest2 = NULL;
0 @( K. d9 v& f/ L) D- {8 Y
, ^2 {" T6 D* o0 T- static int acnt = 512;
% r6 M, L6 B. n" l& m' [ - static int bcnt = 8;
. H" T" I$ Q: W5 O" \1 A& E - static int ccnt = 8;1 S5 Z3 U2 D+ y6 Q
- : I ^+ d- \0 v+ ]! y! F
- module_param(acnt, int, S_IRUGO);9 z+ ?& v; ~$ g* T/ ^
- module_param(bcnt, int, S_IRUGO);& p" ^9 g" {) J, V. L$ ]
- module_param(ccnt, int, S_IRUGO);
复制代码 ; Y- L: W! [: H. y4 G- H( ~
, r, Q+ N% b( u& C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 A( b/ Z7 J9 a. l3 B( D/ `" C. t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 K0 @: W* |$ s9 U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 {7 M1 f4 [# K9 y; q( N2 W
: X, V5 ]7 x7 N: _, }6 U% l2 l; C1 j9 _
|
|