|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
U' I3 _; m! n- [code]EDMA sample test application, g8 E1 u4 ~3 T
- /*
$ [( N3 q+ I' s1 k' L( V2 v - * edma_test.c
) c- N. n6 O$ K. V9 w/ c - * T, ~# N7 @/ T# U$ E" @
- * brief EDMA3 Test Application2 y' v' M" T, P; ?. Q: t
- *
' u# P5 X" @" {8 j) f - * This file contains EDMA3 Test code.! g9 J, K8 Z- |* ^9 {
- *
. _$ R! B, V. }0 n) j6 U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% w- f! D. l6 O9 ]' @' ]9 e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. j1 r1 t; I5 G" U! W. F* t0 i8 f
- * TO CHANGE." _& T- n6 o1 a$ c" A) |& v
- ** F! c' u+ f' Z2 v- G( H" d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 M4 T- S0 D# \; \+ h - *7 \$ t+ ?9 H# G I9 o4 u0 u
- * This program is free software; you can redistribute it and/or$ P' N* P+ @0 A' {! j' |
- * modify it under the terms of the GNU General Public License as& O% h0 R1 _" S
- * published by the Free Software Foundation version 2.
0 Q! f1 [' |8 g6 z - *
, J4 a( B1 B! C6 u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 x* t, o; H# G4 T- i. `( u d% F - * kind, whether express or implied; without even the implied warranty1 F7 A. z0 p8 W& U) U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 Q2 a- m" c' U. Q& C# K - * GNU General Public License for more details.) c& d. t( f" ] ^
- */. x4 c- n$ O6 U3 b: N6 |! m0 H
- # @2 W3 \. a- u# R$ p
- #include <linux/module.h>
3 ] C+ W/ L3 e. Y0 m/ m0 e - #include <linux/init.h>) e6 P6 K3 _6 c- s) Z( R
- #include <linux/errno.h>* T; }& J3 G- p) c" P5 p3 V# O
- #include <linux/types.h>
+ o e2 T5 W. X& U5 H0 K0 c8 s - #include <linux/interrupt.h>! {8 W& v0 o* [8 x: n0 \, [
- #include <asm/io.h>
$ m0 H1 r# n7 w7 h0 A - #include <linux/moduleparam.h>4 R& ?- U( u) u. z/ ]0 g* `
- #include <linux/sysctl.h>
1 a! y: B0 S: m, c/ ^. L8 i$ I - #include <linux/mm.h>% s( b9 a4 o1 T+ d! X! l
- #include <linux/dma-mapping.h>
! X0 M( ]: a2 c+ w2 r3 w5 F3 D) R - 4 o5 p5 ]1 T1 u5 n: l7 y o
- #include <mach/memory.h># n' D, I) z* v$ k6 L/ I- f0 G
- #include <mach/hardware.h>. G7 p% X. x/ q4 h
- #include <mach/irqs.h>! Z, v& d3 `: R8 u- P
- #include <asm/hardware/edma.h>
+ V. h: o8 k9 z4 R- o) p: I5 P - & _% @2 e3 B# P& V7 K
- #undef EDMA3_DEBUG" B( X3 w8 a x8 m( R
- /*#define EDMA3_DEBUG*/: ]6 d5 ~$ Y( q8 y
$ k3 W9 A" ?$ q) N. _3 T- #ifdef EDMA3_DEBUG
) f; {) z. Y4 i; [7 E: M7 \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) Y7 u2 ~ Q/ P9 N2 f3 J' O' x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 r2 p7 E& `, X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 Y+ U( W. B0 M5 ^ - #else1 I9 Z! L e- L, A. |3 j
- #define DMA_PRINTK( x... )
6 p. e: L7 Y" ?& _8 u. g/ o7 U1 q - #define DMA_FN_IN
0 l* Q% j" [ |# @ - #define DMA_FN_OUT
+ h& O$ x* `+ p5 B9 a - #endif' }% o' d! u3 e$ A# q
- 0 g3 F& p D# A8 T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* w. S2 ?: _1 t1 W6 `0 K% f - #define STATIC_SHIFT 3
3 I9 Q+ W& ]( [2 k- v - #define TCINTEN_SHIFT 208 b$ U3 M# @5 `2 [; K3 e
- #define ITCINTEN_SHIFT 211 {5 a6 U# M7 F, W0 A, Y
- #define TCCHEN_SHIFT 22
2 ~/ F, N' B! H9 K3 f/ ] - #define ITCCHEN_SHIFT 23: i% F( z. W+ Z
- % w* H7 B* s) [/ D+ h3 s
- static volatile int irqraised1 = 0;
5 [* B/ [+ Y, S: p - static volatile int irqraised2 = 0;( d6 f/ [+ _* q6 r) ]2 b, m: ]% R" i
% R) t- @$ D$ b, e |5 z: P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% h4 O( y, }; r* o8 i+ y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 n) Q1 o1 V5 r# |# z7 f# O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* \. M5 ]9 H4 w( O - 4 `' f( S B" T+ J7 L" F" e$ @5 z5 C
- dma_addr_t dmaphyssrc1 = 0;0 e/ M' }' ?' G4 ~% r
- dma_addr_t dmaphyssrc2 = 0;
( }3 E' j8 b* U - dma_addr_t dmaphysdest1 = 0;
# ?% d% _: |' H' w/ b - dma_addr_t dmaphysdest2 = 0;
8 O7 P% P( e" t+ u* X& f1 E9 ^/ L - ; n* ^, s ^1 `
- char *dmabufsrc1 = NULL;+ Z; ^8 g8 J3 A2 F8 F% o: F
- char *dmabufsrc2 = NULL;7 q( H4 Q" a/ b7 G) Y# f4 H
- char *dmabufdest1 = NULL;: m' J" Y8 o: G' L
- char *dmabufdest2 = NULL;
/ e# w7 u" x3 h8 W6 {8 o! ? - $ j! X7 C' i9 y2 D$ J
- static int acnt = 512;5 V4 W6 H9 M/ o9 Q
- static int bcnt = 8;3 C; r7 k7 P x3 t( G0 [" Q4 Q( e
- static int ccnt = 8;+ L% q; @. [& S' |! H$ H
- 1 ~3 s* i( P9 H" F: g
- module_param(acnt, int, S_IRUGO);7 U( u$ {8 X7 f" R, ?
- module_param(bcnt, int, S_IRUGO);
4 ~: |7 g5 R/ B' \ - module_param(ccnt, int, S_IRUGO);
复制代码 7 m# H0 [# y. b0 ?
+ F t5 H" ]( v2 j& u( u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! W6 P7 H& k% J0 Q" J9 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 F3 R. L1 p7 |1 M! O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 J. h6 p3 ^, `+ d% ~/ l n8 K' d
9 g# p0 ?1 T' b& t* T
|
|