|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
Y5 H7 ?' ~ @, { ?3 [$ q, A- [code]EDMA sample test application
+ C, B# t8 U, Q( V+ z" p - /*1 _6 b2 r9 i4 C6 _* x
- * edma_test.c
# m* O% Q' f% {- H& T U - */ T8 _. M2 d; x2 D/ |# J
- * brief EDMA3 Test Application
3 D! e0 E6 ^7 s5 y4 d - *- q* M! F3 L! f& F* d9 ?5 Y8 ~
- * This file contains EDMA3 Test code.; p4 E# h( Q' H9 I
- *& K4 i$ R; u6 Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 ]5 X. x+ B0 g. I& H) C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 F* K! G" t/ ^. U" @- _3 k
- * TO CHANGE.* ^/ s9 H( Q) u: u
- *" P' ~, e6 I4 R9 |. ]' l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" s. L5 E* a+ N# N, b/ n - *0 |; N$ y7 R" Q1 @0 q
- * This program is free software; you can redistribute it and/or$ T. d+ U- w* z# m& M" V
- * modify it under the terms of the GNU General Public License as
$ w+ v1 f+ [# w. ^ Y( z - * published by the Free Software Foundation version 2.
r3 p- y4 y. H# S; v! C - *( x6 m" E- G0 l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. }. \3 R" {% F0 b+ ? ^5 { - * kind, whether express or implied; without even the implied warranty) F5 A' G6 v/ K7 Y; s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 D' v+ [) R3 h; ~3 [+ d) `* V7 t - * GNU General Public License for more details.7 H) ?0 E. d1 e# C( \# h# i
- */" g& z5 F: D+ e3 T6 g4 o {8 N
/ B* q2 a0 a- a- #include <linux/module.h>8 Q& f6 a- a1 d1 m
- #include <linux/init.h>
v& _5 M4 }2 t* ~ - #include <linux/errno.h>) G5 D3 c0 m* d' X
- #include <linux/types.h>1 M& X( [7 u' ~2 G' [) `
- #include <linux/interrupt.h>1 n- b2 i9 ?* f; c3 @( M
- #include <asm/io.h>
- h g9 z& G: c/ l1 _, [" a+ X; L - #include <linux/moduleparam.h>
; }6 @0 z6 }- l! U - #include <linux/sysctl.h>& p" i. c8 d& x/ |& |3 n
- #include <linux/mm.h>
! s" _- F$ a" A: W8 M0 R - #include <linux/dma-mapping.h>5 g: R5 s3 F4 r1 F* t& U
; E) A/ ]) s/ o: s1 _- #include <mach/memory.h>" W7 t6 j+ w. B8 K4 c+ {
- #include <mach/hardware.h>
! \$ Q2 L. H. t5 g2 D; V - #include <mach/irqs.h>
7 Y0 G" P, N# x - #include <asm/hardware/edma.h>& X& \6 N6 R7 G$ Y0 K& W9 B
- % n T0 ]: P* S
- #undef EDMA3_DEBUG
# [) C6 U/ [. Z/ l2 \' a - /*#define EDMA3_DEBUG*/* a* o2 g4 L! U% u6 e
- 7 u3 I# r2 O, P% ~
- #ifdef EDMA3_DEBUG
5 a, Y# ` J A, t" m$ L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& j: x* x/ g; O6 Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, @6 s0 j! v) `$ S9 h( B+ J! }9 a( S I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* v2 p$ A7 z" U; n1 ? - #else
0 _# F& K3 Q) J* T2 { - #define DMA_PRINTK( x... )
- ?* o7 A. b" _7 \& q) N {2 I - #define DMA_FN_IN
- c0 X- p- { ] - #define DMA_FN_OUT5 Z9 e! |% ^" a, q# `% v
- #endif
1 k, Z- R6 L" U, n, C3 ?
+ d" ^8 p" Y9 ]5 E/ Q1 e) k+ p0 O6 n- #define MAX_DMA_TRANSFER_IN_BYTES (32768), I% W9 Y9 a- G3 |: w6 _' M" U) `
- #define STATIC_SHIFT 3# e5 f$ u7 X4 J! L7 F: L& F
- #define TCINTEN_SHIFT 200 `' \2 q) r) ~1 m* P2 f% m
- #define ITCINTEN_SHIFT 21" }. H1 _8 f& r! |! M5 t
- #define TCCHEN_SHIFT 22
( M2 j% _: T4 I" V4 \ X/ o - #define ITCCHEN_SHIFT 23
& E( b2 N' p; h6 `9 n. x
* v0 y! A6 {# f% h( _- static volatile int irqraised1 = 0;7 m/ J; ^3 j S" S, ]
- static volatile int irqraised2 = 0;
+ E9 l9 ]. b$ u( z! H' D/ t - ( V3 J7 w- ~) c1 P; |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 z- K; `: P' T R' h7 S& k, D! w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' I& g0 h4 G* e- @* k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# x c, _2 y9 E9 d8 m% t
$ Q* J5 p: |( S& a- dma_addr_t dmaphyssrc1 = 0;- t) T6 I8 W0 @4 Q6 h& u8 W
- dma_addr_t dmaphyssrc2 = 0;9 u; Z( g [! x8 @# s, P: V+ U
- dma_addr_t dmaphysdest1 = 0;3 I( Z6 n8 l0 m" D/ F# O
- dma_addr_t dmaphysdest2 = 0;% m7 ~; H- A. c# D$ n; K5 l
- 2 P: a# J$ f" K. i" W) _
- char *dmabufsrc1 = NULL;% i# N q& N* z; J: X
- char *dmabufsrc2 = NULL;$ H) s8 b# u- B' X' D
- char *dmabufdest1 = NULL;
6 \: W9 P: g1 v) B9 Y; g" ~. M3 d - char *dmabufdest2 = NULL;# f. U. D4 Y }
- , P3 F; X$ m+ y( ]! C
- static int acnt = 512;
& L$ w' X6 A9 y+ h+ O - static int bcnt = 8;8 P, y8 r2 n0 V$ ?
- static int ccnt = 8;
) r3 \0 @5 |7 l! e& O8 \ - : D+ n6 j. ]0 a. J4 [
- module_param(acnt, int, S_IRUGO);: \* s T" b% D9 G* a0 S# z
- module_param(bcnt, int, S_IRUGO);- z) X' l! ]$ y- I$ Z1 `9 \. ~
- module_param(ccnt, int, S_IRUGO);
复制代码 # M& M* B. Q' z1 T
5 a! v8 ]: t7 [9 [% Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 ^. [2 |) [4 d1 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" Y4 \/ B% }6 U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 `! W) W" R. ^: l4 P0 \7 W2 U$ m; C# T2 M% i
! e- r7 }7 S% P' B
|
|