|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 Y3 ] _1 Y) N6 g- k
- [code]EDMA sample test application" c$ o( a1 e( w' @, f8 ?
- /*4 S5 Q$ `9 `7 [. O. j' c3 R
- * edma_test.c, H: M: X5 S1 I3 t4 N
- *
/ v, F# P/ z( v6 d - * brief EDMA3 Test Application
" r/ |' Y9 L0 }. T9 D - ** E6 n0 P' U% D7 U
- * This file contains EDMA3 Test code.
/ E& L7 n* {# q+ b% S# F- [ - *2 N" o: o: ~( M* X! n; v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" x! L& q2 x# ^/ j; ~1 m; o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& h; S( j b. p3 [! z - * TO CHANGE.4 Z# g6 B3 Q. N3 F4 ?2 i: z
- *
) b5 L, T& w0 `/ r5 a6 R+ C. o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 S- E2 D4 w$ [$ W6 w; p# K
- *9 ?! t9 X7 X: Z K& n
- * This program is free software; you can redistribute it and/or( ?# x; u4 t4 M9 V6 w
- * modify it under the terms of the GNU General Public License as3 p {0 t4 V7 a) v& y
- * published by the Free Software Foundation version 2.- ?. m6 H) o' E6 ?) Z& |, ~3 i
- *
# o+ y% F; r$ i: c& H ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. |/ h( ?4 p6 b0 g& j - * kind, whether express or implied; without even the implied warranty
5 a+ r4 Y8 G! _3 d7 U# a1 ^: G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 S* t) Z- A4 q2 `6 q/ M) o0 J
- * GNU General Public License for more details.2 o9 o# K; O7 a7 E2 a1 I/ }/ l. H
- */
# h: P s% x6 O; \& J# c# B - & q# ^: e2 F! j2 w5 h/ y3 v c
- #include <linux/module.h>
9 S. L* q, I0 H4 r1 X& @/ V - #include <linux/init.h>
7 m4 W4 w4 n( _3 t - #include <linux/errno.h>
( }( |" _& f6 A - #include <linux/types.h>
: X+ |+ U; q1 X k4 ? - #include <linux/interrupt.h>! G/ b; c/ r9 ~: v* r9 e
- #include <asm/io.h>' k1 H8 q! G2 X, K
- #include <linux/moduleparam.h>" l% |% V" d' [( o: |) x, @6 [9 {4 T* t; ~
- #include <linux/sysctl.h>. H, i) l# F: @( y4 j" a3 @# g+ G7 J. x
- #include <linux/mm.h>5 s- o/ G+ W$ L( T/ e5 G2 r, R
- #include <linux/dma-mapping.h>
5 I- o2 a! Q! c8 q4 f - # q5 l) k1 F- _4 D6 t
- #include <mach/memory.h>, L0 G+ A. `6 z
- #include <mach/hardware.h>
; F: x9 F! c3 g - #include <mach/irqs.h># l; ?) s# I2 q8 T# r- O
- #include <asm/hardware/edma.h>
+ p7 S0 O; P n( E; t - % A8 r) e* u1 j# L2 l, B
- #undef EDMA3_DEBUG+ m, S2 x# ~3 U
- /*#define EDMA3_DEBUG*/
6 i# Z; z3 n1 A; x' U7 X# d5 \
- y) V- d5 R% l0 X- #ifdef EDMA3_DEBUG. j) F2 @/ u$ {) D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ ]. ?# W9 [5 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
G" r! W2 ]7 S0 v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 V1 l# M* j L1 A: W0 ~ - #else
3 i' N9 u* M( ?3 n0 i0 S# Q/ a8 D, B - #define DMA_PRINTK( x... )( n6 \9 J7 I5 k. [, ^8 ?
- #define DMA_FN_IN$ k7 c; V( C# [$ \
- #define DMA_FN_OUT
0 j6 y* A+ c& U' t( Q - #endif
, D {/ h: T" k$ w$ P* q
1 ^) ]; A% @5 D+ b; c: d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ e6 ^. b# _0 M2 w) b - #define STATIC_SHIFT 3# |) i5 p% Y( ^0 {' w/ w
- #define TCINTEN_SHIFT 20
9 ^6 [2 L d; W; i) Q3 a* L# y* l - #define ITCINTEN_SHIFT 21
* ^0 k; t, I7 I* @$ N5 h - #define TCCHEN_SHIFT 22- g# ?$ p7 a+ |
- #define ITCCHEN_SHIFT 23
9 s3 x/ R' j* d% P/ a7 }
4 O5 J' `( V& \4 o/ \- static volatile int irqraised1 = 0;5 ~# `( i8 g4 k7 [# }( q! G
- static volatile int irqraised2 = 0;
1 V* |+ x8 {4 w% w* a& C - 5 @$ H4 _; d9 k5 Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( G" ]$ e8 l D j( r$ y7 w) C9 h6 J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 m( E+ q6 n, I- h% o6 e. W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% i1 K/ u6 v# @- }* _0 r
, o# E2 }6 H) f# C+ _/ ^- dma_addr_t dmaphyssrc1 = 0;
' H- i8 f) b, N - dma_addr_t dmaphyssrc2 = 0;+ J' H9 Z7 }7 k" S9 b0 S
- dma_addr_t dmaphysdest1 = 0;
+ b- b* [' O2 j1 N6 O [4 x: e! z - dma_addr_t dmaphysdest2 = 0;
7 X; G, } [9 ~$ ^ x - ! M& s# Y. c7 L* P: M; j u
- char *dmabufsrc1 = NULL;
: I4 n: T: c9 T ~; B3 V, |1 X: i - char *dmabufsrc2 = NULL;
- _. g$ H$ J$ S1 t; L6 k - char *dmabufdest1 = NULL;; E! N$ |# O! a$ K, ^2 C, f9 O7 Q
- char *dmabufdest2 = NULL;
9 p6 ^) F) k6 m* m4 _. g - / Q7 m |+ K$ q- P" _# R5 c
- static int acnt = 512;
* s% s3 E5 H" l0 e- {" y% ~6 Y - static int bcnt = 8;
4 @1 V* B ]0 G1 ]/ W3 Q/ [# H! X - static int ccnt = 8;/ [* T0 E7 Y( Y. ?/ p3 g
- O- E- x" U7 J1 ^, E& r- module_param(acnt, int, S_IRUGO);
* Z0 M6 J, X+ I- J# Y0 Z' F/ z5 u - module_param(bcnt, int, S_IRUGO);
. m) }1 s8 v' z, m - module_param(ccnt, int, S_IRUGO);
复制代码
& b# K- m5 s/ S7 E1 ?# [- s0 @: c5 Z# k, z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 C2 |4 O& ?9 g4 D# x& _# U# b! d' Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 |, i& T8 h' ? ?. [) U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: x- z: ]5 K; R. _: P% @
- V; e5 v0 D- ^) ?8 g2 ?9 |0 s/ o0 A' v5 @ A Y1 ^) I5 J+ l
|
|