|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + F" T1 g" x7 [* q1 y) b2 J
- [code]EDMA sample test application" m2 w7 E; ]! o
- /*# P3 G$ l- O9 K- Z
- * edma_test.c7 M; P+ g0 L0 d( H& S5 ?
- *
! N; N; [0 B% R - * brief EDMA3 Test Application
' D4 ~3 U+ G& _ - *# C2 l& Q1 o$ I/ U
- * This file contains EDMA3 Test code.8 | W$ _- C1 v6 O$ R$ U" X3 A: ]
- *
0 K2 F% l$ G; y, q, o! c7 V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) ~" x6 d' T3 [; h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 o3 ?) X6 r3 p; }$ T: H- S
- * TO CHANGE.
/ \5 A4 T6 u" Z: {& P - *
`# @: c. B2 N9 j Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) _: o, H) ]/ w4 J8 g/ l! f - * v9 R5 ~. @2 e+ y* ?
- * This program is free software; you can redistribute it and/or$ S; Q( u! ^8 ] X+ s9 e: h# X' [
- * modify it under the terms of the GNU General Public License as3 e/ [! l+ u: i' q9 ^! A
- * published by the Free Software Foundation version 2.! q" e; ~! U1 b# a# \; A7 a3 l
- *
4 _& `; Q7 c# f3 s) h9 ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* R( o2 S1 `7 G3 A, n3 g - * kind, whether express or implied; without even the implied warranty. {) j* }" i) W7 [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 P8 I. Y: E* @6 P$ @, K - * GNU General Public License for more details.( y9 A# ?* X( s
- */' k* N# u- S2 `( }0 O/ \
6 {3 Q0 n) ?, v, p! L0 G- #include <linux/module.h>
$ Z9 I/ k9 G* j, y4 t - #include <linux/init.h>
3 M7 @% G) F2 k4 q) Y - #include <linux/errno.h>
# Z6 L2 l$ `3 m' d- e - #include <linux/types.h>
6 N# `2 _* t: e - #include <linux/interrupt.h>
* ]0 j7 x% T/ S - #include <asm/io.h>
( e( g/ c* \* m( C* J' G - #include <linux/moduleparam.h>! b: p s @* \
- #include <linux/sysctl.h>
+ z% v% x% k+ F# n - #include <linux/mm.h>$ {* ]" o" Q5 U" v' O4 ~6 K! j" x- d
- #include <linux/dma-mapping.h>7 l' j1 J% R# y) {6 ^; u$ n
- / }8 c$ O8 p" g b# D
- #include <mach/memory.h>" W0 P. B1 }, ^) u
- #include <mach/hardware.h>! w+ F& V! ?, k' q8 c7 F
- #include <mach/irqs.h>
" |9 d0 |/ b" W1 [ J- ]- `2 M - #include <asm/hardware/edma.h>
5 `2 |5 z* s# s- b
! X% n# |; i. ^& @& W5 N6 z% c- #undef EDMA3_DEBUG
5 `+ J( a# }) @, @4 U7 s# B% T3 { - /*#define EDMA3_DEBUG*/
/ f0 N7 Y9 |* ~
[% H& R7 z5 g( Q4 U# y7 `' U. U# u$ d- #ifdef EDMA3_DEBUG
0 ~ g9 @/ q. N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 ~+ M! r* s( _6 P% O% s) \9 ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ m. D0 V' _: i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
{( D+ C: R0 F* M2 m2 E - #else
; ^ F ~: b" U7 J - #define DMA_PRINTK( x... )
3 n e; S* X$ h" I3 \, v: j - #define DMA_FN_IN0 R0 Y# q8 b6 y: b
- #define DMA_FN_OUT
. V, z# O1 ?! \ - #endif6 s5 T# d! `$ E
- $ d8 D1 J& S6 n. `" y/ D$ S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), r! z; @! G. ]# J% N
- #define STATIC_SHIFT 3
, t( r' n: o8 |4 G# d+ X - #define TCINTEN_SHIFT 20
6 _/ F8 F3 {& r, z' o' q4 I [ - #define ITCINTEN_SHIFT 21
+ E) f+ ?$ G* ]( G! P/ E7 K - #define TCCHEN_SHIFT 22
% G- p" n+ |, J; r2 O' { - #define ITCCHEN_SHIFT 23
; R" I2 _8 D: p! e( e - : z4 F6 H H |! b9 M0 o
- static volatile int irqraised1 = 0;
& t" X- Y7 b# E3 T2 X3 d' s - static volatile int irqraised2 = 0;1 s' @: M. E. ]5 N b$ }
4 p% `/ L7 ?# } K1 K. R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 T( ?. E# L' B- @( i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, K# m$ M. `+ |7 C8 X/ }) w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 P9 L/ F, `0 s
& V! T3 [5 {" K. ~- dma_addr_t dmaphyssrc1 = 0;
4 E! y; K6 V0 V - dma_addr_t dmaphyssrc2 = 0;
, U4 G9 l) `0 \ - dma_addr_t dmaphysdest1 = 0;' H! q i- O" r$ s2 G. M
- dma_addr_t dmaphysdest2 = 0;5 E9 \" S9 [# ?! {
- ( S& O0 y1 r* T( N& P2 ?7 O* t& g
- char *dmabufsrc1 = NULL;
% ~9 ]; \! k4 ^4 G+ q1 }/ S) b6 \9 O - char *dmabufsrc2 = NULL;7 {- u( F( }( @/ ^) a" s
- char *dmabufdest1 = NULL;
* S2 O- p4 Y( n) h8 I3 v Z- [& U - char *dmabufdest2 = NULL;
, x; f% |1 [2 e- U& |0 m, l0 _: ]
# v- I9 j2 z7 W7 t4 l- static int acnt = 512;. Z# r" j$ e8 E0 E+ B
- static int bcnt = 8;
& W( ~: i2 I2 A f& H* t8 ^% k - static int ccnt = 8;! d/ l5 F9 y* Y
- 7 |- b( L9 k* ^
- module_param(acnt, int, S_IRUGO); D8 l' n* E5 g2 ]& _
- module_param(bcnt, int, S_IRUGO);% G4 h2 D+ F$ e6 r& z6 y8 \; ^
- module_param(ccnt, int, S_IRUGO);
复制代码
8 H ^: N% O5 c0 O0 A4 W2 T1 m3 i z: M5 }- d" X$ Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( Z0 s `6 X( b! R/ j8 P" Q
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 f0 G, b, F) O. }* L9 f+ J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& }+ l" M2 w& C1 C& L/ n" H# W
$ I# \2 d! A F% g. K
; {6 a1 @" b S
|
|