|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 H; T: N; j6 N6 V- [code]EDMA sample test application
: N. a- Z( h1 j! d - /*
6 i8 y1 B4 A4 b - * edma_test.c2 J' u. S- d: \
- *2 N$ g7 t; L0 Z8 {3 }
- * brief EDMA3 Test Application
+ v! B2 g$ j& u/ Z) L2 K - *
; z2 G9 U; w$ @& o: `* u - * This file contains EDMA3 Test code.
( L! l5 e# s/ t, o - */ s) D" t) B9 a1 R4 ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! _- a5 r) L* k9 I# r* n4 J# o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( c W7 Q2 s" @ - * TO CHANGE.
' k. F2 H5 z, A/ B* k - * \$ |, h" [* ~2 ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 i9 k! [# p4 q" d. B1 }( X- \; k( B1 d9 f
- *
, X# n/ C I6 n" p; j4 I. U - * This program is free software; you can redistribute it and/or
1 \; i/ c [* w7 E - * modify it under the terms of the GNU General Public License as" t+ i: ^, J1 ?
- * published by the Free Software Foundation version 2.
, z1 ?+ I3 R/ d$ Z2 X1 C - *
q4 [6 \# d; ?! W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
l X) ] t9 x! ^: l% h - * kind, whether express or implied; without even the implied warranty- T+ B9 I7 x4 @' m0 x4 n0 M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ R8 ^$ m$ r& L! U
- * GNU General Public License for more details.
! G) ~ s s" \6 r9 x - */7 g; X/ X b0 F/ `5 j* f
- * O( J6 Z. w# ^! h
- #include <linux/module.h>; {2 g, @ u! x
- #include <linux/init.h>
- l+ N( h9 z2 ~ - #include <linux/errno.h>
! t8 \3 a; Z. j$ }7 i9 ^% n - #include <linux/types.h>3 _' _- z3 u6 k! T% ` G+ n, ~/ T
- #include <linux/interrupt.h>6 x3 G/ c! }) _3 G2 x0 R
- #include <asm/io.h>
; l* o+ z' R# H0 [+ C m - #include <linux/moduleparam.h>" ~& z8 }2 w" F! B. b$ o
- #include <linux/sysctl.h>
' H; }" z1 {/ Z- J - #include <linux/mm.h>
7 ~. V' c- u5 m/ C8 M - #include <linux/dma-mapping.h>
" Y0 U; o8 D: I9 ^3 W) n - , S4 `* n% z& f d; T+ ?
- #include <mach/memory.h>
, A6 e/ t1 [) E" e: C/ K. K - #include <mach/hardware.h>
/ t) \4 i v* L - #include <mach/irqs.h>8 f7 W* R2 z! ]+ Y" d3 ~
- #include <asm/hardware/edma.h> K+ @( ^% E1 Q" m
" V$ n2 [' ^8 y' G- #undef EDMA3_DEBUG
1 l( i) Y) m0 q* J% d1 O/ F3 \9 g - /*#define EDMA3_DEBUG*/! k9 e8 z P& B3 ~' S- V
) j( Q1 g" B, w- #ifdef EDMA3_DEBUG+ g6 M8 C/ J6 O9 j, D5 r) K7 {/ M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): D; Q/ f: q. m/ O, b! I. f; i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 e( T# R8 I* O4 X/ I% Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- A: ?: ^! }$ O
- #else
- R; K) m4 j# {& k) D$ A7 ~ - #define DMA_PRINTK( x... )& i+ E% f d6 |- {$ T4 Q6 V: |
- #define DMA_FN_IN. }8 x+ u' M- z
- #define DMA_FN_OUT s# M/ q! b" e9 `% V
- #endif& d0 ]$ ]( c3 b9 o$ N
- w- r8 p# e! Z7 J Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# P5 T% R7 i+ \
- #define STATIC_SHIFT 3
- ^) o1 o$ P' M) g - #define TCINTEN_SHIFT 20
2 h2 g1 | [3 x3 A2 u - #define ITCINTEN_SHIFT 21
5 a/ M% y) W) k; ]/ r$ a - #define TCCHEN_SHIFT 22! v8 _: X9 J ]( Y6 e
- #define ITCCHEN_SHIFT 23
+ W; { d. n% \8 c
1 o W. \/ e; G7 u$ {0 h) d v4 Y- static volatile int irqraised1 = 0;- ~9 P$ }/ R- W5 G
- static volatile int irqraised2 = 0;5 y) k2 O7 V' B
- M5 `7 P! y1 w/ D8 i: z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, j( v* e" I4 \' t& i: t, W, P( V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 [( ^# N3 P. }9 R7 S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- X+ W; p# L" y% z: |% Y - 5 U% T' s- N/ u9 a" X
- dma_addr_t dmaphyssrc1 = 0;
, E% \$ r, `; T/ ?/ g2 q - dma_addr_t dmaphyssrc2 = 0;" a z& s5 g3 D5 I# A0 S$ w% [4 s( M* H
- dma_addr_t dmaphysdest1 = 0;) Z, K. ` g1 C1 V
- dma_addr_t dmaphysdest2 = 0;
. t- K4 R5 z+ H
+ s& ?8 j/ `8 K1 Y. _) l; m- char *dmabufsrc1 = NULL;- W( s ^. P6 o& K- V8 H
- char *dmabufsrc2 = NULL;2 Z1 t& `/ t3 O3 {3 B
- char *dmabufdest1 = NULL;8 C2 f7 c- u. l8 q# s e% s
- char *dmabufdest2 = NULL;0 L1 u# D" x) @
8 C$ H6 ]" p0 u: i. N- static int acnt = 512;" u) [2 D+ Z' O9 l3 ~
- static int bcnt = 8;
+ O& h- y1 ~* O8 K# C - static int ccnt = 8;
. e0 W6 p7 X1 X. l4 i - 9 E8 q+ t5 H$ p @) |
- module_param(acnt, int, S_IRUGO);
( L7 c2 ?3 D3 {3 A6 p0 d( n - module_param(bcnt, int, S_IRUGO);
; D$ L- w( `# m% ? _! z - module_param(ccnt, int, S_IRUGO);
复制代码
" d8 p3 P7 Z" _# Y1 U" D3 V p# _9 b/ k3 m4 g5 C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 H/ `1 w+ h' ? z9 Q' c; iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
G# x' W( n3 U- I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 w9 k) B- K7 K- Q! G* a. ^3 H! Y9 H
7 S$ z6 L# \3 r# V) J! `6 ^
|
|