|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " p9 z! g5 q# T% F/ J
- [code]EDMA sample test application' [4 @8 K2 c. _5 a+ T, V$ T6 x& l
- /*+ X: p" x2 l- y, K D$ e( l1 a
- * edma_test.c4 T# E8 @% L& A* q# o1 M
- *
% a4 ?- |( V/ l6 @# x - * brief EDMA3 Test Application
! v# D2 T/ i/ ? q. O5 ? - *
* {- R2 L8 }8 K! Y b* D; t - * This file contains EDMA3 Test code.3 v7 t& q. U7 p4 G
- *# e# a1 S/ O6 r3 v' y/ N. T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. U6 s& H: s- E) ~4 K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 }4 h2 G$ U# C - * TO CHANGE.2 O, u% B* ?4 {+ Y9 n" N* g# Q
- *
) g/ w" s( b! \6 ~8 Z) w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 b" [8 [8 C$ U, D! M$ A' t - ** J! q+ P, J6 k& D
- * This program is free software; you can redistribute it and/or
r5 t& k$ t. g& V - * modify it under the terms of the GNU General Public License as9 F" Z5 M; p' b8 X/ ~' Y1 ~
- * published by the Free Software Foundation version 2.8 O l; l# Y8 F* b
- *9 H8 T, z, X/ O1 i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 _/ u5 f( ~! e3 A1 H b; z" s
- * kind, whether express or implied; without even the implied warranty
! a( @, K" n& ^. S+ Z5 R4 b: o! M+ T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' i# _. r5 i9 f$ S
- * GNU General Public License for more details.
$ H+ T& `$ M1 n5 d2 { - */
+ t& ]! T6 R) e - - Y, v$ I1 w* I. |+ o
- #include <linux/module.h>$ g) W: L. |; @# O y# U& l
- #include <linux/init.h># L |7 b( s% |1 w. b. M2 w
- #include <linux/errno.h>1 j4 b- H# g( |( ]6 F1 e- \
- #include <linux/types.h>* o+ z b$ {$ `
- #include <linux/interrupt.h>; T5 z0 w+ C: f8 G" G$ G. {
- #include <asm/io.h>/ h9 j L+ _& r8 I( T+ h! {
- #include <linux/moduleparam.h>: B+ _2 k/ \$ V5 A7 L% n1 l
- #include <linux/sysctl.h>
3 A1 k' p G- Q8 _ - #include <linux/mm.h>
$ t6 L5 q8 K5 H4 c% U- q - #include <linux/dma-mapping.h>
; _) B- }! M6 g: f3 m3 J, S
( u6 Q( I+ l7 E3 d- #include <mach/memory.h>
# t7 s5 H0 k0 c9 ~0 b: v2 F - #include <mach/hardware.h>
- t9 H8 j6 S3 G' y - #include <mach/irqs.h>
1 O: D: q5 R5 g6 [ - #include <asm/hardware/edma.h>9 c7 v4 B- [" K
5 \2 L' v, L( G7 e j" [- \- #undef EDMA3_DEBUG
4 I" Z7 V, Z+ R( Y$ a7 N - /*#define EDMA3_DEBUG*/2 K- M7 P( e, r' [9 M- i
- 5 k2 v1 P+ H7 \* u4 \
- #ifdef EDMA3_DEBUG+ \# ^3 W, |; s* E3 \3 C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% ^1 b" L5 Z7 ^2 ?) S8 b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 j+ u8 u. `# u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% K* E: c, s! _! c# O T5 O - #else
f& T1 _- y8 p& ? - #define DMA_PRINTK( x... )
" S3 t8 ~7 {, B% R - #define DMA_FN_IN
7 Y. Y1 V, a# i/ v/ b. h - #define DMA_FN_OUT
2 G. ?# Z5 L$ b$ q9 }# } - #endif7 L$ M& t: L& d, }! I, m7 r
- ' D7 t/ u0 T* N. g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! p& E: ~" y4 D! _7 F - #define STATIC_SHIFT 3
8 e; \' |" t. R - #define TCINTEN_SHIFT 20. \: t; ^4 P/ X7 e& b
- #define ITCINTEN_SHIFT 210 D. j1 c( \: F' }+ ]& @
- #define TCCHEN_SHIFT 22
2 w; S( A9 Q4 y& N6 P5 z9 W - #define ITCCHEN_SHIFT 23( O- p3 r7 ?2 ]: T4 P' H2 S
- 3 F5 P0 |1 N5 x4 N& }* K
- static volatile int irqraised1 = 0;+ r! p. x! L8 J% e4 E2 w
- static volatile int irqraised2 = 0;# o1 x8 R4 o+ O6 c C2 k- @5 G
# D. i' P& S1 T: J* X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. }" D& n, k* D- q$ ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 A9 r1 ^- m5 Q+ A# v5 k8 x0 W" e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: U7 b1 X* O% N - ! e3 j3 e' A' g6 C! R
- dma_addr_t dmaphyssrc1 = 0;# G- A4 B+ c! q" X# F, \: E
- dma_addr_t dmaphyssrc2 = 0;3 P& l4 B! o* O/ h& h- S
- dma_addr_t dmaphysdest1 = 0;/ ` u/ t: b, s7 n/ h' { j
- dma_addr_t dmaphysdest2 = 0;
( I6 I7 @7 O7 g! Z5 @1 L - # h) F! \7 H1 p5 m: p, Q
- char *dmabufsrc1 = NULL;; W* \! Z9 B* n1 S& X' {
- char *dmabufsrc2 = NULL;0 E, g# k8 @: l5 `4 s; S
- char *dmabufdest1 = NULL;
- V7 o) [+ M4 Z2 N# V: Y+ g! M6 W - char *dmabufdest2 = NULL;8 `: o5 B% A7 c" N
- 9 |) W3 l4 m$ n# z
- static int acnt = 512;
2 T4 J6 m! b5 Z! J* P7 j9 G - static int bcnt = 8;6 R: D! D2 I& U5 X: U
- static int ccnt = 8;
( ]/ f; H6 z4 [- u& k - % }0 `0 J4 ^! y3 U; G2 O% N3 Z
- module_param(acnt, int, S_IRUGO);- W6 g* P" A4 M
- module_param(bcnt, int, S_IRUGO);8 e4 S8 S$ n# E+ ] f2 j
- module_param(ccnt, int, S_IRUGO);
复制代码 9 \. d' M' o. T6 k1 E
, k8 Z2 q. D6 Y3 G* u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 E6 Y- L, E/ K( T: i
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 s/ E- ~8 D! s% Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: @: n3 M. ~' Q+ H+ P! h1 ` a
0 k8 j4 }7 f5 |" y- Q4 F- F+ J$ Z. h8 g) `+ K
|
|