|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- z7 Y( {" i. z6 k- [code]EDMA sample test application
" @7 k( X$ f' W0 E) I - /*" ^5 z2 i1 _2 w$ e! @6 K+ `3 U
- * edma_test.c
/ u( h6 ~6 U9 R, ~/ E - *2 i) {1 L& P5 r
- * brief EDMA3 Test Application
8 P- h; K# W. e j% L4 _+ l5 g, { - *# X: `1 \- [+ p- l) |5 r& p( T1 Q
- * This file contains EDMA3 Test code.
' c5 y( K6 L& K* p& _ - *0 ]) h( o' k' y2 I5 v8 u+ S6 m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' ?4 ?& J9 `% ~+ W2 W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" l8 I& @5 W- t% j- B% C$ `+ S4 P `
- * TO CHANGE.5 v$ U1 ~4 C6 K9 A
- *
4 D9 P; O o2 e6 U' l- n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- A" X0 F! B# c. e, v0 K6 R
- *. ?# m d* O; L- r+ ^
- * This program is free software; you can redistribute it and/or# k; E5 {+ q. @3 A
- * modify it under the terms of the GNU General Public License as6 d+ N( S) H3 R; i% |) u& z+ ?9 I
- * published by the Free Software Foundation version 2.
$ \% S+ V" G3 p - *' t4 x! E8 ? N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: ^" L% P8 W7 ~
- * kind, whether express or implied; without even the implied warranty& Y" b) l; ?7 E$ K6 T# X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. m* t+ \! r: H$ _9 z5 Q - * GNU General Public License for more details.
$ k' k5 f F" f0 T6 t8 n* h' ] - */4 ^$ b5 h* C, @
w& E# @* g. T- #include <linux/module.h>; B. c" {; ~0 e) n0 ~$ B6 ?
- #include <linux/init.h>7 c) Y0 Y5 j: D" ]$ b/ v
- #include <linux/errno.h>
& E* K( h# l6 ~4 p7 N3 }. {6 a' h - #include <linux/types.h>
8 t" {7 Y: b9 c- Q9 E6 V! S - #include <linux/interrupt.h>; L1 a; B3 x4 ]! ]! J- T
- #include <asm/io.h>
1 S4 H. H* B5 M% s, M - #include <linux/moduleparam.h>
/ s" a* a/ ? k - #include <linux/sysctl.h> |9 l5 J; H: o; ^7 N2 I* q- @- X
- #include <linux/mm.h>
' M+ V' t3 m2 I9 U5 s& ^ - #include <linux/dma-mapping.h>8 T* d- d Z; R
0 \4 B! ^# D. O B3 i ?- #include <mach/memory.h>& r% a' d* `3 w+ k5 h/ y2 }
- #include <mach/hardware.h>2 [2 w/ [1 g+ S7 S3 Y; t6 x! `
- #include <mach/irqs.h>
$ M. ]( p6 C) z4 @% K - #include <asm/hardware/edma.h>
! h* ^" X; [( } - $ e( H% C6 n$ ~0 x) M" q1 @' Z
- #undef EDMA3_DEBUG# W5 \( t: ]1 x8 I
- /*#define EDMA3_DEBUG*/
M! O9 M4 C! F, |" \, e6 ~/ T+ ?7 w - : |3 ^) f0 D( q
- #ifdef EDMA3_DEBUG3 k5 N3 M' O3 ~1 D7 y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" Q9 F; e' }1 C9 ^# K2 j% a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' w% g) Y i m, \" r# N2 J X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- P; _; J; ?$ h/ R- a% K& D - #else) z* D% ]5 d: v2 ^
- #define DMA_PRINTK( x... ) C O& T' L; i+ Q7 D, ]5 [
- #define DMA_FN_IN
! i/ ^# M" w3 F, J$ p* Y/ c - #define DMA_FN_OUT+ }0 C# h$ P2 e' V; g6 l E4 y
- #endif1 c9 J u# s+ G3 d
- 8 r1 U: y& {' A+ T: w P4 n5 |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) s/ F6 B2 J. R4 `$ b0 v
- #define STATIC_SHIFT 3
, T- `8 V" W. f; u$ Q/ E5 K) V7 l - #define TCINTEN_SHIFT 20
m- V$ ~6 T- q+ a; F5 ~8 j1 I5 b - #define ITCINTEN_SHIFT 210 B* J- D0 P+ R! U
- #define TCCHEN_SHIFT 22
1 _( d# o5 ~' m! \* n - #define ITCCHEN_SHIFT 23) C _% p1 ]6 \- s; X) X2 ~% i" C
( b0 U q) q, I4 t6 N$ }- N& Q- static volatile int irqraised1 = 0;
: r$ S/ s& Y& |0 r% Q# Y - static volatile int irqraised2 = 0;
9 F# b7 ^1 p# P1 b8 a6 c - " C' E5 k: k7 @! A9 K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% K2 J0 ~$ o' V/ l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# y) ?, \& N8 P9 h$ s+ ?0 X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 L' C4 ~2 P0 Q" o
* i' s7 T- r4 y& r- dma_addr_t dmaphyssrc1 = 0;9 C: ^; b9 L" A2 u8 F% ~
- dma_addr_t dmaphyssrc2 = 0;! u% S8 _9 c) ]
- dma_addr_t dmaphysdest1 = 0;; ~& Y5 r5 X, D' E1 _/ B
- dma_addr_t dmaphysdest2 = 0;
# {0 T! |1 U2 T- W; F: C2 f( W& ^ - 8 s1 j, R" l1 B8 r/ r% Q6 u! c4 A
- char *dmabufsrc1 = NULL;
/ ?, p% h1 N- d, K: G4 o. L - char *dmabufsrc2 = NULL;
; p. o }4 z$ q8 n. q( _ - char *dmabufdest1 = NULL;& z0 v4 f! e# O' y4 v
- char *dmabufdest2 = NULL;# i* O+ N1 x% V
- # {- ]0 l$ l% {1 h* ^" r
- static int acnt = 512;1 D( B- S5 @/ ^% {
- static int bcnt = 8;
+ S: Y% }: s1 m" ` - static int ccnt = 8;- }' K1 [8 ~1 I) j8 Y
' I" F+ |2 Q4 B$ b- module_param(acnt, int, S_IRUGO);7 D2 N" T, g x2 H; [5 B- Q
- module_param(bcnt, int, S_IRUGO);
: z! P, U3 Y# W- K, Q& M - module_param(ccnt, int, S_IRUGO);
复制代码
2 |) \+ i/ R8 O" B( g; O( _9 U+ s( D5 ~; ]: s! [ S) _. b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 \5 O3 q7 h Z' f6 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- O* d6 p, r8 J# `1 B5 u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) z$ {% A+ @( n! j6 g$ y- o
" F$ K! W5 @ z4 Y, J# ~
$ l3 D0 M8 s; H$ K" W Y |
|