|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 [; Q2 ~, \0 y) G7 J* a
- [code]EDMA sample test application4 X0 a. n( p8 u
- /*2 ]3 W" c X0 i" S7 `2 p {" Y* `
- * edma_test.c" \' @3 v. ~- X; _2 ]
- *
; ^/ Q; C4 u6 A i# m - * brief EDMA3 Test Application6 T8 M6 J6 y/ q2 X
- *( U: {; Y5 O5 v+ {( q: Q* G$ S! Q
- * This file contains EDMA3 Test code. W( a% p. ^) g) A: M5 i
- *
2 h* B/ O+ ]. F$ {8 M1 P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE v4 [( G: O. @( r/ T& Y& B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! c& D# \+ H& `
- * TO CHANGE.
* a/ T8 N+ y( z( D) _ - *% Y) N& Q1 o6 ^8 \9 `0 N9 Z; C" }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- h& E. d9 x% A; M' L3 t. E, w3 h - *
, q, }* P2 a9 r! z3 a- F - * This program is free software; you can redistribute it and/or) Z6 K } h) ^* L9 x. ]3 ^6 f
- * modify it under the terms of the GNU General Public License as
0 @! G; N# |+ L - * published by the Free Software Foundation version 2.2 i) Z- X- l' Q" k* [) O. J% L
- *
$ |# T/ b, [8 \: {) n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. T# E. e5 c0 P$ H9 c( r8 C Z - * kind, whether express or implied; without even the implied warranty- c! S0 ?- i C- q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! Z9 I+ [* r' W% d/ K( f6 w
- * GNU General Public License for more details.
0 \8 k. p! z. [5 |5 s - */# b, p/ k" x; N% |4 n
. J3 G$ O0 Y- q Y& T7 \- #include <linux/module.h>
& Y: b9 K% K/ v6 u! l- G - #include <linux/init.h>
4 C7 l+ r$ |( B$ G* i - #include <linux/errno.h>4 c3 \9 {4 ]: ^9 I, |6 a7 s: K
- #include <linux/types.h>! v P2 ]$ j) _" |" J
- #include <linux/interrupt.h>$ A! g c `; s! U9 t3 W
- #include <asm/io.h>
! A! |4 Z6 o$ g# Y - #include <linux/moduleparam.h>& g0 S( N+ I1 O( {, q# ]7 t
- #include <linux/sysctl.h> r/ D) o- t4 b9 R. L3 V, Q6 R; v
- #include <linux/mm.h>: y% C6 T3 ]/ q# ?. m6 q
- #include <linux/dma-mapping.h>" h/ o% B# [7 Q% }! A
- / e& V7 ]" i8 X; f( A c. v" L
- #include <mach/memory.h>
- A6 K+ d) g% ]: R7 ~% o - #include <mach/hardware.h>
7 s. B7 i+ E/ g7 n0 ~ - #include <mach/irqs.h>' L M/ v% z! c; b! c# d+ U
- #include <asm/hardware/edma.h>
% I v+ ?! T! x
, p: y! ~5 I, |- #undef EDMA3_DEBUG
6 I" G9 [+ C9 ^+ C1 w) L - /*#define EDMA3_DEBUG*/( R3 v% W& e& c t
, g& P+ I; j. |( Q! J# t- #ifdef EDMA3_DEBUG
* x& ?) a8 N( }2 }! c9 ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# f7 Q Y& j# r7 O1 [# Y3 f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. v) _3 _/ r$ x8 G5 c' Y& k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' t8 f* o% D y0 B; T7 S# V0 |
- #else
& p- K* t% ]$ Z: E5 U. X4 I - #define DMA_PRINTK( x... )+ U9 d: }2 x/ w9 l3 D2 w
- #define DMA_FN_IN
- L3 ` v, w- x9 A$ F* e( p- M; R - #define DMA_FN_OUT+ N# ]# z% |+ y9 \1 w7 x
- #endif+ r; Y" A1 |# d9 p% E0 j
- 2 W1 U. T; H8 ]1 O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( g8 L& g: B. e9 C
- #define STATIC_SHIFT 3
$ i! G0 K$ b0 T4 Q* I6 u - #define TCINTEN_SHIFT 206 ~8 z4 |% d2 k8 N
- #define ITCINTEN_SHIFT 21
9 C; c6 s7 m6 w - #define TCCHEN_SHIFT 22' f8 j/ f, C/ V# ^8 X/ {; K
- #define ITCCHEN_SHIFT 231 v* h& n& N3 K" m' M% E6 p
: ~3 J2 |0 g, l" Y- static volatile int irqraised1 = 0;3 {$ V# \: p5 J% ~0 _- z
- static volatile int irqraised2 = 0;/ \: I0 V: ^/ F9 x
- ' i G# {2 g5 y, \6 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 r, v3 u, _, s8 ?- e* }6 W/ \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ k. X3 t" v0 e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" C8 o6 t. g+ Y, w' o
" n( f- @3 {5 ]/ H- dma_addr_t dmaphyssrc1 = 0;8 p+ R0 X& o- a; I9 N0 Y
- dma_addr_t dmaphyssrc2 = 0;7 s1 `7 T- Q Z+ K# r
- dma_addr_t dmaphysdest1 = 0;' K, k# S9 m! o6 i1 @) |1 j
- dma_addr_t dmaphysdest2 = 0;9 m! `% \ w n5 }. u3 L. ]
- 5 ?4 g H/ y( O |% k( x
- char *dmabufsrc1 = NULL;, A! N6 j1 S" P4 V
- char *dmabufsrc2 = NULL;
8 U# I& y6 V' j( W - char *dmabufdest1 = NULL;
# T# n- [1 n7 E; J* P1 D - char *dmabufdest2 = NULL;% N" L2 U% X0 K
c# z1 W1 _9 Y0 s- static int acnt = 512;
. ^* i1 d0 U7 S0 |3 p7 V* {: K# e - static int bcnt = 8;! U+ o- F! R4 h# m: }
- static int ccnt = 8;9 V3 A* {- ]7 e, F
- : x0 a3 y0 n* Z" Y& r' N- C ~9 h
- module_param(acnt, int, S_IRUGO);
3 G l+ C0 q8 J( y4 h9 P - module_param(bcnt, int, S_IRUGO);2 Z9 H2 b9 @1 Y
- module_param(ccnt, int, S_IRUGO);
复制代码
& `) ]9 D! A2 @) O, ] g8 g
5 C) B6 Y. p# m0 K& J1 E+ b$ C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( X- d+ Q/ L1 k* H7 F5 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: y( o' `6 \; s3 d) i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# G9 C$ M( h9 `8 U/ B$ c! ]3 W5 E( b+ q, T8 m* H" O
: J3 l; }9 U8 i+ ?# X
|
|