|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" D: Y. y) u: d9 T- [code]EDMA sample test application
* p" {+ }; k: E7 a - /*
) s3 ^! k" s4 E - * edma_test.c; f$ k& E( P5 U( q/ v" P
- *- I5 Z$ @" t i- P, x$ u; b
- * brief EDMA3 Test Application9 a# s I+ A0 b& J* ?* j* ^
- *4 R/ a" F" @4 o0 [9 L
- * This file contains EDMA3 Test code.' r0 j% N p9 n* [# w* h1 X
- *- t8 o _8 J# U1 B f' e( n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 K0 c, y: ?; A3 \2 s! {( z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, ] @% C$ }% k5 s z# j* U1 U
- * TO CHANGE.
3 e1 n" V# H- ]6 S! U0 B - *3 {$ A/ o& `3 d# R s7 R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 y- e+ O' I g' D - *
' ]9 y3 P! Q3 X - * This program is free software; you can redistribute it and/or2 |- B7 G K% \6 `3 P
- * modify it under the terms of the GNU General Public License as
1 S1 p& {8 g* A" w5 D: T - * published by the Free Software Foundation version 2.
7 v# L; t6 M6 K& e, I - *$ G8 f C7 A. @4 F& Y- `7 f0 n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 [7 m. |4 G" a! j( Z$ _& r
- * kind, whether express or implied; without even the implied warranty8 Q0 F, X" E7 f4 H7 Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ o2 c4 g+ g/ i5 C0 o& `9 e& P0 Q - * GNU General Public License for more details.! `! [0 z) N( Q8 E* c
- */
2 f; z. X; p! Y8 T' V6 @* z - ! @- F/ X- g! ^3 s- ^, N r
- #include <linux/module.h>
. @$ }4 f- C) n% }2 O - #include <linux/init.h>
7 s0 ~ n( k4 R/ T. [ - #include <linux/errno.h>
% s6 L5 x# H# ^* i5 {5 e$ P( q! h. U - #include <linux/types.h>) K* K" q5 T# G6 z
- #include <linux/interrupt.h>% D H. A3 |# O5 F% b
- #include <asm/io.h>5 h! r" q8 T4 k+ G6 `
- #include <linux/moduleparam.h>
6 i- G0 a' {' c) a6 b - #include <linux/sysctl.h>
: @5 m- H8 j8 a: t - #include <linux/mm.h>
d! T% e. I4 ? - #include <linux/dma-mapping.h>: {4 d! G6 k7 `+ c7 V8 ?
. J6 z! X2 x$ m& x) i d- #include <mach/memory.h>
' E1 `+ h$ q2 z! d6 i' h - #include <mach/hardware.h>! `* }! |0 P! w: g; V% Z
- #include <mach/irqs.h>
8 ?8 F I, K9 W( L3 w5 _4 N2 a: q - #include <asm/hardware/edma.h>
& l7 v8 d) U7 d# X7 y- k2 a+ s - ) q! g" T+ s1 `+ O9 P9 |
- #undef EDMA3_DEBUG
+ d! h$ P* t/ p; [ - /*#define EDMA3_DEBUG*/
8 I5 d' F+ z9 i" `1 [) y
( y0 U% R; a+ \9 l" a! F- #ifdef EDMA3_DEBUG& b; i0 R8 C1 b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 y. M- F' w8 ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% Q2 [' r# I! H2 `0 p& m# U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) ~" p5 S+ {; x/ }7 }( ^0 o
- #else$ o6 N4 ?' o4 b; ?5 X" t
- #define DMA_PRINTK( x... )
0 Z |( B! H8 E# V# z - #define DMA_FN_IN+ H% E( f5 Q: N- J+ f) `, ^
- #define DMA_FN_OUT1 D: O/ r& d- G: K# v0 h. B8 N
- #endif) ?' ~! X7 j- Q s# l
$ y9 k4 z' a6 r* }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ t$ e, l, Y- b g" {5 e
- #define STATIC_SHIFT 3
$ i& N/ t' b3 K# w1 T V4 H - #define TCINTEN_SHIFT 200 R/ B& T6 t! K8 t c: n" N* V) O
- #define ITCINTEN_SHIFT 21" j2 b0 V1 X/ ]/ l; @
- #define TCCHEN_SHIFT 22
' c& ^) K9 O' l- G, {$ T9 d - #define ITCCHEN_SHIFT 231 l3 m! e7 k% b
- ; q0 ^" ^, r# b' V# _% C2 y
- static volatile int irqraised1 = 0;3 {0 e, g( X* h
- static volatile int irqraised2 = 0;+ }7 p$ d' S$ b) y' M
- Z1 @; b; h b* M5 Y5 l9 j+ n8 r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& q7 a, a: Q& l- F* ~; r& W8 O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, a1 D0 W* H. j& b) \% D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 o, b4 _5 b* O# f5 h
1 z5 J7 ]; f7 i0 Y! g- dma_addr_t dmaphyssrc1 = 0;2 T8 N, p$ E' M" p+ a
- dma_addr_t dmaphyssrc2 = 0;
0 c2 w+ ?5 S+ [, k& L - dma_addr_t dmaphysdest1 = 0;
; K: F3 p) Z0 z) S5 g+ B9 E - dma_addr_t dmaphysdest2 = 0;7 E% n* j. w" V6 D0 }0 }0 t9 P
8 ^$ F% |4 _- d1 F2 ~- char *dmabufsrc1 = NULL;: I g2 Z( p+ z9 q G$ k
- char *dmabufsrc2 = NULL;4 ?7 R( M$ P8 B8 r8 s {
- char *dmabufdest1 = NULL;
2 L6 i- H! S: t7 c - char *dmabufdest2 = NULL;* u) b1 I+ f. V+ i
/ o+ i8 a9 Y! `" s u2 I, @- static int acnt = 512;# H' M% n8 H2 V% j4 S( s u& k3 D* Z
- static int bcnt = 8;
7 k) u# s" O V0 N - static int ccnt = 8;
, q7 f I2 x& H2 u y
4 [% b- p+ t$ x9 P# g' P) G- module_param(acnt, int, S_IRUGO);3 R e/ N# I) o6 ]9 E F2 B# {% ]
- module_param(bcnt, int, S_IRUGO);7 ~ R; r* u2 i8 y
- module_param(ccnt, int, S_IRUGO);
复制代码
/ P& I; |# w# b& [% w9 f) j+ E( E- [- Q; x
$ c1 z4 e% j; u2 d) C/ l! y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 X, q# v3 g/ H) Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 f+ C' G( G. I) |6 s# H/ ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ ~+ b+ j ^. }. K, v
/ D7 V" w0 T/ n ]0 Y6 X' s/ h7 Z& a
|
|