|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; R, Y6 C6 |% E9 B- c- [code]EDMA sample test application
# L1 p; y# C+ Y( o, H% ]+ k1 y+ e - /*
- W! K& D# l' e) S9 f# }9 r" L - * edma_test.c6 J2 N3 V( U/ b* L& A
- *& Q' _ Y: v, \) @! n
- * brief EDMA3 Test Application5 [9 `/ c/ o$ R6 p) {! u
- *
5 ^! B6 o M' Z7 g# p3 v - * This file contains EDMA3 Test code.: U3 f3 u, Y. Y8 B+ ]
- *1 }3 p9 I. z m) p. w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ A) A) |7 X, P5 j7 Y# p+ d9 K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% l6 @ `; r, ]0 {- S! c/ }8 i
- * TO CHANGE.) y" F+ {% Q- ?% M$ o7 B7 t* m* W
- */ A; T. G4 [7 F4 F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ u( |$ c, X6 _: j+ [ - *
8 Z" e& R1 K( B; {$ m: m - * This program is free software; you can redistribute it and/or
/ A' v5 v7 k# U$ y - * modify it under the terms of the GNU General Public License as+ ]+ N; P3 ?7 }! t; A' U2 _
- * published by the Free Software Foundation version 2.. P) |( f1 a' D) [/ W& e
- *
+ h+ m$ j8 h5 a; X# y$ M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" t: ?4 d/ d/ t m. \( j6 N" E - * kind, whether express or implied; without even the implied warranty
7 T" f: K7 N+ ^# K# a' @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 B" ^. z( x9 E1 J7 e6 |5 K1 V - * GNU General Public License for more details.
* e- [; |# R& g - */. P. L" K( p Y/ U, T: E
- 2 S: k \/ t; o
- #include <linux/module.h>
: P7 B6 Q! c. v - #include <linux/init.h>. z# B& x; H, o. `- R, h
- #include <linux/errno.h>! B4 d& v7 h! o
- #include <linux/types.h>
; M. M) n2 @9 T - #include <linux/interrupt.h>
1 }2 H9 d3 n3 [7 W/ `9 E8 J8 w - #include <asm/io.h>8 v9 o% I6 d3 T/ Z
- #include <linux/moduleparam.h>
- E6 L) ^& K" _3 z8 j; P - #include <linux/sysctl.h>
" i: B; ^9 }$ Z" R4 l1 Y, `5 l - #include <linux/mm.h>9 @$ w4 m# b( h; R7 I) R
- #include <linux/dma-mapping.h>
7 `, Y% Q Z3 H7 x9 J - ! ?! M0 [7 f3 d
- #include <mach/memory.h>( S# \$ C: G- r/ C! z
- #include <mach/hardware.h>
, }. Q5 x1 M; T1 x2 _( ` - #include <mach/irqs.h>* H8 Q% g5 t# k" ]6 J G8 h
- #include <asm/hardware/edma.h>- N$ a5 _6 I/ @' W/ g3 c& T# Z
- / `! A, F* S7 g# M
- #undef EDMA3_DEBUG
, u& r- v) `& ~4 c$ H$ |; Y - /*#define EDMA3_DEBUG*/- `. @5 |2 k6 V0 x* S
- 3 _) p$ P2 A. j- |5 {
- #ifdef EDMA3_DEBUG+ l& o% L: b5 }( S& [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 D; C, v) b+ [- l, Y$ B4 b7 \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# ~* Q! V, q$ E2 ^$ W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% x2 I/ a- e- ~4 ]! q
- #else' ^3 d# R0 a2 E- [4 G! E" T6 T
- #define DMA_PRINTK( x... )
) Y: c1 E4 P3 b6 m& J - #define DMA_FN_IN8 S( X6 G+ x+ ]# j( Q+ V6 e$ {
- #define DMA_FN_OUT; _: R3 B( y8 \2 u
- #endif
- X, m; E/ x V5 e0 ~
+ H! k3 Z) a' _% G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! U% [$ E- R9 B# K3 h - #define STATIC_SHIFT 3
0 m0 P, c" `; q. |0 N! d4 x - #define TCINTEN_SHIFT 20
" Z: a" I9 A6 W6 s' } - #define ITCINTEN_SHIFT 21
8 ^/ }3 O# L7 s: |5 A - #define TCCHEN_SHIFT 22
- _' `4 y9 F9 Q, R+ o - #define ITCCHEN_SHIFT 23
' T" G9 u4 }+ h7 s. D0 f - , T: U+ h6 q/ T- b5 S( S+ F k& S
- static volatile int irqraised1 = 0;0 Q0 t, J; M- g4 L* W' ]
- static volatile int irqraised2 = 0;
( l8 s- r" i! z9 w D
+ S/ u% b) h& A1 ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ f+ j- B1 J+ Z$ @& N5 [( C2 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 X# c$ M8 ]! g Y, y2 v3 A. D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: B; x4 P6 h+ \4 v
7 M: \9 n. m% Q8 n7 S7 W. X( T* [- dma_addr_t dmaphyssrc1 = 0;# ~: E( T/ g; c# O4 u. b
- dma_addr_t dmaphyssrc2 = 0;* |; G9 ^4 _. E* f1 N9 S4 J8 b9 t7 X2 F
- dma_addr_t dmaphysdest1 = 0;" O8 `" C; r" ~$ J# [, T5 x l
- dma_addr_t dmaphysdest2 = 0;
2 J- [; ^( ^3 r5 K
' b3 F3 y; Q( @- char *dmabufsrc1 = NULL;
5 Z- W5 ~ d8 D o - char *dmabufsrc2 = NULL;
( ?' c0 U; t% q1 ]4 x - char *dmabufdest1 = NULL;5 E e. T" Q6 L* U3 @. y
- char *dmabufdest2 = NULL;
4 B0 t* o* j% z# Z# d - 0 |3 ?. m+ S8 J2 t2 f9 _
- static int acnt = 512;
; [4 T5 Y* z( T - static int bcnt = 8;* o H% l7 Y% p0 F( l: D) o
- static int ccnt = 8;) A6 S) i) n7 l. e2 K1 M- R
8 Q4 D) m- S5 L& q4 H: h! M- module_param(acnt, int, S_IRUGO);& V( j& H, N, x4 e* p; F
- module_param(bcnt, int, S_IRUGO);
$ I0 P P/ N- {9 b5 B. _9 @ - module_param(ccnt, int, S_IRUGO);
复制代码
% q* [ F8 m" I6 q
* L0 ^0 e2 g! N# v9 e- { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, U# s, H, _4 M8 C& l6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 b9 k. j' A9 C+ w Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 B! J7 c; p n; Y; G; w7 X/ ~
" \9 O2 G v$ V) p: F" D. S: E) R: O: L0 K
|
|