|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, W( J6 z8 v/ u3 f5 B- C- [code]EDMA sample test application7 V' F4 F" W: W+ M+ K7 f# w
- /*. ^( X. J# R' s6 c3 H
- * edma_test.c
5 j0 E; B$ f: o - *2 _0 s0 }* F# k9 x9 z
- * brief EDMA3 Test Application/ c; u! S* r/ a& \4 u; @
- *6 G6 i. I: o( T0 X2 E- U- h& ~
- * This file contains EDMA3 Test code.
8 h: z9 Q, V0 a+ c" _. M' N - *
: A/ W$ W4 {- L" O7 l4 U7 k3 v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 y1 c! `9 X- {5 c# N+ y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 s+ o2 M" _! y N$ r& u - * TO CHANGE.3 i4 N/ |+ A9 w1 `& j0 D
- *
) Q1 {; e& n5 e2 O# d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// K0 [ {3 V; }5 C
- *2 x4 T _0 U$ A1 n. M. u
- * This program is free software; you can redistribute it and/or
' W% \5 Q7 |( o; G; k - * modify it under the terms of the GNU General Public License as/ H3 o/ z* g0 Z! g0 b( S3 b6 @
- * published by the Free Software Foundation version 2.
# i5 z, Z- U, s8 Q: q0 l+ c& u - *( | _6 B, O( z J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( P% T& G5 c% d: ~% `& d
- * kind, whether express or implied; without even the implied warranty+ L. E. }( s8 Y; k+ f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ w" U- U t$ O - * GNU General Public License for more details.
+ C& l7 S9 E( j: h+ I- _1 L" I - */2 o/ a! y5 C, Y4 R0 o$ O
- 4 N# s: [0 {9 R& b# |, C
- #include <linux/module.h>' C- Y# j: f1 r; o* \
- #include <linux/init.h>
" w$ D1 a6 e3 \4 ]; F5 v - #include <linux/errno.h>
8 @. Z' r- Y$ c. X2 n# t k% n! u - #include <linux/types.h>
) Z& P) a$ l @! \7 W* M( a; l - #include <linux/interrupt.h>
# I4 S4 q3 _8 @$ j# G, r - #include <asm/io.h>
: q! t6 t$ [5 n' P; d0 e - #include <linux/moduleparam.h>
/ G1 L! Z4 G9 l& |- f( p - #include <linux/sysctl.h>
4 k9 }5 {1 G( Y& B% z+ t- p - #include <linux/mm.h>: C6 K% }$ u* @6 |* M
- #include <linux/dma-mapping.h>
: L$ I: Y$ p1 J7 K. q - 6 y8 r3 a/ H* K- w! s
- #include <mach/memory.h>0 F! ?$ q- }) ~% e9 c
- #include <mach/hardware.h>' v8 U! f7 l+ r. L$ C
- #include <mach/irqs.h>
) e' B& \! V+ ?) Q5 W/ U( U - #include <asm/hardware/edma.h>
# b- g4 t6 B1 U: y; t; U' K
# x+ c5 m0 x6 l2 _2 [' o4 ^6 R- #undef EDMA3_DEBUG
& o6 K, u/ j O' ?. V- s - /*#define EDMA3_DEBUG*/6 I2 p# g3 x% E4 \! E
- ) s* n/ ]) b+ t& Q$ A% @8 \# n
- #ifdef EDMA3_DEBUG
! }6 f" a: _# I* {3 b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 Y8 w; h# H8 x5 U) A ~9 C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) n/ j, y7 n$ j; g) ~) r! [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 Y: P! ~7 s7 E7 |1 A" t4 I. @' Z& n
- #else
/ ~3 T& O8 i0 Z - #define DMA_PRINTK( x... )
' f- l! Z! ]! d6 [7 ~3 ~+ w2 O+ n8 E0 L; v - #define DMA_FN_IN. l% ]3 c8 D" M' C8 x
- #define DMA_FN_OUT
t9 F6 s& y7 |+ q$ T" u - #endif
( _4 v7 m2 W( K; v* q( b' O
9 c+ h# t$ [0 k ~$ P. o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* P9 s' _# F) w, `
- #define STATIC_SHIFT 3
9 @( F' j8 ]- b; j8 a. d3 @' e - #define TCINTEN_SHIFT 208 N& t# X5 g' I
- #define ITCINTEN_SHIFT 21
3 s8 x) _, F$ {9 Q - #define TCCHEN_SHIFT 220 J8 d' R1 r+ J% A6 W, j
- #define ITCCHEN_SHIFT 23+ w9 o2 u8 k' d d
- # u7 y; p: C) e" W+ {
- static volatile int irqraised1 = 0;
+ T4 O) n; Q' l7 s* e4 h - static volatile int irqraised2 = 0;
+ v! ~4 s, h# @% r! V ~# y - - t# k5 ]. p' l* I9 G ?4 f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 T9 Z. W2 E4 I' V$ M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* I$ m9 V) q; k3 ?2 X5 ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# [9 u9 [; e4 N; l# L7 k
: f2 a$ u6 [+ L/ p6 _, g( m7 @- dma_addr_t dmaphyssrc1 = 0;
& @* s! d @0 v7 f8 V! f - dma_addr_t dmaphyssrc2 = 0;" X! _$ R! r' U
- dma_addr_t dmaphysdest1 = 0;
6 {/ d. i' |, U8 A1 ?! j3 M- K - dma_addr_t dmaphysdest2 = 0;
, L/ d( x3 v3 s- l2 a8 W2 b
! {; `* t; ]& O# \4 c- char *dmabufsrc1 = NULL;
: W% o5 V/ f) [0 g8 l# X - char *dmabufsrc2 = NULL;4 A6 [% e0 |8 N2 H
- char *dmabufdest1 = NULL;, S- ?6 s6 J1 Y4 l& P* F& _/ F
- char *dmabufdest2 = NULL;1 n; }+ E; ^ v8 p
- $ ?+ \+ d# s) h' c+ q6 Q: ~
- static int acnt = 512;, ?# V L6 A+ W6 L
- static int bcnt = 8;
4 U4 F2 G+ X! r9 b - static int ccnt = 8;
" m" u7 s' H" Z. D1 a- `3 w- J
4 K9 W& Y2 Z0 M- module_param(acnt, int, S_IRUGO);+ h0 [: W2 u# _6 d7 H, c* Z
- module_param(bcnt, int, S_IRUGO);
9 J! x6 }7 k' ~4 a* J4 V - module_param(ccnt, int, S_IRUGO);
复制代码
2 H. V. Q* ~2 j0 P$ Q& ]" i
0 a8 X% Y! n% m0 X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: F4 ]# Z- N2 t7 _. @2 I) Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* W! @! R. ^9 F2 h, w: N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 |, [/ _- a7 d& w5 T
8 w2 }' F% r! w& r* q( s ~3 |
3 E! Q8 n, \0 X8 Z$ q% t; u" r |
|