|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 h. J% b# Y8 a- [code]EDMA sample test application' e- j8 b) N6 F1 u* P+ N
- /*9 t' j. H) n5 n. W, i
- * edma_test.c- c a! I0 G' s' D
- *. [8 l5 ], A4 J1 R) Z2 `
- * brief EDMA3 Test Application* z! ?( O! O: I+ A! o9 E
- *
1 A/ v6 p8 b) c) |2 A. q6 e - * This file contains EDMA3 Test code., S/ ^) j; v& w# j
- *
6 m7 r2 F. @, X$ N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 ]* W; u2 Y7 U/ Z( i T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( \6 J5 E) `2 r# y# y - * TO CHANGE.& o* o% h- O8 t
- *
4 _7 o) f, `, o1 x/ W+ \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 d7 \2 E+ b$ \" m6 `; j
- *
, Y7 o! {! f9 `1 S - * This program is free software; you can redistribute it and/or
+ [5 S! [" _% ]3 | X - * modify it under the terms of the GNU General Public License as) {2 w+ `' g+ \ k7 W
- * published by the Free Software Foundation version 2.
/ ~, y: }+ q* h7 d - *) F$ X$ q6 j! P9 f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 O# U4 B% Y- \- o% E3 r - * kind, whether express or implied; without even the implied warranty
' p8 A! I9 Y/ y6 s' g5 M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 a/ \- v g3 L& z% p3 G - * GNU General Public License for more details.2 p4 ?1 V. v2 @1 m/ J
- */
- \+ c& i, Z- T v `
( ?( p) y" v h4 R- #include <linux/module.h>
5 w4 R" s0 G$ f - #include <linux/init.h>; ]. a3 y: l2 ^9 @8 D& o
- #include <linux/errno.h>* |8 t3 Z0 {6 D$ d) C/ M8 i+ j
- #include <linux/types.h>4 |6 F! a9 l0 N6 ?3 L. h
- #include <linux/interrupt.h>2 Z8 l& j& R# j, v- v: U) k4 d
- #include <asm/io.h>* w5 O( x' K' G- T' G
- #include <linux/moduleparam.h>
# A' p4 \8 D3 f5 g& w! a8 w9 H - #include <linux/sysctl.h>& p& s- N, R# W% }; z0 T
- #include <linux/mm.h>7 l8 ]( d5 @! ~% o m' s' k# K
- #include <linux/dma-mapping.h>. v* \+ b( p4 o L0 n9 \7 O/ y
- 3 b1 p4 u0 F4 B$ u9 e
- #include <mach/memory.h>
- @' z' f3 M) k; S( w - #include <mach/hardware.h>' y: _ {% y5 f! U9 T1 A# s* K) Q
- #include <mach/irqs.h>
6 M: z& C$ i+ X$ Y - #include <asm/hardware/edma.h>. W. E' r( U& o
% y1 |8 F8 x+ S l7 a- #undef EDMA3_DEBUG7 w7 h% m# m' \6 ~0 o9 _# x# E
- /*#define EDMA3_DEBUG*/5 G- ]! |8 f- I2 r3 H9 y0 s1 V
# J* I' C/ x2 u e0 x- #ifdef EDMA3_DEBUG
6 U7 v" d- Y V2 b3 I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* [% w* A4 M1 n: @+ G! a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 q6 t- |% q! l0 p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ A& |" m0 U$ y0 B2 m1 M - #else8 X# c! g" e3 d( x9 b; w
- #define DMA_PRINTK( x... )& e9 p: e2 j8 G+ ~3 t
- #define DMA_FN_IN) m' s- A* G( Q# W2 F
- #define DMA_FN_OUT5 x X. E' v, Q/ f
- #endif
. Q- d- ~: o' M5 I
7 b: e6 j4 t1 m" w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. {. l" p6 K4 ^! I - #define STATIC_SHIFT 37 m, S/ m3 y8 d# Z
- #define TCINTEN_SHIFT 20/ j9 @9 [2 \6 z$ J( W
- #define ITCINTEN_SHIFT 21! n' x3 A0 g, [8 b4 `
- #define TCCHEN_SHIFT 22
' m$ Y: @. {, D5 } T - #define ITCCHEN_SHIFT 23
8 N: N9 _ I+ p5 A; ~2 [" y* E
; v0 l2 r# r1 M& g- static volatile int irqraised1 = 0;
1 T/ R o5 b5 H3 T - static volatile int irqraised2 = 0;6 d2 u$ l0 `! I7 w) x
- ! l: l: N5 G+ ~, s" y% q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# X4 j% q0 \; u* q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; S# V+ L1 [0 ~. L+ o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( N0 V' W# s" v2 r0 l
- 7 N4 N* o- W9 @8 [2 P/ t8 g
- dma_addr_t dmaphyssrc1 = 0;' R' V/ f; j \: s" ^+ O2 ~0 J7 g0 o! ^
- dma_addr_t dmaphyssrc2 = 0;
5 e- r5 u4 m* }) H+ a" E7 R - dma_addr_t dmaphysdest1 = 0;
. G/ e. t: t( G9 v4 u% H9 y - dma_addr_t dmaphysdest2 = 0;' q8 b- o1 F; W& x
' m' Z7 G4 M* e# d- char *dmabufsrc1 = NULL;
$ d! o1 M0 W& M" v& E( L2 r - char *dmabufsrc2 = NULL;
) V9 F) x5 Z! I5 A2 s - char *dmabufdest1 = NULL;0 _+ o6 y3 M% s3 n
- char *dmabufdest2 = NULL;
k, m% g' y0 i& \4 o
" w" j2 P4 B$ ]3 ]- \- static int acnt = 512;
( q1 G; z& k$ D$ U+ [! }" w - static int bcnt = 8;( {7 J& S ]: B
- static int ccnt = 8;
; U5 F9 @7 b5 L! t+ S2 w/ j6 ]0 [1 j - 9 c T" z0 `3 [" T
- module_param(acnt, int, S_IRUGO);
0 s7 ^0 R. d N* }; L - module_param(bcnt, int, S_IRUGO);
1 D% r/ e, L: b - module_param(ccnt, int, S_IRUGO);
复制代码 : |0 U' o0 x% R& @
! P. V, t+ S" S( t. h! X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 V1 b. X( x. M6 ^1 }( `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 J1 B7 r) v, s. u& z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 @& i& }* x: u# h) ?7 y: o( _. C8 \3 T/ M* J1 w
) r' {4 j' C& g7 d7 V7 v: w |
|