|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) A, d( A$ G5 q
- [code]EDMA sample test application
* E! h7 F5 C& A - /*
- [+ q0 g2 c* f0 U+ B. i# v, Z - * edma_test.c, R5 X& n3 }) E G5 }. j5 x7 P
- *
t- p- y) D1 z' p0 ~ - * brief EDMA3 Test Application
% h: T7 }' L8 o+ E: c+ k - *
! D/ S; [; y8 t0 Y u: C D - * This file contains EDMA3 Test code./ v0 e# b$ K8 y' R' _8 Q% l
- *
7 A, I/ Q8 ~$ S% U* g4 x1 m& k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) d/ ~: r& i# D" @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) }0 Q6 Z8 O- K! \+ [" ] - * TO CHANGE.
! |1 K% B4 `2 }2 y, { - *9 g- B, r' L( I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 O. s8 g& `3 { - *. R1 ^7 c' R! j& D. }
- * This program is free software; you can redistribute it and/or) `6 G; X9 X( t: i" o
- * modify it under the terms of the GNU General Public License as
5 A- |$ v2 I L: s - * published by the Free Software Foundation version 2.
! s: V5 C* g8 I& G7 t* F7 [1 \) } - *
0 u6 u7 B i: O6 m% _2 q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) u6 N& W, S& q( z+ w w - * kind, whether express or implied; without even the implied warranty% q+ H* i8 h7 }3 m1 f% ^# {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; a' G6 o) F9 _3 i9 W
- * GNU General Public License for more details.$ F* r, l! a0 D8 o8 s2 j
- */
; |4 O+ v3 I+ a9 g4 p - . i L) e' z! Z. E4 ]3 G4 _
- #include <linux/module.h>
- L4 m7 S! A0 X2 g2 r, C - #include <linux/init.h>$ p0 v/ C+ @% M8 [0 U9 s
- #include <linux/errno.h>
" \' F5 g! h% j3 K - #include <linux/types.h>: g4 m1 u* W: ?1 D- K
- #include <linux/interrupt.h>9 Z# G8 k( N2 @! B. t% d3 f
- #include <asm/io.h>
) \" R* }# o! p5 Z6 ?9 { - #include <linux/moduleparam.h>$ K& A8 C; m8 C! h5 k# l
- #include <linux/sysctl.h>
' w5 B( ]* A0 a+ W4 m2 D - #include <linux/mm.h>
, `* N. T5 ~5 ` - #include <linux/dma-mapping.h>9 M- r9 z( ~) E, x
- % \# g. m; [& H. L2 h7 C
- #include <mach/memory.h>' m# z, p5 S4 t, H' n f# {
- #include <mach/hardware.h>
! M) H6 ]7 c; _7 N: M: m7 a9 U - #include <mach/irqs.h>
2 |- r* E0 ^" o: F' Z - #include <asm/hardware/edma.h>
: ]1 l3 v7 [! X: a9 \
) B' y% H5 E2 g. _6 e: N- #undef EDMA3_DEBUG
* J! B* i( L7 P, c& d* Z - /*#define EDMA3_DEBUG*/+ v+ f& [! Y4 G0 J, L1 k
& [; Q. `2 M( e7 V4 D) c3 I4 I- #ifdef EDMA3_DEBUG! w+ f4 }5 C, e, ]1 p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 Z' ]( l6 ?* K$ f& s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 S6 g, S; z9 g4 v2 f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 n+ Q3 o8 z4 n. U8 o" p - #else
" L2 D! _4 O Y" Q - #define DMA_PRINTK( x... )
3 }( z2 ^& |6 O S* f$ K - #define DMA_FN_IN
5 i2 }! ?! m( L; c- e% r - #define DMA_FN_OUT: P6 O# y, j7 o9 N
- #endif
6 v$ J( N* F% Z; e! V/ m8 |8 Z. f - " K+ V% s9 b( H- N8 y+ w7 }, y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! V+ t2 S/ I! `5 A* C - #define STATIC_SHIFT 31 V; x& Z8 I+ ?+ f
- #define TCINTEN_SHIFT 201 h+ s: W3 u: H; f* N. v% K
- #define ITCINTEN_SHIFT 21
; f2 R8 {2 \8 t9 ]1 t2 p - #define TCCHEN_SHIFT 22
( g" T2 k. L* F/ m! @. i - #define ITCCHEN_SHIFT 23
6 _) H, ~1 s1 k0 k* r - 9 W: t! ]7 ]" u- O$ F9 W
- static volatile int irqraised1 = 0;. b" ]) F. U; O( U- p0 G: ~
- static volatile int irqraised2 = 0;& C4 ^9 l! }2 I
- 5 ^. l3 U$ T, y9 L* Z- P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); h% e7 {& H( x" W% X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 o/ m2 _2 A# Q# k! h: r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# j1 a! T* s' {4 ]/ N
% {0 d* K. p( |% m. o j$ j( l- dma_addr_t dmaphyssrc1 = 0;2 O: z1 a2 G5 U
- dma_addr_t dmaphyssrc2 = 0;
- c+ E$ o; j& o: T - dma_addr_t dmaphysdest1 = 0;
& _& H+ q* h B$ P8 ] A+ T' w. E - dma_addr_t dmaphysdest2 = 0;
, v" o' P/ @# v* F! l# N
9 D- b, u# s7 R- p- char *dmabufsrc1 = NULL;6 g$ m. x2 ]. w- A9 Y3 }/ H
- char *dmabufsrc2 = NULL;4 D: u* Z8 |$ h0 X
- char *dmabufdest1 = NULL;
8 |: }( [9 Q/ m; T. L" A# E - char *dmabufdest2 = NULL;
; C' f' g& s2 x& A1 G7 I1 o0 F - 4 X" [; f- Y4 k: [( v# N
- static int acnt = 512;
; }5 D3 P. }& [ - static int bcnt = 8;0 A1 }5 y( i9 f8 ?2 r" Q
- static int ccnt = 8;2 l7 d* ]3 s% c+ O3 J
- ' m5 ~) u0 p& L q5 n
- module_param(acnt, int, S_IRUGO);
" d* ^6 b Q( R, M& ^& c - module_param(bcnt, int, S_IRUGO);
, m+ S1 J5 l, |4 V; t1 U$ C6 s - module_param(ccnt, int, S_IRUGO);
复制代码
- w- u% U% j y6 K4 E" j
f+ p& S( L% D5 B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* _5 D6 _3 I1 g6 |6 _1 ^* @& [! |5 Marm-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 d% \% V3 S' r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# w8 x. ]$ z7 Z1 L' h' F3 @& A0 o- ]/ N1 U1 S
1 y/ I5 C# C/ _/ v' F( X# g9 y |
|