|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . O0 D# j8 S- P c4 Z
- [code]EDMA sample test application0 Q9 F( C" {% Z7 P
- /*! k& Z4 J% P' |" X- u
- * edma_test.c
' h2 Q' L, y' s1 v; N- U3 E( H - *0 z$ C d# z* ?3 J" n* ~3 }3 N, j8 J
- * brief EDMA3 Test Application
2 E; w5 i, I. p! ?" z1 W: H - *& P a1 Y9 d6 A4 Q# J
- * This file contains EDMA3 Test code.7 d4 X8 t3 N- p
- *
- [3 E* I4 @; t4 |# I' \' S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( j" ^$ `! B2 b1 A* E6 a$ N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" a, b: i% A" ?- v) C! h1 {+ n
- * TO CHANGE./ ~) n, d% g( `1 Y, M9 a9 {
- *
5 c7 \! X9 X+ P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; T' b: ^; I$ x9 I% G5 N1 m
- *: |7 `6 X1 p+ y
- * This program is free software; you can redistribute it and/or
+ V* y2 ]" {- U h# a - * modify it under the terms of the GNU General Public License as
3 |, J9 v7 }# ]& A+ u# O - * published by the Free Software Foundation version 2.4 s# p6 }6 O5 B6 S
- *, @5 \1 [; v, Z' ?* n# w7 x) \& x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ c+ j9 E$ V q1 c
- * kind, whether express or implied; without even the implied warranty
+ \. D: m6 s5 r j6 P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- M/ b8 I' j5 @2 r' f8 W( S - * GNU General Public License for more details.
2 `6 C) u8 i1 m0 ~ - */
( ` N+ ~8 ^% s' f L @# ?- T% B* t) T
% N% E& ^; E2 \5 F$ t/ P- #include <linux/module.h>4 l+ K/ R2 _6 {8 ~) i* G
- #include <linux/init.h>5 \1 W& p- {. `* X0 F9 x: x
- #include <linux/errno.h>9 k( w/ q, o7 e7 r$ y8 @
- #include <linux/types.h>
' R" N0 Q# W9 I6 _ - #include <linux/interrupt.h>
+ |7 ?5 [* K$ c# H; U - #include <asm/io.h>7 w7 n) Y! y' {+ y; q
- #include <linux/moduleparam.h>
0 }6 n3 H6 E! n% P5 O6 e" Z. } - #include <linux/sysctl.h>$ K- v+ R7 `/ G
- #include <linux/mm.h>
# w6 Q& s+ p1 O' ?: X/ M u - #include <linux/dma-mapping.h>$ L% _$ [ u8 X. X2 R, G, }
- 7 ^0 b, O- X, P6 \4 K' Q# z9 g
- #include <mach/memory.h>4 A/ q7 U, [# [5 T
- #include <mach/hardware.h>
8 f9 q t* Z7 ~: D7 ^5 I - #include <mach/irqs.h>
$ l4 i: F" [9 t6 i5 ?% m e - #include <asm/hardware/edma.h>4 @3 T' P# h' e* n
$ k2 T5 {! b: a8 a0 O# O/ V- #undef EDMA3_DEBUG7 A, T9 t# u8 X( ?: n
- /*#define EDMA3_DEBUG*/' h5 P' D m8 }+ y" U
4 `% u' U, x$ ~! R- #ifdef EDMA3_DEBUG
! ?! V! |- d2 t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 j. G( g# H$ f- I' s# M6 b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- v- Z. T) y1 b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 E1 E6 w7 h3 |
- #else
# b# O0 |/ Y G: G+ c - #define DMA_PRINTK( x... )
& Y y' O2 z5 a/ C$ t1 ` - #define DMA_FN_IN
" t( H/ x2 _2 ` W/ ~1 n, y - #define DMA_FN_OUT
# F, }, W# R N, O; r* m - #endif- U/ J0 w: q0 K
* _! `( f1 Z- y' G( O: d" G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- N0 z5 [$ }4 c" w2 e - #define STATIC_SHIFT 3( a; L& U5 V/ k- r- J
- #define TCINTEN_SHIFT 201 k) S# M2 ]& V
- #define ITCINTEN_SHIFT 21
5 ^& o* Q8 v% W% f - #define TCCHEN_SHIFT 22& ~1 d3 C7 R# X
- #define ITCCHEN_SHIFT 23
1 \* Q3 ~' n/ Z
' k3 f5 {$ U: X( ?' C- static volatile int irqraised1 = 0;
6 U) [ I- R* k' B - static volatile int irqraised2 = 0;
( c+ ^4 S0 a' c) Y6 n - : _2 f( o6 k# }! q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 I& z1 d3 `2 O' u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 R4 N& r1 @) `- T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Q0 p- A+ T7 j/ Q2 c9 K3 A
- 1 T/ M' U6 I( x& ^: Q
- dma_addr_t dmaphyssrc1 = 0;2 C: t S/ u7 S% g0 ^
- dma_addr_t dmaphyssrc2 = 0;2 p2 \& ~% u8 G8 z
- dma_addr_t dmaphysdest1 = 0;" P8 ?& l: W8 i* ?/ D1 f+ x
- dma_addr_t dmaphysdest2 = 0;4 p$ P+ o9 o( `( v9 ^
- ! p9 H5 `0 D: ^+ T$ J9 Y7 v
- char *dmabufsrc1 = NULL;
& p+ C! D* e; U' c/ Q. }* \+ y' u - char *dmabufsrc2 = NULL;
( n/ D4 w; d& j O& {5 k - char *dmabufdest1 = NULL;
/ l8 {/ s' c, a - char *dmabufdest2 = NULL;! g2 ^; x ~9 Q8 W
% ~: A2 Z: ^, A5 O8 t& ^8 p- static int acnt = 512;
/ X( `' E5 K; A - static int bcnt = 8;' w! h1 F& R/ _3 w5 d
- static int ccnt = 8;) ?* g! B* T2 L I" P% Z
- , p+ n+ F- P3 b2 k9 H8 n. l
- module_param(acnt, int, S_IRUGO);3 C* i* }( s5 _1 d7 O) L, @; s
- module_param(bcnt, int, S_IRUGO); O" D% N/ F4 ?4 V8 T
- module_param(ccnt, int, S_IRUGO);
复制代码
8 X0 U: z5 i2 d4 F+ Y& I. K
( D/ m' G/ Y) i0 x$ ^. \# n5 m# E! ]1 { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; U7 }0 R* i' L- p5 o! T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! }# h2 n; [$ I1 K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" L; S% ^4 X* o7 U1 R" ^! S
0 b: L! ?9 m% U2 r$ A) X0 Z7 D8 l. s
|
|