|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( d7 A. P+ ~; F0 O2 Z) A8 K- [code]EDMA sample test application) O. J V; T. ]/ q0 y
- /*" C: {# y+ ~- j9 g! M
- * edma_test.c
( R$ E3 R+ O& z8 |1 U - *1 k$ W+ c R T) h7 t& |! D$ O
- * brief EDMA3 Test Application
! K# i, a o. b7 f) {* L" N3 B M - *
* ?4 T: s2 ], P5 [5 M - * This file contains EDMA3 Test code.
+ w2 C% U' ?. H k) b0 E - *
5 x3 N5 M5 V- E' U6 {1 h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 U f" [, O+ _; |( k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' O# o" H: L. L; ^
- * TO CHANGE.
E/ q1 E: `4 C - *. x7 i3 J& O1 M8 `8 I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) ]5 v" H% l4 h7 u3 M; w% h$ _- k
- *$ T: o l0 p4 l
- * This program is free software; you can redistribute it and/or
0 K# x: A V8 _( N- P - * modify it under the terms of the GNU General Public License as
4 e4 O" E% b: S( [% t - * published by the Free Software Foundation version 2.
# r" T! t& e, M2 o9 @- d5 J, H - *
- I8 @' a, s$ G8 [. P O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 S5 X" H, C% n, M7 T7 i
- * kind, whether express or implied; without even the implied warranty
' c4 e4 G( ^8 [. O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% e: Q: A/ d/ @2 g8 `. J3 t# z5 b - * GNU General Public License for more details.; N5 @4 U0 [1 |# M, b! G
- */$ R# P- }; |+ L& r; p! I% i5 j2 Z
- ! ?. ], J, |( @ R! b/ `
- #include <linux/module.h>; N' n- a, C. z& m
- #include <linux/init.h>' l2 K2 Q4 |. \2 _
- #include <linux/errno.h>
3 i0 Z) c3 `6 S - #include <linux/types.h>
' N7 S1 T: I) G# e7 s+ }3 g9 X7 y - #include <linux/interrupt.h>
+ ~, ^; E: u! a6 S6 ` - #include <asm/io.h>
: V( K3 P! O( X5 } - #include <linux/moduleparam.h>+ F+ G) h. d/ k/ A" C( g7 |6 i
- #include <linux/sysctl.h>
9 l1 p0 L* F) S i+ {# n$ r" V - #include <linux/mm.h>% {' t: }* n2 P! J' Z* [0 y
- #include <linux/dma-mapping.h>
+ c$ G$ o+ ]& b& j
1 J% S- v/ c" Z. h4 @- #include <mach/memory.h>
5 T7 b8 x& E- n2 K" ]- \ - #include <mach/hardware.h>$ _% k% E6 v) J* y% J
- #include <mach/irqs.h>
+ g) V- J! I; k5 X - #include <asm/hardware/edma.h>
) n, b& ?1 O) N - % U" M" q( L* R) y
- #undef EDMA3_DEBUG/ [( a# D0 G! d3 m7 c
- /*#define EDMA3_DEBUG*/1 [% Y: q7 g9 X+ W+ P2 m
) |2 q: a: L* k* V- J6 p- #ifdef EDMA3_DEBUG9 A+ K2 |( @2 O7 @; ]- E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. V, R& E Z L/ k0 Y$ x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: W5 b% Q z7 a) P: U& O9 f$ h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 [' y0 V2 B$ [. v, X) D6 W
- #else. a9 {- B9 K$ k: }+ R
- #define DMA_PRINTK( x... )
: K. W2 G, j1 j% }4 _ - #define DMA_FN_IN& U! y7 _5 ^# @2 A" q5 ^
- #define DMA_FN_OUT
' i( i e+ S: `' w. T( W9 W - #endif$ G" L+ J# @) z9 g0 Y8 T P' p
- ( Y& a8 X! \6 B6 f! ?: ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' O% | \) z j - #define STATIC_SHIFT 3
0 l2 g- f) [' `4 q - #define TCINTEN_SHIFT 20' {$ Z9 \% Z* h; C( ]; u9 H1 h
- #define ITCINTEN_SHIFT 21
' a% x1 A( |4 U0 Y6 H# I$ C2 H - #define TCCHEN_SHIFT 22
) M% x! `: Q8 V. x - #define ITCCHEN_SHIFT 23
+ L9 J& h+ F1 u7 c. f - : _3 g+ S( D: @) C+ j
- static volatile int irqraised1 = 0;
8 c& J! D1 K8 c* t) ?8 X8 Z$ e - static volatile int irqraised2 = 0;1 E. t5 T g! C/ |7 A6 ]
; N; I4 X" D; x" l$ f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ ~1 h9 W- y4 ^0 B1 Z& ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% g8 c3 Y6 d; q& E! e& o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 k: I! w: E. {6 e
- & h( |" X2 r, R- j% P/ Q' H! U
- dma_addr_t dmaphyssrc1 = 0;$ E: t5 X3 s/ e& n: X# C
- dma_addr_t dmaphyssrc2 = 0;
, `( g: v0 S# v - dma_addr_t dmaphysdest1 = 0;# N1 M$ r/ f) Q
- dma_addr_t dmaphysdest2 = 0;. F8 j$ S+ H% A0 P
$ f/ Q4 e- k6 \+ |) ~- char *dmabufsrc1 = NULL;5 o+ d( y6 j7 w8 | ]& P
- char *dmabufsrc2 = NULL;: o0 A: V D v3 F" E
- char *dmabufdest1 = NULL;
% g0 l+ M \0 Y; W4 F4 f# L - char *dmabufdest2 = NULL;8 z) u/ N3 b! r" M3 ~' C8 X
, | E, }- G6 E# g, w- N6 l- static int acnt = 512;
$ A L4 w: q4 X - static int bcnt = 8;0 g& o+ l9 }. @" T/ t
- static int ccnt = 8;
& b# c1 D' L2 g! u. L
% T# |4 _& O P P+ W- module_param(acnt, int, S_IRUGO);
, t+ ]# ^0 {7 c7 i7 X" A5 B - module_param(bcnt, int, S_IRUGO);9 p' J6 p, {( O1 O e
- module_param(ccnt, int, S_IRUGO);
复制代码
# Y+ s; k- u% \; x: f, d& A* ^& s$ |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- t$ w5 ^1 o5 N8 L+ B' x, `4 parm-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% {5 s& c6 e$ J4 i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: V1 V/ Y) l+ _0 b, o3 |6 O8 X" ]0 a$ n, f! D! W$ W$ s- o# G
. e" u# l5 S) O5 G. W1 R
|
|