|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% O7 Q' P" p9 ^* g- [code]EDMA sample test application
. l v8 s5 [ r( X" A - /*
! [ \! D6 U, e8 t - * edma_test.c
' B- B( `4 q: P& c3 O - *
3 _/ z( L6 u6 `" p- ^. _8 P - * brief EDMA3 Test Application
8 L: H5 s/ H9 j4 O - *
1 |% p% n! r. W- L+ a - * This file contains EDMA3 Test code.0 N' M7 p8 `! I! z @
- *
2 [/ q; c/ P* A0 C- i" b8 j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( s3 Q5 R0 S w& {: t4 b0 l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 R a9 v) {. j* e
- * TO CHANGE.
7 N% J) x l3 X - *: R5 r& J; u" J2 H# N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' b$ f# {. ~+ E - *9 }' E% t* t" l! `0 w
- * This program is free software; you can redistribute it and/or
4 |6 B0 _1 X) A - * modify it under the terms of the GNU General Public License as
2 F: e) i; H* I, D - * published by the Free Software Foundation version 2.! l7 F* _* I ~& z- R0 R* t+ n
- *
0 }5 }: x @' J* p b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 w" O s* O( y' ~& N+ _0 @4 t. E/ B
- * kind, whether express or implied; without even the implied warranty! b+ f& i7 t+ e5 w, e8 B% _0 I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 b J) ?+ Y; I6 ~! ]$ q- W
- * GNU General Public License for more details.# X" g" h5 R" m& H. T+ c+ A
- */; n, f' R4 m- [6 S% q
7 |/ `, c4 [* `- #include <linux/module.h>
. U0 X$ x9 P# F7 T4 H: u - #include <linux/init.h>& R4 z9 { _6 e. d, Q
- #include <linux/errno.h>
' }8 z; Q" ~5 Y: ^5 i2 n - #include <linux/types.h>
. R7 M3 ?& j! E: i E - #include <linux/interrupt.h>8 B [" f8 g Z: j' v& X
- #include <asm/io.h>
0 I0 W2 v% c5 [* e& @+ n - #include <linux/moduleparam.h>
1 t7 o0 Q9 a, O% ? - #include <linux/sysctl.h>, g; T4 ?9 V' @ Z
- #include <linux/mm.h>
( ~6 l$ h7 D$ s# ^ - #include <linux/dma-mapping.h>6 g0 D0 B2 T: X" r+ |3 A' W' s
6 Y% l/ _# i9 @5 G- M/ U2 f- #include <mach/memory.h>6 M# Z1 x( C% w9 I% u
- #include <mach/hardware.h>
9 u( R1 H! Q7 @! o0 t0 l - #include <mach/irqs.h>8 H" R8 K+ a @! {) y7 n: j
- #include <asm/hardware/edma.h>
" } L8 u4 B" c' K. c: x
2 T6 c4 i* B. d+ ]( f- #undef EDMA3_DEBUG
) h5 s0 w1 g3 i7 s, G G) m- z7 ^ - /*#define EDMA3_DEBUG*/
/ {+ Q) k) f7 k; C0 y! B8 h
1 i9 k4 z& p$ c7 Z. Z. J- #ifdef EDMA3_DEBUG
5 i* t* j6 [. ?9 j" f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- _$ d+ `4 c& ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
N# x& Q: [1 | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# U8 |) V2 K: i# J
- #else
; @: V! l* B2 B( n( x+ E2 X - #define DMA_PRINTK( x... )& e# {& G; u* B, }7 r$ P. X8 g
- #define DMA_FN_IN
4 D. b0 w% m) h/ E* { - #define DMA_FN_OUT
0 q$ Z* H+ c) i6 y! d( q - #endif
; K" o, H8 `5 p3 n2 I
$ o+ T9 Q$ [' l4 V4 K/ H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
f% r. @$ t8 Q, e& f3 D$ K/ F) n- M - #define STATIC_SHIFT 36 u, q- G$ U- \7 D
- #define TCINTEN_SHIFT 20
u. _" x3 }+ j I9 y6 V0 A5 I" T - #define ITCINTEN_SHIFT 21) y( C+ K' l, s( X9 ^) [" @
- #define TCCHEN_SHIFT 22
5 X. s% {/ @2 Z3 E- \* C - #define ITCCHEN_SHIFT 231 m1 F$ b2 [1 E$ w) L3 o, T
7 L9 J/ g& ? j. J) Z' e. c- static volatile int irqraised1 = 0;1 @; C- j1 z/ Y6 {
- static volatile int irqraised2 = 0;2 I6 l0 Y- N. \
- ! r0 o) C9 T% i2 w( f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 _+ a# o$ _, @! X8 `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" p3 E% E- T% [4 p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! {" q3 E2 y. D, G& j4 M
" T6 Y, J) S; w) U* M; Y; [' z- dma_addr_t dmaphyssrc1 = 0;
+ u( V! M1 l& V - dma_addr_t dmaphyssrc2 = 0;) p9 @! y" |9 A5 y/ |" y1 s
- dma_addr_t dmaphysdest1 = 0;' q- w: k5 X! D* M9 Q7 ]. x: O' {# D
- dma_addr_t dmaphysdest2 = 0;
/ x0 ]3 `& l/ O& [5 K, u- t
6 ^9 S5 l: G+ D5 b8 Q6 X V. S- char *dmabufsrc1 = NULL;
Y* \$ D: b+ G! m- `9 v - char *dmabufsrc2 = NULL;
. S, Z1 w" G0 l1 ~; p" z7 r* z8 j - char *dmabufdest1 = NULL; {, H# b. y& Q& T4 x
- char *dmabufdest2 = NULL;
9 q" f% Q ]+ L1 ?, K7 _
% E# I; E' l) K' m- static int acnt = 512;
1 H$ y/ n8 H4 D* J1 k - static int bcnt = 8;4 A2 E0 N3 m8 i" I
- static int ccnt = 8;' d; A) G, s t) d7 f8 P: k) @ t, O: y
- ( ^7 e1 S6 K' y) b- {. R z( k3 F
- module_param(acnt, int, S_IRUGO);
9 a6 L' o& @4 Z C - module_param(bcnt, int, S_IRUGO);
; @; q2 H" y7 o5 u5 u. s - module_param(ccnt, int, S_IRUGO);
复制代码
8 R/ t; e! m3 ?/ U+ ~4 n8 Z; j2 X, Y( n/ a2 E) q9 o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% L8 p& y& x1 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& O. @, r" j1 ^5 N8 Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" {8 \3 u7 o; F4 i+ C$ i* c
. C+ b, ?! e/ C$ _8 B+ w0 h
2 k0 h* Z% e9 w# a" v" x* @ |
|