|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : ^( I2 I$ o% k
- [code]EDMA sample test application
1 d" y: K. Q$ v' C% e - /*1 [) y E. @- V- u
- * edma_test.c
# C( j [/ `0 l3 U3 h' O; N - *, q+ m: S2 x1 b. ` y( B
- * brief EDMA3 Test Application
: L$ S( G$ L) ^% d" w4 V4 M9 e1 ^: u - *
9 c g2 v. C |# T4 k - * This file contains EDMA3 Test code.
* ~ C1 P" z( k; r e - *0 A( m7 j* m% m* b8 j3 v e5 R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 K, R8 D+ x+ a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; e8 ` U6 g, Z1 d! [- n1 _+ w - * TO CHANGE.* Y5 n- g6 u( I9 {
- *
8 i7 I. }" M6 q: @. b/ N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' |: g) k$ p9 ~$ {4 h
- *
m. O/ i0 g3 {2 r- K, `0 r - * This program is free software; you can redistribute it and/or* X2 P6 Z% z8 l
- * modify it under the terms of the GNU General Public License as, t9 O4 ?) J' U' d+ P3 f
- * published by the Free Software Foundation version 2.
, h) V6 r2 h. m! g - *. h5 q" Q* @1 w% M7 C8 M9 w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) p2 u2 k) `6 U4 Y7 u+ H* H | - * kind, whether express or implied; without even the implied warranty
) _/ t- k7 } h4 j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) l* J) D' J( v* V
- * GNU General Public License for more details.
8 j4 v2 Y' K, g% k2 G* b0 c - */# u7 o! c2 n. F3 i' @( F
- % `# A" R/ j9 h7 ^+ m
- #include <linux/module.h>
* W8 P7 {+ z& `" `9 Z - #include <linux/init.h>* O. s _9 N Q% g( S3 v. P
- #include <linux/errno.h>- A; y" @2 \2 e$ S
- #include <linux/types.h>
0 f5 G' {$ W x7 t; ~ - #include <linux/interrupt.h>
$ v* N& f. s% ]" f8 o - #include <asm/io.h>' s) K- a0 x) _4 O
- #include <linux/moduleparam.h>
2 S5 o3 g; y$ |; _ - #include <linux/sysctl.h>
! f0 \) a1 o1 f' F! | - #include <linux/mm.h>/ r1 J7 Z/ D$ i4 u( Z% Q/ z# {7 x
- #include <linux/dma-mapping.h>( c% f! Z$ B$ @4 K, _% a
- - M: f5 U% w% F* t: R
- #include <mach/memory.h>
4 R6 ?. D3 C) Y* a/ S8 r% G - #include <mach/hardware.h>
9 x7 u+ h9 u8 R4 ` - #include <mach/irqs.h>7 S6 d4 [: r+ X4 U
- #include <asm/hardware/edma.h>) t2 L7 S. G3 X( C
- 2 t) g- F6 w0 A/ ]% q- f X" N7 M5 x
- #undef EDMA3_DEBUG
0 h. ?1 z1 W# F; ] - /*#define EDMA3_DEBUG*/' _# A9 A9 a [2 A% t1 t, x
- " B' X5 }7 c: y, v
- #ifdef EDMA3_DEBUG
0 T. V3 n- `: `. }9 q6 C. U4 U" ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) u6 B' \/ x7 b* x' u j6 i! O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 V) o& b9 `/ X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( x7 A8 O p# e1 J; ?# m - #else
) W8 O- o$ l$ i' m - #define DMA_PRINTK( x... ), \: M; z' a( D8 v
- #define DMA_FN_IN
- Z! N" x4 H! u2 m6 V - #define DMA_FN_OUT
* V/ o4 h0 t' U - #endif
( P1 N! i5 V4 h- P6 B$ H - 5 J" N/ c. u, K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# i9 Y4 D# G; f( K
- #define STATIC_SHIFT 3
; W9 i" A n* T5 u* C/ s/ ` - #define TCINTEN_SHIFT 20) Q" i( w+ u2 V) u6 E9 Z, d
- #define ITCINTEN_SHIFT 21* q7 V2 T) Z+ j5 G: ?3 E
- #define TCCHEN_SHIFT 22/ A3 J2 R, W6 u! \% P8 O" T7 L5 y
- #define ITCCHEN_SHIFT 23" v& E+ E" f% ?6 v5 K7 r
% r% Y% H- b( E$ R: W- A- static volatile int irqraised1 = 0;
* i" A' x( ]. l& w; I - static volatile int irqraised2 = 0;
9 s9 S4 v- e+ X3 {) g% x8 U - 2 a z+ @) a$ z5 @$ f) q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ?6 u* q+ g' L, `! G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% I1 n U6 b3 N* ~2 U+ k. j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% d, k S& W3 L/ F5 E& K: ~& Z
7 K2 t. p! B ^# J- dma_addr_t dmaphyssrc1 = 0;
$ [' {' S: D: E' x - dma_addr_t dmaphyssrc2 = 0;; k" _, |8 v( v/ ~% ]
- dma_addr_t dmaphysdest1 = 0;
_1 w3 b/ o4 O9 \8 Y' j - dma_addr_t dmaphysdest2 = 0;
8 E) m2 g; ?+ m/ E6 v - % S$ e& m8 t# G8 ^; [6 J7 E2 V1 C
- char *dmabufsrc1 = NULL;
3 y% f- L+ L7 U9 P - char *dmabufsrc2 = NULL;/ q' o6 B* a+ x' d' r+ Z7 z9 q& m
- char *dmabufdest1 = NULL;
& Q9 Z( u2 C4 G - char *dmabufdest2 = NULL;; E) V- c+ p% J7 c }8 F. V
( T ^# y+ p3 a3 I; L# Z- static int acnt = 512;& Q/ P+ b S7 }' `4 N
- static int bcnt = 8;' f4 z. l* x' C% i3 k( q. a$ q
- static int ccnt = 8;
9 i4 T" H o8 o+ O4 o: i - 1 O2 E0 B" H% P( ? q: A1 c" J3 H
- module_param(acnt, int, S_IRUGO);
9 B: K# J- b1 t4 j" y4 D - module_param(bcnt, int, S_IRUGO);# f& k n' F/ ]
- module_param(ccnt, int, S_IRUGO);
复制代码
$ g1 |* C# V3 R! v
( i) f/ [; N2 m# q7 B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# k+ N3 r- H7 j" W) s. a0 y4 n+ |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 M2 }& |5 C4 T. l# ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" C* n3 o+ O/ v( K4 M+ C3 A+ D$ U5 O, C' q9 J
1 z% o; G* \$ D, z4 f% E
|
|