|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & z, N. N0 y; E# Q( i9 ]0 J. l$ }
- [code]EDMA sample test application6 D7 g4 c2 O3 |0 _8 R. t+ L0 `
- /*5 o9 {+ c- S7 Q) E6 l
- * edma_test.c; e# R; B! p' K9 h+ Y0 p$ `
- *
4 _% `: R# D4 M0 b - * brief EDMA3 Test Application
& p* \( u+ z0 N& b" \6 w1 u - *
+ F5 c4 T5 V2 m3 p" V/ ]! d* x2 g - * This file contains EDMA3 Test code.
/ z$ u$ B2 C c4 p4 P: v - *+ M ?5 K0 x4 Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. D& n' D& W# I) u5 m: t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 m( r& y0 E5 J1 V" u/ X s8 m
- * TO CHANGE.- i" M6 j: m& w$ ?
- *
) Z, I f8 n* L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% Z( ~9 t4 q; h
- *
/ |8 g7 R! o- ^ - * This program is free software; you can redistribute it and/or
, H8 J% {2 s+ w! c8 [9 n, D - * modify it under the terms of the GNU General Public License as
7 F1 X5 \9 H% l4 E* n' O - * published by the Free Software Foundation version 2.; D: t* y3 W4 G8 R3 m: T( w) S
- *
$ a8 x) f$ ~( I+ Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; I9 R) \4 a- g- h, N/ l& d3 v
- * kind, whether express or implied; without even the implied warranty5 @3 K9 T2 W* Z9 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 P/ `4 K7 I6 r& Y u# {
- * GNU General Public License for more details.
- W) @2 g' ^5 ^ ]! C( | - */# I! H3 s* L% [8 k& H
- % b5 `) m; _! Q
- #include <linux/module.h>3 |3 x$ f# v- b5 z+ m- f. |
- #include <linux/init.h># A- u" i) {/ e7 d$ j m' t ~. E8 {- T
- #include <linux/errno.h>
+ h" [6 Y) Y8 M+ }1 N; N" r5 F - #include <linux/types.h>
% Q; G {* Y% S/ a4 S) W - #include <linux/interrupt.h>4 F; ?. }; Y4 y3 M
- #include <asm/io.h>
/ Q1 ]) J+ j" \# z. ?* s - #include <linux/moduleparam.h>
6 g5 Y( G/ s% G! J4 ]! T$ o - #include <linux/sysctl.h>" r" c7 D* i$ H. P) ^! u
- #include <linux/mm.h>
: t) f F: K/ k+ _6 |0 ` - #include <linux/dma-mapping.h>
. |/ w( Y" ^% S& \- U3 y
& T2 S4 ~3 q, |- #include <mach/memory.h>
0 L' h8 D3 O, L/ q+ d2 f - #include <mach/hardware.h># W# U8 K0 k# V( y2 B! w3 Z- r& R3 {
- #include <mach/irqs.h>: E2 U# B# e. I" u* q8 P
- #include <asm/hardware/edma.h>
. K8 V1 z4 c& c$ G( d+ S) r
( V8 V2 m- p- {3 N; ?- #undef EDMA3_DEBUG
5 U! F$ j9 j9 I# r1 f2 e4 R - /*#define EDMA3_DEBUG*/
! _7 n3 T F- T, U, D
5 ?/ R: \1 A$ n9 i! N2 o$ e- #ifdef EDMA3_DEBUG# g2 l- W- E! d; E. J- x- s( _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: c, p0 A) H5 H$ b1 x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& {( D G) e2 r/ U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 v: @0 C0 w. @% K
- #else# W0 J' U1 \2 `* @6 H
- #define DMA_PRINTK( x... )
. N1 ?# Q ^. R) ?$ V% j0 Q9 Q - #define DMA_FN_IN7 A4 p5 i# ~7 h
- #define DMA_FN_OUT
- h! D% y( E* M/ \$ o; \, ?; r9 j - #endif
0 g; k& w" j8 o& o" ~9 a - ( S# _& C. E8 I3 b0 \+ w/ P! m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 P4 Y) |& u! H: [ ?: P- I( W6 K - #define STATIC_SHIFT 31 d. K' ?0 F; j! N9 i3 s
- #define TCINTEN_SHIFT 20
, y6 t: X# m& u& ?0 n( L - #define ITCINTEN_SHIFT 21+ l' w- v- T9 c0 m8 b# _, e2 u) l$ @" S
- #define TCCHEN_SHIFT 22: ?8 u2 Q' h. U) D1 ?- x
- #define ITCCHEN_SHIFT 23* [9 Y: |8 c, ?0 U/ j. @
- 1 d7 W1 F; Q0 C1 ^! n
- static volatile int irqraised1 = 0;
5 x" h w5 x7 D0 d5 q8 b& P9 Y' x: d1 b - static volatile int irqraised2 = 0;$ R8 \3 @2 Y( \& T/ z: |8 ^/ C
+ c& E/ C' @- G1 f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% b- S; Y" p+ K+ m+ q& M( J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 j) @1 x8 A% r: P4 b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ o# t4 }& Y3 P% `2 C* b6 G0 d, y
6 B2 t. i+ } _% J* A- dma_addr_t dmaphyssrc1 = 0;
& q* B5 }& h% s - dma_addr_t dmaphyssrc2 = 0;" J1 B4 A5 T5 t
- dma_addr_t dmaphysdest1 = 0;
! L9 t4 Q* K4 x+ C: g/ h) r - dma_addr_t dmaphysdest2 = 0;
3 ~% A( |% {) Z2 W1 I3 L
6 d3 [- o% B: U" l- char *dmabufsrc1 = NULL;
1 j# y( a) A1 }9 _ - char *dmabufsrc2 = NULL;
4 m/ o* H& g, ^2 Y3 |4 U4 j X - char *dmabufdest1 = NULL;
. ?+ @/ s. v M& w+ [ - char *dmabufdest2 = NULL;
" C+ ~; \' d0 {6 s - ! }0 q" C" ]+ N0 P* y
- static int acnt = 512;
3 d" H7 Y m* C/ S6 L( _& B - static int bcnt = 8;
0 e7 _: t8 {" m7 V' A1 G - static int ccnt = 8;
/ H4 I7 o" T" {% F/ Y2 Z2 e
$ t5 ^9 D. P3 t8 v* L) j R- i- module_param(acnt, int, S_IRUGO);
( l6 L5 M0 {+ _" a$ b: R& M( b - module_param(bcnt, int, S_IRUGO);. z" b9 G) N7 K) q, q" J
- module_param(ccnt, int, S_IRUGO);
复制代码
' i/ v" d+ v0 S- V+ A q, _
4 L8 E$ ^$ M2 a1 G8 M2 H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ E" o" \! \5 G& j% x5 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 J) F Q; G4 N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 S1 y" |3 P9 Y4 F; Y- z
0 I$ ?5 q2 y+ @. j
7 L2 J0 T0 Z0 J3 Q% l5 m |
|