|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ~7 q" M" L! }& K, E% p$ ~1 ]
- [code]EDMA sample test application' A6 z. F) B5 f* Z5 c" K8 D( U* A
- /*
! ^7 G, e; q, Q/ E - * edma_test.c
+ I# f: |5 [ H- s- C - *
9 r9 r' y. A5 }8 l$ c6 L5 f - * brief EDMA3 Test Application/ W7 y ]. H' X) f, C
- *
$ g( k; Q( _2 Z8 ^ - * This file contains EDMA3 Test code.
, L, d1 ^ Q/ m* { - *
, f% T# M" ~9 K8 L4 L0 T$ _& d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ ]: H+ S, y2 I, b3 c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) h5 v9 s; m w$ U' ]4 `( N ] - * TO CHANGE.
* Z* P6 y* c. [$ z. b# ~/ w - *' K6 a3 ]4 Z/ s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 q( |/ C$ D! s' b/ t4 k. d - *
+ m# B5 M% h. G: m( c1 e - * This program is free software; you can redistribute it and/or
* V0 E W. f5 N4 I6 } - * modify it under the terms of the GNU General Public License as4 x' Z4 G, d3 D6 V _! [
- * published by the Free Software Foundation version 2.0 J# U& @: J1 ^& u
- *; s& {3 P; c7 T" {5 J# s9 a; d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 R' S" K& q0 m
- * kind, whether express or implied; without even the implied warranty
# Y0 Z" I8 V0 v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ X; U. @$ l+ Y2 B6 d
- * GNU General Public License for more details.# a1 \( T) D2 o8 |
- */3 V/ x4 t* m; x1 ~& H2 Z* x
% _0 T! O3 z2 w. j- #include <linux/module.h>
: C0 ]; @/ T" ^, q - #include <linux/init.h>
0 a6 a6 q0 `/ E9 V. ?: ?# ^ - #include <linux/errno.h>. F5 Q ^9 O5 s0 e6 r B
- #include <linux/types.h>2 o2 ^* Z! I, c- V
- #include <linux/interrupt.h>
. B! u; [( v5 n - #include <asm/io.h>
" Q2 R1 q& x6 I - #include <linux/moduleparam.h>
( X9 S' U% n# C5 c1 v+ d - #include <linux/sysctl.h>
; v9 {, w/ u" U# x" P - #include <linux/mm.h>4 l4 R$ j/ |* e! ^
- #include <linux/dma-mapping.h>! K z/ }9 x% |5 p
" y4 B" b+ I' e3 V- #include <mach/memory.h>3 ?3 p% [! D- L1 C8 N, ^( H# L
- #include <mach/hardware.h>
* z9 D. J+ F/ n- T# n+ s" m9 L - #include <mach/irqs.h>: U4 a9 b* T5 p$ m8 f! @; n& i
- #include <asm/hardware/edma.h>/ B* f% G4 w5 C
- 4 S% L0 [/ E+ E- V6 |( X3 N! q# T
- #undef EDMA3_DEBUG! s, g+ ]8 k3 b# ^1 B; b
- /*#define EDMA3_DEBUG*/7 p, A6 j- ^$ z$ E; S
% N! d# `4 w( d2 d, j- #ifdef EDMA3_DEBUG
" Z5 l) q. @3 O9 ^) Y& k. H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); ?* j4 \, ?/ ]' o) n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ [6 X7 j/ P! H& y' e! x1 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( J$ o% `3 }/ }- c - #else
+ Y5 n/ s' \5 q7 P$ A- `) p - #define DMA_PRINTK( x... )
% Y$ f) q- [. {' W- G - #define DMA_FN_IN( X) i# _2 M5 M
- #define DMA_FN_OUT
$ r3 l5 {: j' {/ l - #endif
$ Q3 h! @5 m9 }+ ~
( S F6 z" H$ x7 F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- k2 t/ B& F9 D - #define STATIC_SHIFT 3
! w! w! v- m* k - #define TCINTEN_SHIFT 206 H! I7 \! k: c
- #define ITCINTEN_SHIFT 21, i, o6 _0 D N
- #define TCCHEN_SHIFT 22
, X4 p- i& O& l; M# X2 R - #define ITCCHEN_SHIFT 23; \; V- |& ]9 r& [/ c0 ~9 m) l' ]
- / {3 G% N2 U( ]) l3 B
- static volatile int irqraised1 = 0;
' c) R, H) g& w f - static volatile int irqraised2 = 0;
( J6 [( m* ~) q8 x
: K. O/ }& I- W0 d( @/ @% q3 f! Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" @2 H+ J! X4 I4 J0 E/ a8 [% M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 d0 Z$ t! Y/ t& f# g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 M4 x9 j" S# s0 M5 F9 t
- 5 q+ m0 A- e9 ~4 C* m! F
- dma_addr_t dmaphyssrc1 = 0;: {, h' Q }8 M! x
- dma_addr_t dmaphyssrc2 = 0;* i* D/ y$ \8 j5 l5 [
- dma_addr_t dmaphysdest1 = 0;! g9 m0 `6 A7 ], M. T
- dma_addr_t dmaphysdest2 = 0;. A4 V/ A( S7 ^1 }! g: g) W6 _
1 C# i1 J9 x( ]& L, H0 [/ \; X" q- char *dmabufsrc1 = NULL;" N, {# z! i5 q6 _* x
- char *dmabufsrc2 = NULL;
, A7 ~: T( q5 r - char *dmabufdest1 = NULL;
5 q0 P9 l- J! n: B - char *dmabufdest2 = NULL;: b& n& y' i. }5 `; f' n
: J- }' Z+ o$ G* h$ v- static int acnt = 512;
2 A8 ?" \1 p# g4 T0 O - static int bcnt = 8;
x; d0 n4 q+ r/ \ - static int ccnt = 8;2 S, W% K; h P" i+ m a# s
2 T+ t1 o/ e @% N+ D, _/ [% H- module_param(acnt, int, S_IRUGO);
( \ }7 F5 S+ c- _# p' m' P- e; I) r - module_param(bcnt, int, S_IRUGO);4 m5 z5 Z: a" H: \ ]3 G
- module_param(ccnt, int, S_IRUGO);
复制代码 - T. Z+ ?& f) v
6 [, t; W8 [5 ~, @( h/ z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- z9 m6 ^) N- B( l% `+ L9 U) w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: z3 S- e1 g5 z, Y8 t" |) X, D4 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 ~& o0 x# M' Y) Y1 t. L. r; e+ m4 F
$ e- M, g6 g! L5 I: Q& D7 @% G
|
|