|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) P7 ^( @$ }4 n! T- [code]EDMA sample test application
0 Y) ^9 t2 K5 I% N" W- v - /*6 G) n* X4 B$ G/ c4 ~5 C& b4 k
- * edma_test.c+ i8 p d/ H7 m& G3 h* r2 F
- *5 i( I; s% |* T
- * brief EDMA3 Test Application
, [7 [5 j1 k0 p' p# I F9 e - *
! ]: j- u- a; H6 l( P/ M - * This file contains EDMA3 Test code.4 }* c4 P/ q8 i+ V+ k
- *1 v1 U! F8 Y+ f9 p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 f1 A0 T4 A5 H; F% B+ O/ {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; I0 B2 k3 e! H4 T* S9 d
- * TO CHANGE.' s, ^1 B' n! w5 X0 x, y/ B" x$ g
- *0 N: t+ U3 Q) t" @3 Z) w) p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 h' f" J. N, p4 k0 y - *' o% C0 V3 T* W0 j, F$ b: z$ a
- * This program is free software; you can redistribute it and/or# I6 h/ f' G( b% B# |/ M
- * modify it under the terms of the GNU General Public License as9 n3 T/ O, B2 X! Q9 r4 T
- * published by the Free Software Foundation version 2.- |8 p& U" g8 [7 v( u8 J* b/ T
- *+ ~( Q9 L- U2 B( U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any p1 A0 m% c4 u4 }2 e
- * kind, whether express or implied; without even the implied warranty/ n% H6 M; J }- e( U- M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 E0 Z0 g& p8 X8 H8 v$ E
- * GNU General Public License for more details.
% V$ w5 R. f; s% C2 i7 ^1 z9 J4 P1 Y - */
0 S* D* O. |5 i& T v5 C
2 G: S D+ S# v3 }. X; r7 }( X0 Q5 B4 d- #include <linux/module.h>. |" j' K- z0 C0 t+ u* V r; g( o. z
- #include <linux/init.h>+ p% a/ v4 s. N$ w9 N
- #include <linux/errno.h>
! Z8 l: u$ Y F, e( m8 Q8 I/ T - #include <linux/types.h>! o2 B8 _9 n5 N9 I) K
- #include <linux/interrupt.h>
# e" o- U# K( S; D! w2 N6 T$ \ - #include <asm/io.h>+ B0 S5 k9 ]( H
- #include <linux/moduleparam.h>' S5 r. {" e' I9 v
- #include <linux/sysctl.h>
0 i7 l% u3 x9 V' x8 r8 r% I$ E - #include <linux/mm.h>
& W: l/ ]- ?* `5 s' C - #include <linux/dma-mapping.h>8 q" ^4 ~8 G6 N- Q( g
; ^2 M$ z; O, A2 @) g- #include <mach/memory.h>
$ v; T; u, A2 I. C+ |; E8 g* E" O - #include <mach/hardware.h> a# p5 n$ K# g
- #include <mach/irqs.h>/ l# I9 f8 J, @$ R& u* L0 d
- #include <asm/hardware/edma.h>4 y# W+ \0 e. i1 x" N/ {# z5 P
* e% r, _& i- S. M) U, g( G- #undef EDMA3_DEBUG* g5 w" Z' N9 m# v8 {1 h! [
- /*#define EDMA3_DEBUG*/
- z9 T( {8 | D4 n. z7 @) \# m0 F - 9 Y9 l" e0 U2 @& q: e
- #ifdef EDMA3_DEBUG# n7 i' Y- Z9 A' P$ Z7 F- e6 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 \; s0 r. E7 x# n, M' Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 e" Q# C1 X& \2 U+ I5 z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. p, ]( M! U9 V1 u - #else5 a3 ^, g& w6 y# z4 a
- #define DMA_PRINTK( x... )
/ r/ I. f# q3 B. _7 a( u* h, x - #define DMA_FN_IN a; _# b0 Y9 L; @
- #define DMA_FN_OUT7 ~8 h3 R& y# e6 z" X9 H& t
- #endif) ` Q- ]& W. Q
$ A& ]1 A9 U ?1 A. I- #define MAX_DMA_TRANSFER_IN_BYTES (32768). E0 t1 h' g7 ^( }7 N* u2 w
- #define STATIC_SHIFT 3
& q% |$ j$ C( }+ k* x, _ - #define TCINTEN_SHIFT 20
0 O' j& v3 v- Z - #define ITCINTEN_SHIFT 213 j, }/ A" a* f8 \3 c
- #define TCCHEN_SHIFT 22& l$ l2 N7 q" {5 i4 J5 x
- #define ITCCHEN_SHIFT 23! b0 t. V! H5 x r5 o6 ]0 Y; Q& o% B3 l
- ; ^8 @6 n3 I: P9 F( `) {& _4 k
- static volatile int irqraised1 = 0;
5 ? O; F4 Y1 w* Y6 g* W( ~# D - static volatile int irqraised2 = 0;
! Y, ] [1 g7 e% o; w' Q- A) S - 3 U3 o( Z N9 D3 i# G6 O" O, S7 `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* H7 J R6 |3 a3 S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Z2 o/ r1 b1 Y, d* L+ i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' E' B* q+ d9 [/ n - 3 _4 w1 v4 e: A) u$ H
- dma_addr_t dmaphyssrc1 = 0;
3 B, U: N3 G' `; } - dma_addr_t dmaphyssrc2 = 0;3 o! R' \2 s/ ]# N8 R" t2 g$ p
- dma_addr_t dmaphysdest1 = 0;5 t! D- ^! [& V$ |6 m6 h6 [/ ]+ S
- dma_addr_t dmaphysdest2 = 0;6 q" c i6 T" p& h3 I
- # P3 `: Q3 j# k' f
- char *dmabufsrc1 = NULL;
( @2 o6 Q( P$ S. W* K - char *dmabufsrc2 = NULL; \6 _ E! D. Q u5 j
- char *dmabufdest1 = NULL;
d$ ]" z+ S' _( O - char *dmabufdest2 = NULL;5 v, M& ?# e7 G* a1 `' X, h
3 E* d" i% t) h, [8 o- static int acnt = 512;
' L0 s) {: k4 I, N - static int bcnt = 8;" k" k; V8 e z! a
- static int ccnt = 8;+ |9 Y; y. U% p* V
& [5 r& I+ @! g' S s7 ~- module_param(acnt, int, S_IRUGO);
3 h4 h: [ W7 @' P# ] - module_param(bcnt, int, S_IRUGO);
/ {6 {: ?- z% o - module_param(ccnt, int, S_IRUGO);
复制代码 ( S+ l) S/ J6 B) O5 Q
2 L5 ~! b4 F2 U* z* K* d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ q( P3 {+ c. ]% tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) m- J1 e$ B: Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- Z. x& g9 _/ l9 I. a9 }( A
( R6 F/ N$ l5 [+ o$ A$ L7 N
: }2 [7 ~# l3 D; i& W$ I# K& n8 }
|
|