|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 F; A: d8 Z, X, F6 w: T: O+ T- [code]EDMA sample test application9 E" Z8 w" s" ~
- /*
& E' F% V d/ }. ~ t - * edma_test.c5 X1 s6 U# p6 k$ Y+ p, I- |+ r$ @8 D& F
- *2 s4 K4 \1 X* p* ?* f
- * brief EDMA3 Test Application1 c2 N$ c8 U' k! _
- *+ L' L. D4 t6 E
- * This file contains EDMA3 Test code. K }/ S* x. v! u2 ]8 \6 m. @, _
- *
2 a0 s( z- m! m% @9 v* Y7 b! X6 a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( Q4 T' C; }0 P& y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, S4 ~2 M) J! ]0 i! B& F% Q
- * TO CHANGE.
7 v: j3 Z) ~, @& U$ \6 a- a" P - *
# }4 X t: r# x$ y# e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- a& I# A# m' I& a2 p - *% u% q1 H7 l3 b( s* W" G7 f
- * This program is free software; you can redistribute it and/or* O2 M* L/ i9 k+ D, F- D* _
- * modify it under the terms of the GNU General Public License as; z; a# k0 ]9 u8 t; F
- * published by the Free Software Foundation version 2.' U7 H6 @# L8 L+ X. Z( e4 V, S/ H
- *! g1 W( h% o! J& ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 E! p/ e2 N( `; D( V
- * kind, whether express or implied; without even the implied warranty B: |+ `& O7 n4 f* B% t% F- L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: `/ b: T; v0 d% f; f, D3 X - * GNU General Public License for more details.
# h7 c z$ r) J* Y" X) Q - */
( ~5 R q" e. y7 @9 D/ i5 B - 2 I: H5 X6 E, g1 i% N
- #include <linux/module.h>+ b5 y7 H& [0 h7 x3 n' B
- #include <linux/init.h>
' x I/ k. a: N$ w: d% T9 Q5 Q# c - #include <linux/errno.h>
- x Q- H6 y# t5 X# M - #include <linux/types.h>
9 W$ a! W: p( P7 Q: |$ C - #include <linux/interrupt.h>
e7 ?; ?& f9 |& ?; v: \ - #include <asm/io.h>
; ?) O' e3 h3 e* f; [7 z) n - #include <linux/moduleparam.h>
8 T6 e, s- V5 j$ D - #include <linux/sysctl.h>; U/ J) L8 l- J0 X
- #include <linux/mm.h>( @$ F1 g1 Z, E) U! {
- #include <linux/dma-mapping.h>6 H, }: f4 ]. Z8 j9 y- p; z3 l
* _+ R- i: I. l( k. y/ B l' W- #include <mach/memory.h>9 Y9 q0 {5 S6 V$ R0 R7 I* @" r+ n
- #include <mach/hardware.h>
2 e' _& b+ a I5 z: w4 P - #include <mach/irqs.h>4 `9 b8 D# `9 b# h8 I. y: C0 T
- #include <asm/hardware/edma.h>1 \' G6 \* R, \" y* c5 t4 C
- * ]; a2 b- z9 Z$ }2 }: U
- #undef EDMA3_DEBUG
' ^9 K* ~/ p1 Q2 r# D - /*#define EDMA3_DEBUG*/
" U) g6 f: }) t6 s( Y9 j
; P, a: `+ {+ c. \- #ifdef EDMA3_DEBUG
9 U0 u# z* O4 d# V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) N% A) q' F. o/ V1 `9 N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 D3 r' z* |) V; ~6 z/ S4 o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): \7 C0 k7 v, U2 s1 T% X5 q
- #else
9 G$ G( E# {- N; l - #define DMA_PRINTK( x... )
" d' c6 K# j: D; [3 ]' N - #define DMA_FN_IN
4 R- ~' _& a; @6 e2 d8 p; g - #define DMA_FN_OUT [' K; f( N2 B2 S
- #endif
s0 ~1 _! u/ q9 h, u5 M
$ K# I7 \ b( c# ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 T) i& Z1 k6 Q - #define STATIC_SHIFT 3
7 _7 B! _8 {0 t, Y" K - #define TCINTEN_SHIFT 20
6 K4 J) H5 ]3 T. F* h, r0 f8 q5 t, i - #define ITCINTEN_SHIFT 21
' r3 i: W- H* P: P0 g - #define TCCHEN_SHIFT 22
# l, @/ X9 @/ ^9 `! r9 j( d7 O W* l% H - #define ITCCHEN_SHIFT 23
7 Q, W7 y7 F6 K! i
6 H! n; e0 d V7 q, v& V* X8 v- static volatile int irqraised1 = 0;
* @5 m7 o/ L$ S, @, V& H - static volatile int irqraised2 = 0;
% h! ?8 X0 x6 x# p
% W: q( J3 K k# j$ C( J1 R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, p. R7 E. c8 }( D1 w& ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 f- M T3 I9 } O$ b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! Y2 |; W$ ? G; @: M - 4 f7 H3 j- \( `: V
- dma_addr_t dmaphyssrc1 = 0;9 K. t% b, d7 w$ {: O/ Z6 t
- dma_addr_t dmaphyssrc2 = 0;
/ X* [& _7 t6 i1 q - dma_addr_t dmaphysdest1 = 0;7 K( m! x3 f5 G- a& P" C- W
- dma_addr_t dmaphysdest2 = 0;* O/ H! e: k7 d7 a
- ) n7 S' v& N% f
- char *dmabufsrc1 = NULL;5 v# M4 M4 L% T' _* U! |* x
- char *dmabufsrc2 = NULL;
- v8 H& B6 Q- u( l7 P1 w - char *dmabufdest1 = NULL;, I6 E5 [9 O6 B' ~6 o8 u p- P% }
- char *dmabufdest2 = NULL;' c& D2 E2 ^& P6 M `. U
- i1 S) c6 T/ E/ T, y" |- static int acnt = 512;- f- P6 T$ w6 d3 {5 A* n
- static int bcnt = 8;
: R6 _, r5 J9 W' B8 a: n8 X/ O - static int ccnt = 8;
# h! p! E; B q4 a3 Z$ E8 P - 4 L& R }9 Z9 Q
- module_param(acnt, int, S_IRUGO);% @/ u5 z* W z* @$ G( q
- module_param(bcnt, int, S_IRUGO);: l, Q& d$ ?8 u7 s2 j! d6 a/ j( O
- module_param(ccnt, int, S_IRUGO);
复制代码 8 y9 z8 r& A! V% d1 ?, D. e3 @
5 t1 v3 a# J' O& Y7 B1 J! K$ v [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 k; k/ I/ q# r& m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ l/ R3 A& ?3 m4 ?6 `6 [5 | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 n: V% A; ], d. G) J }
+ }$ D3 r+ W3 A; H' ^0 U1 J: u0 B$ [! L3 p
|
|