|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* r w- V% K, K4 z O- [code]EDMA sample test application7 i B/ w9 B9 F5 M
- /*
; V6 @: X* {# |- S I* h9 }1 n7 p - * edma_test.c& f" Y5 x. s8 U0 R r' D0 }
- *. @9 L" D: I% c
- * brief EDMA3 Test Application
+ I% R2 V; i$ r6 v8 K! Q- I - *
' F) R! F* ^9 J! Q* n - * This file contains EDMA3 Test code.+ N; V$ f# s% \
- *% X2 l# z# S- v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 v% f) S( r( A' r% W& \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 w0 \* \6 o/ r4 O0 c' f4 K
- * TO CHANGE.6 x+ M* w N/ A5 O9 e9 U8 _: G
- *
5 A6 _' }4 P! a( @2 L$ N" @$ i( k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. Y7 b4 O; m8 C8 d% y6 s; D4 N
- *
+ F/ y8 j9 z `- S - * This program is free software; you can redistribute it and/or
" _9 k% @; g. M! Z$ e$ f3 k - * modify it under the terms of the GNU General Public License as
& t+ n# g* J2 j' t( ~ - * published by the Free Software Foundation version 2.- ]2 ^- Q% k( m& c
- *
+ Y. P8 s, z1 J" w2 H! R( L; u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 w. b0 X# j3 R$ I3 b
- * kind, whether express or implied; without even the implied warranty6 Q& S# ?: ^# X' g- b1 B4 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, F& G0 s X; f/ y7 c6 h& v T
- * GNU General Public License for more details.; ?+ {. g" j: M1 P4 W8 v' f
- */4 m& m( u8 c- ]8 p' R J* T
- % Z3 ]4 y& Z N3 I9 f. J! W
- #include <linux/module.h>! y+ W. o( N6 x& M9 ~/ t
- #include <linux/init.h>
( c! n6 m7 r3 Y) s. Q! o- H# S - #include <linux/errno.h>+ _+ V- O; h9 f. d) |6 J
- #include <linux/types.h>; o& C0 y4 k* w# r! r0 b7 L
- #include <linux/interrupt.h>
: e! h/ G' L. ?3 P4 y3 C' p5 F - #include <asm/io.h>
C8 w5 s' q' `4 x3 R4 X9 X - #include <linux/moduleparam.h>8 ~! i& H0 u: _' g8 r
- #include <linux/sysctl.h> G* c d8 T; w' \* b
- #include <linux/mm.h>- P) u# {" O: _& o; V
- #include <linux/dma-mapping.h> Z) M5 q- O( \- x
- 7 d% n3 B4 r- Y$ I5 u
- #include <mach/memory.h># O. G ^, T8 Z) N% g1 I( j
- #include <mach/hardware.h>
! Y% L& E3 r/ J O - #include <mach/irqs.h>3 n; m. D) ~% ?: n6 i
- #include <asm/hardware/edma.h>' ~- n$ x+ F: ~7 U6 u2 T
- ' A3 i( l* M# I* o2 ` M% o
- #undef EDMA3_DEBUG9 d. ?6 w, q; o; W/ v
- /*#define EDMA3_DEBUG*/0 x( c; U/ r$ Y8 M
- 4 G K8 i( {8 D5 \) P9 _
- #ifdef EDMA3_DEBUG
3 R: x6 J& y# n% W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 m! C3 C6 K1 S) D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, O( U, @; g/ `4 k2 \9 W8 i/ n3 p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# a; ?) v2 e* N/ l4 Z C9 ]3 c
- #else! a2 m( G9 z. g
- #define DMA_PRINTK( x... )
$ W5 u+ m' M V" p7 Z, E - #define DMA_FN_IN
6 ^; I$ B/ @' Z+ T$ H* L H - #define DMA_FN_OUT
3 i3 N+ l. }2 ]8 l9 k$ t8 { - #endif* x& E: K% f" @0 u' G: q# D6 P# F
1 S9 O% Z- |9 Z8 K; t; s% I- g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 N$ u0 T- D3 r2 t) L6 h+ d1 V" [# p
- #define STATIC_SHIFT 3$ Y _3 T6 P( a3 w2 `) X1 V4 v
- #define TCINTEN_SHIFT 20
+ U, Y% [: o/ N8 t9 d. }4 L - #define ITCINTEN_SHIFT 21, Y9 _: Z/ x8 n% y
- #define TCCHEN_SHIFT 221 ?9 ]5 ~( ^8 H2 T8 v9 m* J
- #define ITCCHEN_SHIFT 23
, g' B# p# X) ] A& i$ T' @+ K - * S1 a6 ]2 c+ b0 ~ Z
- static volatile int irqraised1 = 0;
* Z" n) i, R( G+ q# w - static volatile int irqraised2 = 0;8 ]# I9 V: O2 n1 s1 M
: _: x* r$ S$ B& X6 z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 ^- q3 w( p5 Q: o! e- w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 h7 R1 t; }; F ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* N+ V% c8 S6 `9 y1 t& r - ( B& |% t+ ], _
- dma_addr_t dmaphyssrc1 = 0;8 {7 a9 a1 ~, a6 M1 o; Q1 I9 m
- dma_addr_t dmaphyssrc2 = 0;
5 C4 N/ m* Q6 J. A1 T$ S& ~6 t q - dma_addr_t dmaphysdest1 = 0;% N5 |2 Z1 @8 Y' I" K
- dma_addr_t dmaphysdest2 = 0;* J7 Q$ I9 p# s3 O
- . i- [- p. G/ \" p) @
- char *dmabufsrc1 = NULL;8 q& _8 f5 N4 x' z
- char *dmabufsrc2 = NULL;
4 U2 @# a: w& q4 z( e6 f& W/ P - char *dmabufdest1 = NULL;
, A4 v# V- ^( j0 I) Q - char *dmabufdest2 = NULL;
. k( N+ u7 l- q
! }2 G, E) s) L w- static int acnt = 512;) K' {. n3 D' R* c1 H, h8 e
- static int bcnt = 8; G) W! y/ l. u: P! W! \
- static int ccnt = 8;
|- r* T/ u9 G7 X0 R/ w0 h2 N
1 _9 B+ x/ o* e2 Q8 d8 J- module_param(acnt, int, S_IRUGO);
& a5 {( C9 H0 ?/ @( _ ^& u; r - module_param(bcnt, int, S_IRUGO);% J% u5 ~, l& U/ M+ h+ h
- module_param(ccnt, int, S_IRUGO);
复制代码
9 {7 o+ f# \* _7 o( Z8 B
2 e L) I C( I! h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 i& h! K+ g( v: l; [; P1 s2 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ n P% W5 R9 I& D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 S" s+ k! N( X8 B5 q
7 O Z+ K U' r- R7 X& {, R9 z! l! t6 b E$ @. v
|
|