|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; f" D$ _( p7 A- D
- [code]EDMA sample test application4 s; ?8 s2 a$ ]! T5 w; G; ]
- /*- O( e) R4 J( O
- * edma_test.c
8 ?$ s& f4 G/ |% ~5 l- c - *
$ ?9 z/ a1 f5 |+ @* R; j8 p6 S - * brief EDMA3 Test Application% S+ \0 a- `$ B* v) I; K; h
- *
( }8 Z( [ v: H7 W2 h6 D$ t - * This file contains EDMA3 Test code.
- E6 s7 A% M7 z - *
; u# p7 D5 y2 Q# C9 e- c& T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 F2 ?4 ^+ Q' D9 ^+ C4 z. C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, u* l0 X7 F2 G+ f - * TO CHANGE.2 \1 d4 c* e% |& K9 r
- *
0 Z5 \. [0 n6 ^5 Z* K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' W6 j0 |' Y* T; P
- *
. R& ?/ f7 E9 G2 p5 F8 L( r- K$ m4 m - * This program is free software; you can redistribute it and/or& x! M+ S! Z9 c6 j2 V* B% j. G3 ?5 V! ~
- * modify it under the terms of the GNU General Public License as
. A h( \! v0 K6 ~; N - * published by the Free Software Foundation version 2.
6 Z& b" B0 j7 D - *
; D, O* I7 w4 Y. a) a; p' J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; r/ R% V" s) g `. z
- * kind, whether express or implied; without even the implied warranty
) k2 p! o7 y7 l* I Q* t( x! j. n0 H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! K q% W6 i$ g( S" w0 Z% u: x - * GNU General Public License for more details.( U) D8 b" w4 B: F3 s% S) n
- */
% h) ]6 F- e4 p* P5 X* k - 1 \! |! ~5 F' u$ r* u, L7 a: P6 ]
- #include <linux/module.h>
0 ?( e( i; h) v9 P1 e0 { R - #include <linux/init.h>
% o \# a z8 D9 `1 a# _ - #include <linux/errno.h>; A0 @( P7 @, _0 w
- #include <linux/types.h>
8 G! J- y$ U, J3 j* j) h6 z& n - #include <linux/interrupt.h>2 [) D- D4 \# i, O$ ?7 @6 n
- #include <asm/io.h>
: m6 a7 ]1 O+ Y2 P - #include <linux/moduleparam.h>
- @9 x5 e( V* ~2 G; S5 R% ~, I( S - #include <linux/sysctl.h>3 l6 s* g* w3 V5 o) j
- #include <linux/mm.h>5 f5 P! }& G' \" y7 {- ]
- #include <linux/dma-mapping.h>7 ~, A4 U+ }8 X! U8 T. C
s$ k3 d; A: u$ t% V _" _. k- #include <mach/memory.h> q9 x, @; T5 [
- #include <mach/hardware.h># a8 Z( j! O7 `
- #include <mach/irqs.h>
$ l% A8 c% e; l* G - #include <asm/hardware/edma.h>8 N+ V2 m1 h# M, c* h
2 m |# Q' g$ c% D9 Q/ @, n- #undef EDMA3_DEBUG$ i! {# W# C2 ?/ F3 f
- /*#define EDMA3_DEBUG*/4 f( }7 G- V1 m& m) C
- ! K W: I- C/ N2 s
- #ifdef EDMA3_DEBUG
& d- I% f% @' e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ v, D W+ n( _- h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- M% |7 u! i( p0 w3 Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) R+ K3 |" c% L1 g
- #else
- ^4 ^$ O9 b; `: m5 [1 l4 `1 X; _5 i& s - #define DMA_PRINTK( x... )/ J9 ^- v/ j# o0 k- A7 G2 e* [4 i
- #define DMA_FN_IN
: U& I) e5 }( Z& @6 o, z& i+ U - #define DMA_FN_OUT+ v! Y- B- {4 I* } Y7 d' |6 L
- #endif& j1 y Q' R9 `; o4 _4 x4 Q
- 6 u2 P3 [6 L R" S, g6 Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) e) d K' `6 a+ T s9 H1 w0 L
- #define STATIC_SHIFT 30 i( ]1 I' d6 K' `+ l9 m$ i/ `
- #define TCINTEN_SHIFT 20' V- Z' c R5 S. g; H5 q
- #define ITCINTEN_SHIFT 21
# R1 n2 w7 N( I+ l9 x" Y - #define TCCHEN_SHIFT 22- M/ ~6 G, P6 q3 T' |( }1 j
- #define ITCCHEN_SHIFT 23# P5 `' w# c. ?: Q
# i! v4 U3 D5 G- static volatile int irqraised1 = 0;
) a; D6 ^' q2 P' H - static volatile int irqraised2 = 0;" v `% k& T; d
2 J. r& l# b) o0 C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' @ a' }9 ^( U( A" J6 Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ W) G0 @8 f0 w5 W; ?! ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 B: _; {3 i. Q; Z# R# N
- . R$ W7 A* D4 ]: V2 v
- dma_addr_t dmaphyssrc1 = 0;2 w+ ~! g N# w$ \0 p, w( N5 j
- dma_addr_t dmaphyssrc2 = 0;% z$ V3 I6 `5 X9 a9 V
- dma_addr_t dmaphysdest1 = 0;$ h3 ?: m" i7 f
- dma_addr_t dmaphysdest2 = 0;
0 t* H! Q9 a; Z( ^
/ ~& x5 F& w( O, L4 K6 v9 J- char *dmabufsrc1 = NULL;
& S5 f2 x+ f5 }) j" l: u; h( K9 } - char *dmabufsrc2 = NULL;- H4 ~+ d% D4 [
- char *dmabufdest1 = NULL;- e% I3 z! l; t7 U) U
- char *dmabufdest2 = NULL;
4 Z8 [: k' i& M+ [/ L
& U2 v" e" {# c6 F3 g- static int acnt = 512;
, k( e+ D* ~6 S& @3 r! k: H5 U+ | - static int bcnt = 8;; i4 z/ e5 B! _' H [
- static int ccnt = 8;
& V* Y7 q: _) n% H, ~1 t
s9 q- ]: ~* k& M! s1 v6 ~7 |- module_param(acnt, int, S_IRUGO);0 a- d7 _' i; I- v5 B5 [, X- B
- module_param(bcnt, int, S_IRUGO);
7 {5 O& [9 |9 Y0 g2 f4 c6 i - module_param(ccnt, int, S_IRUGO);
复制代码
5 Q' A% R# y# |3 K5 [2 P) t; k; q F/ S' M; N: N9 e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" `7 Z9 H4 j; R3 V/ R b( H5 |/ }" iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- V5 u, N/ ^% |* ?' x# ~0 {/ L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. Z( @7 v' ^' o' x% A+ N
! z4 i: m, w# E7 _- s& j) e
' J% A' G6 j. G: t3 F/ \
|
|