|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ A1 G4 p1 U$ s- [code]EDMA sample test application4 b5 l& L& H. f% Y' x1 {0 }
- /*- K O+ P8 f5 C6 S
- * edma_test.c# o8 Q' u/ c" {" M9 x% ?! Z6 k
- *! t% d' G9 D; t3 j7 G
- * brief EDMA3 Test Application
9 {" A7 [ _) U! V& r7 D8 G3 J9 E - *3 w u, v: k0 O W2 _2 |8 v) X
- * This file contains EDMA3 Test code./ } n- O5 \' A- G1 g+ J! [
- *
I2 x8 r% E6 w O' a) U& ?: U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ a) ?( N* H8 y2 k" q. X" A# W+ e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 N) h7 p) |2 }7 [' }) K
- * TO CHANGE.% T4 X0 t0 h8 L& B
- *0 ^, d: E% T2 z) x. P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 F8 _! B; o1 P) u) o" } - *6 A( O" A: k9 I; X$ B
- * This program is free software; you can redistribute it and/or( m- w7 I! o# P3 y k( k0 c
- * modify it under the terms of the GNU General Public License as
: L/ q$ S' B* @; F) R) z& A - * published by the Free Software Foundation version 2.
+ v' v- r& b0 G' V - ** c! V' ?) G2 _! ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 o6 o; J7 z$ F" L1 h$ O L G% M
- * kind, whether express or implied; without even the implied warranty$ e( x2 _5 j7 G$ B0 f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ m0 E% P$ t+ @; H( B* T$ ` - * GNU General Public License for more details.
# {0 W% x. _$ y9 D' o; ^ - */: j4 N9 o8 m" Z
7 \( [$ n) R& i3 D! e6 W5 j- #include <linux/module.h>0 \7 B, b) D/ m p2 t* a
- #include <linux/init.h>
# P4 B* d( N9 Q; ?2 q - #include <linux/errno.h>
6 @! O' o* L, O: X( |( S! u - #include <linux/types.h>
( L0 A& e0 y3 m& A" ~, u% u - #include <linux/interrupt.h>
7 `( ?* ?- J! M - #include <asm/io.h> K+ C. B' q& w* V+ E3 w
- #include <linux/moduleparam.h>6 a0 z2 V# E3 @) a
- #include <linux/sysctl.h>
2 X: Y' W4 }, X# ?2 u - #include <linux/mm.h>
: K! L8 R5 C9 k. F1 |. P - #include <linux/dma-mapping.h># H! r: q( G5 j! g$ G& P& M' i5 h6 S8 `
- ; z+ Y4 i7 r) Y4 R9 G5 N3 G
- #include <mach/memory.h>
3 ~5 L/ r4 Q8 w! t$ X+ a( a - #include <mach/hardware.h>
! a; S1 C' T! [. f - #include <mach/irqs.h>
# r7 l2 r& q: U3 m G - #include <asm/hardware/edma.h>/ J9 |& h# g& Q3 C+ X9 V
" U T8 f u& [" }; z4 W- #undef EDMA3_DEBUG( [9 h# G- x2 ~; ]1 ?6 J
- /*#define EDMA3_DEBUG*/
5 w6 H# |3 X+ @6 s - ! D, ]" C' F, C6 Y/ z. Q# x
- #ifdef EDMA3_DEBUG
5 T3 l2 |9 a( s# h, Y' b4 { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): ?' Q& M6 _. q- b( Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 T2 S8 o% {/ y" O0 f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* s8 U; Z0 `, g% \% \
- #else
: @1 B" M6 ]% ~2 e - #define DMA_PRINTK( x... )# z# B: p4 ]9 ] i7 G% Z Y; z
- #define DMA_FN_IN
3 H5 S. [2 L; K% n - #define DMA_FN_OUT
2 ~: W" C6 V: K% o4 w2 p; ~ - #endif S, o1 s5 Z6 C, A
8 s) g5 ?! g& r% U; ?: P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: K+ G# Y# f! x0 [7 q - #define STATIC_SHIFT 3% u6 Z5 t* E: j2 M! X/ I% l
- #define TCINTEN_SHIFT 206 h( c9 B7 R( l* c
- #define ITCINTEN_SHIFT 21
, U" G+ `! ? a- K; I - #define TCCHEN_SHIFT 22
$ [0 P5 W2 l; v; B D - #define ITCCHEN_SHIFT 23
0 T8 _3 B3 s2 N8 q' Z. u( F- f
$ C0 L# ]2 }% h- static volatile int irqraised1 = 0;+ E" v9 J1 V5 X E4 I& Q$ w7 D
- static volatile int irqraised2 = 0;) a- w6 t% t$ @+ O5 d3 E
6 G1 @7 E# c! T E# P% \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* s9 y7 S2 v7 L; c1 o P- U' s3 ]( V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 c! c3 |* a0 w+ n- c& r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); v' A) T+ `; H2 k5 i
- 4 @4 I) r4 N% s9 N7 E$ G
- dma_addr_t dmaphyssrc1 = 0;
# Z7 h9 h. R5 r- q - dma_addr_t dmaphyssrc2 = 0;1 g; v7 m+ }4 ~ u C$ o
- dma_addr_t dmaphysdest1 = 0;( K, E# X$ A- ~! N+ Y
- dma_addr_t dmaphysdest2 = 0;
9 H7 b: ]- y0 W* R5 W' u
* Y! V1 u* j& |" ]* u0 M- char *dmabufsrc1 = NULL;
# N3 @& ?% [, l. A( ^ - char *dmabufsrc2 = NULL;1 f% ]$ H2 ^1 @* X# v) o8 h
- char *dmabufdest1 = NULL;2 l# I$ n' I: i2 K6 B7 u
- char *dmabufdest2 = NULL;7 R) h5 m- t* }" ?
- 1 G! i. H9 U7 r* c$ ]
- static int acnt = 512;9 S' `; l& o1 e0 z. p" n/ H
- static int bcnt = 8;
' r% j7 F/ X) |( `: g( _ - static int ccnt = 8;1 I T* E" d1 X2 k; j( E
- X7 W/ A6 }7 o& e7 D* s2 s- module_param(acnt, int, S_IRUGO);
1 o, Z$ U( q2 B% ? - module_param(bcnt, int, S_IRUGO);
]. T" y0 _! `' f% }$ n6 Q - module_param(ccnt, int, S_IRUGO);
复制代码
' q& l5 W& Z ?$ p: a- \( t$ N; \) \1 w0 @2 z2 j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ r- e& ^! @/ x# `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 L6 q2 W4 f2 f6 i: e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 j8 R, `) ?) \& E, ^$ i
( K: S6 s0 A5 b7 P3 B5 X
: S: ^, `8 z/ i3 C% E Z+ w |
|