|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' A* h) ^8 b$ K4 ?' s- [code]EDMA sample test application
* u; [6 p9 B+ }) @ - /*
: p8 K3 ~/ k% P. U; L. ^9 o& B: V - * edma_test.c
$ `7 H" l+ }2 }2 q @2 G, a2 U - *8 J* I4 U$ ?9 t: e7 P
- * brief EDMA3 Test Application5 o) z5 Y. |) b- C, _- p. g! L
- *& [! u" j a$ }9 O" ^4 j8 m+ h: u
- * This file contains EDMA3 Test code.
0 c$ A# _: [' o8 [; ~0 R - *8 Q( [$ W- S2 v/ a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& ^9 [* F+ |% F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# ~, l' a, f# y* N0 {: N
- * TO CHANGE.# F$ S t3 s* L0 c
- *
: Z+ H# u" l* K1 G" R, |4 r4 F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. Q4 D+ C+ a8 ~5 |1 S
- *
8 B4 m0 X- y5 ` - * This program is free software; you can redistribute it and/or& b% [" G4 r8 u7 t
- * modify it under the terms of the GNU General Public License as* X+ i% b Z2 G
- * published by the Free Software Foundation version 2./ R4 e i2 N/ }, G M% j ~
- *) L/ g: j+ o0 ~& y# c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 S7 H9 n; c8 f' C+ i - * kind, whether express or implied; without even the implied warranty
# D7 [1 p8 _/ {. S! @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 D9 ]1 @+ O' T* h! G
- * GNU General Public License for more details.& ?. L0 u! r* U7 Y& Q; P
- */
& Q0 I4 H: J) i: s1 U5 x
; @8 P/ v! S+ P- u8 g- #include <linux/module.h>( y( U, I2 M) p, j+ {: `, Z
- #include <linux/init.h>' }4 o% j7 h3 U: t( Y
- #include <linux/errno.h>
! i& t) ?+ x3 W( l! @# c - #include <linux/types.h>+ y$ H4 Z) ]3 l- ?
- #include <linux/interrupt.h>
( C& G( [# o d - #include <asm/io.h>
* K2 r8 z2 `$ [4 P& j+ } - #include <linux/moduleparam.h>
+ M: `4 X2 u9 k" [0 d* z6 v i - #include <linux/sysctl.h>; W1 m' q: W1 K2 o4 d8 c r
- #include <linux/mm.h> ^8 w; h1 R7 K2 @4 |$ r8 K
- #include <linux/dma-mapping.h>, i+ T0 }- N# M E. t/ |
- . S" ]1 z$ O3 h7 a, g
- #include <mach/memory.h>
- h$ }) @$ `( T( [! \ - #include <mach/hardware.h>
( R( `/ f* l/ @. G - #include <mach/irqs.h>7 c3 w D( s. R# R; i; a
- #include <asm/hardware/edma.h>
0 @' g$ n5 I. [* S% J' j4 i( S - & m1 y( F- V# U) z
- #undef EDMA3_DEBUG
" P9 B2 c5 d# O- C' s" Z - /*#define EDMA3_DEBUG*/+ m9 F) K& i0 _. |2 Q% j4 f
5 e* o! S0 D# e( M! v3 ~. g/ v8 e- #ifdef EDMA3_DEBUG
! Q( Z; n; k1 }) t' z! @$ ^, z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# M1 R' W; i* }8 P6 ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( Z9 @6 H2 h) g( c/ W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) I& e8 y {5 L$ X; Y! E0 C - #else
& {4 f3 D! b# Z* f* ]+ K1 [& D - #define DMA_PRINTK( x... )5 u( U( m' }- X/ m& \3 o
- #define DMA_FN_IN
; e% \9 y9 g2 y( M/ K - #define DMA_FN_OUT
+ p' }/ Y' e! c - #endif
/ c ?) j( h F8 _! | - N, u$ B1 B; Z) E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 E8 Q' D* p3 P9 j
- #define STATIC_SHIFT 3) i# @" b0 i' @8 s7 Y. G0 t: p
- #define TCINTEN_SHIFT 208 x0 s1 o5 R) N, n. B; `8 J
- #define ITCINTEN_SHIFT 21) s; y# B+ @- m' C, y8 ~
- #define TCCHEN_SHIFT 22
/ F% j J1 Y y5 W( P3 k - #define ITCCHEN_SHIFT 23
3 n; @2 I) J4 Q/ C - 0 \9 e: i: y) G! k- V/ P9 [
- static volatile int irqraised1 = 0;) Z! _# V# W8 G3 i4 ?! X; @! `
- static volatile int irqraised2 = 0;
s7 _7 P, B# u9 P1 c: r - 7 r. t4 [/ q# E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 d9 h2 b3 N! M! D% v2 W3 R/ e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
d2 N& g6 K" h' t" m% C/ g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ w. h- d4 [) w5 ?
, Z* ]# i N; T$ f( h- dma_addr_t dmaphyssrc1 = 0;
2 x9 D( [* s7 i/ J2 d2 z9 r/ O - dma_addr_t dmaphyssrc2 = 0;
8 P1 a& d* p: y' N# n" N' b8 z1 s l - dma_addr_t dmaphysdest1 = 0;
3 _( | Z) P2 [ - dma_addr_t dmaphysdest2 = 0;
! [( d/ q& o7 n! [ }& Q7 s& I: H
" n m1 H+ F9 d. j% g" b1 q2 _- char *dmabufsrc1 = NULL;- C. |0 H6 c+ w6 o; d
- char *dmabufsrc2 = NULL;5 ^0 M6 E9 a Q: V( w
- char *dmabufdest1 = NULL;
4 {9 X& u ]; `( j) N) N - char *dmabufdest2 = NULL;
+ |4 k1 Y4 z" a( C5 ~/ \; S, b
4 H# N4 A4 x# [. m3 q* |- static int acnt = 512;. w; Q: z7 g: ]1 A. g6 E O
- static int bcnt = 8;
2 W) z# Y9 | }2 W3 t. @% W - static int ccnt = 8;) j* C, t1 P$ A8 w# n3 ~
- ( H( ?+ w4 B' b& U4 z h
- module_param(acnt, int, S_IRUGO);
. R2 F. D4 i/ z+ u - module_param(bcnt, int, S_IRUGO);
6 s' z; H5 }1 |. V) W2 x( ^4 w. W - module_param(ccnt, int, S_IRUGO);
复制代码 + y/ j0 U% Z5 I+ ^# A h3 i
% m/ E6 M2 m" D- j* g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 v, K* y3 X! `! [+ ^1 qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
e# K0 J& q9 H i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* q% \' g+ Y4 r. H2 Q. j- U
- x4 v# A+ `+ D" X2 [2 L% G
4 N" ~7 i# }; Q5 O4 ]" z0 _, L
|
|