|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 ?; Z0 A8 T( |3 E# ~
- [code]EDMA sample test application
/ h0 }# I/ z' S( v1 c- _% Z - /*! s" N W0 w6 R$ E
- * edma_test.c
* V2 N& E" \; y1 D. s% s/ t; R9 e - *) K; `2 ^) U- F2 d! A
- * brief EDMA3 Test Application. D8 ~: c$ o" H; j; g/ r
- *
( j5 z I( \/ V5 `6 H8 o& j. s. b2 ]: i - * This file contains EDMA3 Test code.' d6 q: L" x$ ^% U7 B3 \
- *
) v5 o" r6 j+ D* q# D$ X8 ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. S. ^+ e- q, U/ z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 e( E- j, j. R+ U3 P$ h - * TO CHANGE.
$ i2 j% _, v* L2 \# R8 z& m& j% n - *
, q: _: b* ?# j! f8 R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- M* H7 E% R* X) i5 L/ t, {
- *, b2 Y/ I2 `7 ]; e
- * This program is free software; you can redistribute it and/or* m- _: L4 t8 I9 w; C; E8 g6 n
- * modify it under the terms of the GNU General Public License as8 H: G; C2 K& k1 K# i
- * published by the Free Software Foundation version 2.9 M. g5 x0 S9 `
- *
4 S; _! Z' ~; n8 p- @5 I U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- p0 h+ {% _1 F* b, P, u - * kind, whether express or implied; without even the implied warranty6 a% ?" h* w3 ^, p) v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' W/ X5 D6 V* \( Z% i3 i - * GNU General Public License for more details.! v4 @/ l5 V6 n5 H, j0 H2 w2 l
- */
* d6 z7 t; x" q1 D; w - + R* R/ m- _1 ^/ B. ^( Q" C
- #include <linux/module.h>
) u1 k( I6 Y) D: l - #include <linux/init.h>
$ w7 R, P: c- v) e. @6 Y8 g - #include <linux/errno.h>: j% z( a. v2 h8 f! B1 G! \: p
- #include <linux/types.h>4 Q8 T' M& R3 Y$ c
- #include <linux/interrupt.h>
9 J0 z- e# l0 g0 k# |# q$ g* c- V - #include <asm/io.h>
6 v& j) r; Y7 l3 h' R4 } - #include <linux/moduleparam.h>) ?+ t' N$ W5 d3 U
- #include <linux/sysctl.h>
4 K9 l+ E/ V6 C; B7 s y: ]$ @ - #include <linux/mm.h>
# \6 c6 }' Q6 m2 n! B - #include <linux/dma-mapping.h>
% o" ^+ @3 p. U: h
5 {/ o5 ^6 j- y' h0 N9 o- #include <mach/memory.h>& J+ [) d! y4 V
- #include <mach/hardware.h>1 r; x8 s: e3 f- k+ `
- #include <mach/irqs.h>2 v. E, M- X3 Z
- #include <asm/hardware/edma.h>1 N* x8 ^$ u+ ~0 D( ?+ u
- , k, X/ O: [ B% `
- #undef EDMA3_DEBUG
/ f1 y1 I. {5 o( [& P9 K - /*#define EDMA3_DEBUG*/+ x0 Z! J0 y" |+ R' q
- $ I" D% T2 T9 F o
- #ifdef EDMA3_DEBUG( m* R b6 G5 t) b& ?+ w# p# h, Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& y; U; i6 l9 ?( j8 E8 U q6 w' ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! ~2 x: z: Y* G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 U R9 h3 @' S# Q( h& _; t% C
- #else% L, G' m" F8 k$ z& Y; c
- #define DMA_PRINTK( x... )
8 i1 r, }& W+ ^* `4 Z - #define DMA_FN_IN" C. U* y) o1 Q# N7 A
- #define DMA_FN_OUT
n" X' y* S8 |1 _: d7 u - #endif
$ ]9 m1 c& K! M0 k' L- q - 4 q& B% I3 K4 p4 `! A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. P2 W# w' p# D - #define STATIC_SHIFT 3# ?2 H* E' t. c O4 [# W
- #define TCINTEN_SHIFT 20
. @8 O6 O7 {7 U, _ - #define ITCINTEN_SHIFT 21# D1 M% C2 e, \9 B& e
- #define TCCHEN_SHIFT 22
! P" a$ f" U9 I5 u - #define ITCCHEN_SHIFT 23
; C( {5 Z: k: A1 S C8 A7 C1 c" S
1 k- u& }, B6 z9 s- static volatile int irqraised1 = 0;
' U8 x9 \4 L( ` - static volatile int irqraised2 = 0;, ~' v$ {- A4 N- ^' P' f
- 2 X7 K3 ?, G" u: d) J3 [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 Y$ R1 y5 Y- H4 H8 {* }( {, [8 T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. m* q; R9 ?7 c) i. z7 Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 n7 q' [+ a0 [+ b7 ^! ~. q4 b
- + R3 B0 m3 b% B+ ~/ z8 e5 c6 N( }1 W
- dma_addr_t dmaphyssrc1 = 0;5 S' F! w5 M0 u2 s9 m; R$ x
- dma_addr_t dmaphyssrc2 = 0;0 c: I+ u' C# a6 F& E0 s
- dma_addr_t dmaphysdest1 = 0;" j$ k- |& s% L4 l6 c
- dma_addr_t dmaphysdest2 = 0;1 @$ j) X9 d5 c! W
- 3 E; r( N' @8 C4 @
- char *dmabufsrc1 = NULL;: A, W l0 y4 m+ H& J
- char *dmabufsrc2 = NULL;
3 D4 V( \* ?6 D - char *dmabufdest1 = NULL;
% I$ A) Y9 e/ j1 _ a+ A4 k - char *dmabufdest2 = NULL;
, C3 ?" r1 e: c1 u8 a, V5 k5 K+ C - 0 r7 q, [0 S- I* A+ f3 a. @
- static int acnt = 512;9 J3 S" p. M# H5 [9 j' }
- static int bcnt = 8;
9 ^8 M! N3 n: u# k2 H. w" z - static int ccnt = 8;
6 Z5 F: S- t& M
, G5 C! N( p6 z4 g/ w- module_param(acnt, int, S_IRUGO);
/ t C8 m c* Q* J - module_param(bcnt, int, S_IRUGO);- q, f# K3 d# l/ f; ~. T( t
- module_param(ccnt, int, S_IRUGO);
复制代码
' ]0 t- r$ s; w9 v4 |3 s, `4 ?6 m7 X% V' ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 ^. K" Y6 f' w+ G; Y$ L8 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, v$ T2 f, z" t( B n9 q3 J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; }6 n6 ?) p6 v2 r0 w9 n' G% Q2 k# B$ U
. a% r* V- s- ~ H- d; u
|
|