|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' H1 p3 q" Y! H8 V* ?. l& {' r- [code]EDMA sample test application% W0 a* V6 m/ c4 i# X; f- V
- /*" m0 {: E! G8 N; Z0 t9 [
- * edma_test.c
8 j# |& W. f7 p! q. q, \' V - *
) s+ g* v8 U, c8 ?* [+ W% | - * brief EDMA3 Test Application
. W- H% p2 v5 }, \/ f - *
( a, M; c. r5 s, }. v - * This file contains EDMA3 Test code." L, i( a/ j, b' W7 W
- *
A1 u* d& t- d; T4 ^) v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! o+ r' j7 [: D0 a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% c0 c5 k9 R* [7 J
- * TO CHANGE.6 ^; S6 l+ G1 m H
- *" I5 _! S: J* X V1 K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, g" s! s3 D- _5 k
- *$ A6 @& b' S e) P; Q! c' U+ Z: N
- * This program is free software; you can redistribute it and/or' N9 T$ L6 j1 S) X* B7 K6 f
- * modify it under the terms of the GNU General Public License as
# S2 F, L; C' G ^0 N! N - * published by the Free Software Foundation version 2.
8 I k- C; c; e Q; Q A - *8 p5 A, }, N, F) z4 @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& ~1 N' _- i) s
- * kind, whether express or implied; without even the implied warranty4 v4 m+ w5 z& C$ h0 {$ u( Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 r& C1 w" |; D+ b5 A - * GNU General Public License for more details./ S" G. a" @- \5 x
- */
# P8 p% D* E+ B, P! L) S! | - $ {' r; Z Y* a' S8 u
- #include <linux/module.h>
& [4 Q" U. q+ }8 i0 {/ R3 F - #include <linux/init.h>7 e, T- o) A7 \, M) \
- #include <linux/errno.h>; p/ o4 D8 z- p$ P# ~
- #include <linux/types.h>* [ Y: X1 c1 Z2 l" \8 a
- #include <linux/interrupt.h>
. K( ^4 Y0 i& k+ F. L+ j1 b9 q - #include <asm/io.h>! _' J5 `% U! |
- #include <linux/moduleparam.h>
: B, V" t0 [9 v7 z - #include <linux/sysctl.h>
( ~; [8 |# T" {5 j - #include <linux/mm.h>
; |% D i( S7 c% s" ]% x - #include <linux/dma-mapping.h> U# M$ F2 z# N" T
- : G% y3 e' M" S" O5 |
- #include <mach/memory.h>
9 C/ a) q Z' r/ w3 W9 h - #include <mach/hardware.h>6 h; [2 U; P% x; ^2 d$ n
- #include <mach/irqs.h>
5 C% ~) o$ F/ u - #include <asm/hardware/edma.h># ^: [) h/ q- b) C
) f; N7 ], s0 p- N0 M' ^( `- #undef EDMA3_DEBUG2 J2 J' N* c$ {3 O1 W& m. y
- /*#define EDMA3_DEBUG*/
5 l0 h" K0 s) n1 d3 F" F! T - / D6 x) ]8 c: i
- #ifdef EDMA3_DEBUG
9 `) X3 s$ Q3 P4 K; ]% B6 M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 w4 [% p0 h5 s+ x* B$ l$ z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 Q. a2 k: d1 M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& h0 L3 X" E: r1 Z2 O" J5 P
- #else
% `$ c4 {+ s4 [0 Z4 o B - #define DMA_PRINTK( x... )9 x! w7 j! |3 E. k2 J0 q0 a! M
- #define DMA_FN_IN
5 y4 |; C5 P0 e. l, w6 } - #define DMA_FN_OUT
8 G; q$ @7 Y1 l3 S - #endif
& i Y: u( F0 q* \6 [( w
* _9 N: S4 c- y3 Y% a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 j1 c- W" V5 {2 s7 v - #define STATIC_SHIFT 3
0 O- h1 ~! c- P0 Q! z! p - #define TCINTEN_SHIFT 20! e f0 w% o/ d+ k
- #define ITCINTEN_SHIFT 215 n4 W% q; y1 o2 [# k/ q! I
- #define TCCHEN_SHIFT 22
2 j0 j4 m; f# j2 |: j! r$ w - #define ITCCHEN_SHIFT 23
" @* D% t0 g& d/ k |5 X+ G- T& Q" D - - ~; C. c. D! D4 u6 F
- static volatile int irqraised1 = 0;# j9 D3 h4 ^8 s/ G
- static volatile int irqraised2 = 0;
) {/ C# C8 M9 p! y) ?8 w9 T - $ a/ U3 P- r' N2 g$ x. O2 _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ f3 g$ f5 J; J7 e+ m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' [7 |9 y8 D7 I& | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: a$ A4 e' }8 @1 c
) x9 e3 X, u4 X- dma_addr_t dmaphyssrc1 = 0;; b* a/ w0 h" Y/ \. a1 Z- @& H$ F
- dma_addr_t dmaphyssrc2 = 0;, C+ K# Y, \& n# }5 E, p
- dma_addr_t dmaphysdest1 = 0;0 \, Y& T9 w% b# q3 P* C
- dma_addr_t dmaphysdest2 = 0;
8 i. D* W% J9 I
1 ~9 f% ?7 o/ W+ q: F- char *dmabufsrc1 = NULL;4 ~, k" C' I2 M
- char *dmabufsrc2 = NULL;5 k# l. D$ y# b3 H6 g
- char *dmabufdest1 = NULL;" p) ]4 m+ [( W5 R& Y. a
- char *dmabufdest2 = NULL;
- {2 k3 [$ y$ S! x/ f! U8 K, e - + b9 X; f4 b$ K' v1 D1 d4 y
- static int acnt = 512;7 T; I) O3 w, m. Q- G
- static int bcnt = 8;
5 C, _- v: C: e0 t - static int ccnt = 8;2 ]) l7 t. w. Q2 T/ d* G
3 v. K3 Z. [. L2 l/ r2 u; n" d- module_param(acnt, int, S_IRUGO);. u( f% C. s0 m* h% m; m
- module_param(bcnt, int, S_IRUGO);
( E5 H3 M; F, A# ^! y" w - module_param(ccnt, int, S_IRUGO);
复制代码
" e9 c! [8 _% }: t% I( [$ |% E- R' g' e4 A! \) D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' H: v3 H, v5 [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) n" n8 n2 m1 i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% }* R4 |- M3 k
- u7 k* d# {3 ]# @! C+ h w
$ x/ W. L+ J. g
|
|