|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 w/ N4 ?; Y. O' s
- [code]EDMA sample test application
! o9 {& ?6 P' x4 b/ m1 k - /*
' e, N* q! Z6 l/ r N) ?: X5 j - * edma_test.c" D1 S9 V \. j" o6 t1 j$ [
- *
8 ^8 U' J6 v9 ^/ D s - * brief EDMA3 Test Application9 W, y$ k1 S; F! N8 s
- *# J0 R; g, X4 q+ `/ T, Z2 @& s
- * This file contains EDMA3 Test code.1 Q. P, t& K7 Z) l0 X
- *
$ s5 n" r E5 M6 x; D8 z/ J, e \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' }- V5 X) f- A* i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 d6 d% {% [' h
- * TO CHANGE.
; D% b8 O [9 B+ l - */ l/ m4 h$ G/ q) y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 L, R* A5 F& \5 U5 l6 A# y - *
9 C+ {1 O" Y; G' D - * This program is free software; you can redistribute it and/or/ e# U& y1 }1 u( I+ n& o+ s/ ]* I
- * modify it under the terms of the GNU General Public License as
3 ^+ J1 L3 _, s7 {4 t% I; C - * published by the Free Software Foundation version 2.; a7 I: [0 R7 [' @
- *
; ~: e; A: }5 h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ u) E2 N6 l( e1 ` - * kind, whether express or implied; without even the implied warranty b' H% ~1 |! k3 b, r6 j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* S& E+ b, w0 ]
- * GNU General Public License for more details.
5 k7 r) w0 G* [7 W - */2 I2 ]# c8 v6 V( r
# I1 }# g+ N# n+ ~( Y- #include <linux/module.h>
& U$ I, @' s$ @4 {) d5 \4 a - #include <linux/init.h>
6 A" R2 B. \' y1 e+ E+ y$ l# b" _ - #include <linux/errno.h>
! M! R+ |2 N3 _; R - #include <linux/types.h>
! k* J# l9 m) O+ I& T! J P - #include <linux/interrupt.h>: c2 H0 ]1 u+ C4 z0 I" s$ \
- #include <asm/io.h>
+ Y0 E7 _* N2 E9 k d - #include <linux/moduleparam.h>' j; t; J' I) Q5 \
- #include <linux/sysctl.h>! H# [! V$ s0 x: t
- #include <linux/mm.h>
: R1 `2 `" K, e5 r$ Y$ g: ~ - #include <linux/dma-mapping.h>
, a; K) I$ g. o X* O8 Q7 q
& f& B A: j3 b+ z! ?$ U- #include <mach/memory.h>
, g4 m; w. l/ Y1 i2 U+ H- d" }$ h - #include <mach/hardware.h>; a6 C4 V7 ]/ Q: u3 s
- #include <mach/irqs.h>
: P) f, F) H7 f! B4 o# ?6 P4 g - #include <asm/hardware/edma.h>
" S1 L. v4 U: n. Y5 A
% K) n" b- Y3 K5 }1 [$ J G0 q- #undef EDMA3_DEBUG. w4 G1 }- o0 f9 r4 A/ R# Z" y
- /*#define EDMA3_DEBUG*/
' [) `& P' R* A/ M2 L - ; q) N! T% d0 |7 x# r) }- Y
- #ifdef EDMA3_DEBUG
2 r, f, ~: E* ]- a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 q: e0 _! i2 z" t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
T; j: T7 ]% b; e& y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' S' ~( g4 y1 u, Z9 @7 k
- #else7 m8 x6 }$ d0 ?7 W* [( p5 c
- #define DMA_PRINTK( x... )4 c# p6 x$ f1 B. k z
- #define DMA_FN_IN
3 n) i% G5 t3 W. q& Z1 f* V, [ - #define DMA_FN_OUT& @1 G3 `8 B0 X( {* A$ @. q5 h
- #endif! u& v+ K6 X U: O
- * F& C4 P' ?- R! c, F% p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 O) k& t# ^, }5 s
- #define STATIC_SHIFT 3
7 U0 l$ f+ c6 m- h! S: W" U! S - #define TCINTEN_SHIFT 20) r- Q# u7 O8 Y/ [) i
- #define ITCINTEN_SHIFT 21
! ~( c# N; ]( m' P% W9 h - #define TCCHEN_SHIFT 22
3 O, h; Q5 C- _5 i4 w0 X+ B - #define ITCCHEN_SHIFT 23
/ b0 d4 f! D& L# U( u( {" m. B; O
1 h$ d1 |. [) B- static volatile int irqraised1 = 0;$ M- k# F3 g3 ?4 I: W U9 s/ @9 O
- static volatile int irqraised2 = 0;: d. M4 f8 K0 X% _5 O6 U
- # D# Z" G3 U1 `! i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, j, I0 n, l2 f Z# X8 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 g: `' j% A1 w* S, K- Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 A6 D' }# F# j/ Y, r/ U - 6 _8 I. N0 |. S6 H. T
- dma_addr_t dmaphyssrc1 = 0;% C, h9 F& l, y" w% A( I
- dma_addr_t dmaphyssrc2 = 0;7 X, ?4 a- b, y- v8 s' |$ y6 q
- dma_addr_t dmaphysdest1 = 0;
0 r/ e( ^# `+ H4 [# w3 R! Z - dma_addr_t dmaphysdest2 = 0;4 G3 C: a& p0 ^" k& ~: }
5 B% {- F! |4 H. B- char *dmabufsrc1 = NULL;
6 x4 [6 v% ~7 ^1 |5 Q - char *dmabufsrc2 = NULL;, D4 a0 ~) c) ^7 U
- char *dmabufdest1 = NULL;: Y, ]# o7 ~+ U9 J! Z
- char *dmabufdest2 = NULL;5 n) a! I1 T- o7 l/ L# \7 z0 P
- A6 r5 g4 Z$ J1 ?- G6 v
- static int acnt = 512;5 O$ T: o2 \" t% o
- static int bcnt = 8;+ r4 e2 M9 P+ h; R& \) O6 Z+ S5 ?' o
- static int ccnt = 8;
W& I: A8 U' q2 i8 D+ ?- V2 q - 1 J- b# v% h& H! o! E# v+ d
- module_param(acnt, int, S_IRUGO);
& X# q/ K: T/ U8 p/ `2 ? - module_param(bcnt, int, S_IRUGO);
" M+ g, ?9 g+ j. s# f- Z2 ]) X/ O& Q - module_param(ccnt, int, S_IRUGO);
复制代码
6 R) j0 }- t7 m0 M1 F7 o! L4 y# y7 U" ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ u+ `$ g7 Q8 X5 Q* e5 v$ B1 {; Y) P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* G5 y5 u4 e F; ?% t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! y8 C( S4 p4 M& _ W- u
6 S+ k9 a3 T5 k! ?$ X1 d# i5 e2 \" r
; Y2 r( E! V! q |
|