|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
Q* r2 ~2 F: V g- [code]EDMA sample test application j2 c0 \5 a" E2 R- o' G9 P
- /*6 r3 r( F( t4 \2 h, J8 f* c3 R, O5 f3 O
- * edma_test.c) C6 H3 l" {# _3 s) D
- *
& ]: D' C/ z' H; {) A - * brief EDMA3 Test Application" X+ w8 v' |( i+ N
- *
4 u, Q$ Q; r# |8 v& m9 N - * This file contains EDMA3 Test code.
4 F" _. y) t+ k. _4 f5 q9 v& }8 W - *% r5 `9 e0 P1 w* O2 V; R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 u0 _" _' N" C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: k0 f0 i. r& K( W9 V
- * TO CHANGE.
& x6 r d8 R9 b# h+ l( L - *
3 [/ o7 K3 b$ X' C9 [. c: {) M+ A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% U5 M' i) R0 _- \: I2 O! a7 e
- *; b3 @: @ L/ w) v
- * This program is free software; you can redistribute it and/or8 b# }2 {1 h/ g3 F* @7 g
- * modify it under the terms of the GNU General Public License as$ D+ D9 Z" |0 h' }( U" x
- * published by the Free Software Foundation version 2., j* P! w, C0 Z, y
- *3 X/ ?- }% B6 i9 p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' ], W2 P4 T7 {5 ^$ N - * kind, whether express or implied; without even the implied warranty
8 @/ R3 {% g g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# ]; T& S. P1 S& o8 l) ]- k
- * GNU General Public License for more details.( ]! E5 P# V, T0 E9 z# e
- */0 I( x& r; C% H* t( G R
- 5 g7 f6 n! Q' Y9 x2 g4 N
- #include <linux/module.h>
7 w4 |- v6 d) I) h+ I* [) R - #include <linux/init.h>: Z* Z3 X4 J2 G7 H. j, u
- #include <linux/errno.h>
1 v( x0 Q5 X* [( }& ^ - #include <linux/types.h>1 s: ^7 i2 D% A8 }% q7 Z) g
- #include <linux/interrupt.h>: Q W8 v S' W- a- k5 }3 C4 u) _
- #include <asm/io.h>: L9 D9 c4 V9 |
- #include <linux/moduleparam.h>
$ ~5 g5 W6 l+ y3 O - #include <linux/sysctl.h>
1 ]) O) S" S0 O4 J5 ^/ o - #include <linux/mm.h>
1 E( C, g. K1 K4 T - #include <linux/dma-mapping.h>% M" d/ Q, S# V0 b- h
+ ], M3 \9 O @- #include <mach/memory.h>. G! G" X6 O; E+ @. A2 h2 E0 \
- #include <mach/hardware.h>! U" A6 d8 l1 |! s8 k" {. Z1 \: Q, N! e
- #include <mach/irqs.h>
- L& {! T& ]9 s R/ X9 D; w: g% U( N - #include <asm/hardware/edma.h> @( [3 J- G% q& |4 }8 x/ A
- ; x c( m1 k3 Z! u/ p6 _' l- J9 x, Y1 V
- #undef EDMA3_DEBUG5 f0 K+ e3 K& C7 |: o2 |
- /*#define EDMA3_DEBUG*/
3 j5 k; k1 }; M& s
( D% T2 \0 i/ J5 u7 E- #ifdef EDMA3_DEBUG
3 ]- g4 ?' k8 ?" \& d3 s" ]. Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* a% `! }/ H6 m8 c7 u: t+ | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 T t+ h7 c# y; _; S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): q8 y- o, K S, Q
- #else
7 A& y8 Z! J) f+ Z" K - #define DMA_PRINTK( x... )
; U& {. D7 G% { - #define DMA_FN_IN
; }& X2 K) j4 D" s# u: j - #define DMA_FN_OUT
% |. v- W8 \- @/ r: k+ k - #endif
& p+ x" @" F) E h - 3 ]4 X$ _: i' x, t) _5 Z* T" @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) k& ?5 H# x' y - #define STATIC_SHIFT 3$ a5 k. o v+ X$ G# C
- #define TCINTEN_SHIFT 20
* X7 m! R. D8 T: o - #define ITCINTEN_SHIFT 21( r% `6 d; p5 j% o7 E) s1 z6 [
- #define TCCHEN_SHIFT 22- y0 E% F5 ]: e: ^0 w/ J6 x, @9 |
- #define ITCCHEN_SHIFT 23; g0 c; _4 v9 x4 o* v5 u
9 |% z; [4 f. K5 c9 `. u8 [- static volatile int irqraised1 = 0;
# F/ A- g. E0 p0 y - static volatile int irqraised2 = 0;
0 R" T! o1 c+ U6 ^) ~& P
6 h& r: R2 O& C& D( \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ k E- ^% d4 j( w% H- H1 d0 k3 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ V6 m# S/ A0 W4 ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) u0 i! K* [ P; y$ [$ x- ]
- 2 J# | R: g' O a& X5 i" G
- dma_addr_t dmaphyssrc1 = 0;5 v; c3 L$ m9 x6 p5 [/ P
- dma_addr_t dmaphyssrc2 = 0;9 A% d0 m; n; e% d6 E
- dma_addr_t dmaphysdest1 = 0;7 I; v6 E3 Y1 j, n6 F) p6 m$ i
- dma_addr_t dmaphysdest2 = 0;% C- k" u5 w; w& M$ w' M1 Z
2 ^: c- C6 X# g1 n+ w$ U- char *dmabufsrc1 = NULL;' C& O7 F \) B; _
- char *dmabufsrc2 = NULL;
6 O" v7 K) J: ^- G - char *dmabufdest1 = NULL;
! F- p8 C' H( Q6 D% L - char *dmabufdest2 = NULL;+ r% a0 f5 T( Z6 N
' U9 y: S+ g3 ]! E' ?5 d3 T/ j- static int acnt = 512;
+ A S+ U2 u |& L* p; z - static int bcnt = 8;( x4 k* c7 a! w7 l- M2 m6 M# N
- static int ccnt = 8;
) o! e6 [( O n" Q' L9 B, l# H - 0 [( d w( Z! C; i I8 ~: a
- module_param(acnt, int, S_IRUGO);
" A O6 F& [0 X& l; i - module_param(bcnt, int, S_IRUGO);
2 U. B' R% W9 \% B& H& r% W# C - module_param(ccnt, int, S_IRUGO);
复制代码
8 y$ E. Z# T' E% ?& T' ]/ W: _2 I* m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' }" ]9 E3 ]* j% m7 X n) w; aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
G; d& ?% E; [ r, H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 P/ A$ L% V5 W8 i, z
( E3 b* k" O# \/ ]- b) o9 `2 p) X7 Y7 O6 h9 t5 ~0 e
|
|