|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( _; C$ w# ?# N) B! y* j: W& n2 H+ Q- [code]EDMA sample test application
0 l) }0 M5 z. e6 _ - /*
+ }7 Y9 l+ s$ }4 A" u3 I - * edma_test.c
, k* S1 d9 H2 p4 K) S - *
& d' ]5 ~; I( b9 C8 v - * brief EDMA3 Test Application' W% F! B( D% G: l' w
- *0 l3 p; c: L+ }0 F! ^
- * This file contains EDMA3 Test code.
0 Q5 |! P$ C7 v4 p; A - *! b+ w7 z6 F0 ^( }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( H% ~$ S7 ~, U, k; c5 s K5 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 k, T2 d; p% e7 G4 Q% g; H
- * TO CHANGE.
+ [( M h" V# y - *
; v" y$ ~. B' |5 H9 {7 g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 m6 }7 n# d4 E - *3 N% t6 f8 R5 q& O
- * This program is free software; you can redistribute it and/or$ |7 b. i7 [8 k! j* Q4 B% a' C2 _
- * modify it under the terms of the GNU General Public License as9 R% a4 R, Y2 A$ j
- * published by the Free Software Foundation version 2.
) o" u+ X9 w" j' ?* @$ @+ [% G - *
( z8 t& `1 d+ u4 q' M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# _/ I5 J: x& r' [+ Y1 [. V
- * kind, whether express or implied; without even the implied warranty8 a2 r( @# h8 _# N$ G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 S5 X% k( o& }+ T - * GNU General Public License for more details.
$ O% h5 p! W2 T# c, L I - */
; ^; K; o! d' z5 w+ x - $ D8 ]" B3 l6 U3 w# W, n; J
- #include <linux/module.h>8 X F/ b, c0 b; u
- #include <linux/init.h>7 n) u B$ u3 q5 `5 ]
- #include <linux/errno.h>
& `/ P8 Z) |* f% m) g$ _# E1 F+ R - #include <linux/types.h>
. J0 U5 o: Q! |5 m - #include <linux/interrupt.h>
8 u9 P- u# }5 t; H8 {4 t, J - #include <asm/io.h>
1 B9 w! z7 d1 Z* W" v - #include <linux/moduleparam.h>- |' T/ Z- X9 }( c, e& R
- #include <linux/sysctl.h>( U8 j) l+ l2 J
- #include <linux/mm.h>4 ?( T8 O) n9 I9 b2 D0 ~+ j+ y
- #include <linux/dma-mapping.h>, S# K: l9 Y5 b7 \, S
- 7 C! ?, I" B* ^) \0 `! Q' |
- #include <mach/memory.h>
. m& u$ t; S3 j2 x0 Y - #include <mach/hardware.h>
3 q, i( K' _' y% F& j; ^ - #include <mach/irqs.h>
1 v& q# ~ \: Z* M3 s+ K% q+ G5 z) m - #include <asm/hardware/edma.h>
: w/ b5 ^; A5 V$ N$ T" E, z - , U& ]% | Z; v a! m+ P _
- #undef EDMA3_DEBUG
0 C0 j/ ~+ i' D& U - /*#define EDMA3_DEBUG*/$ R A8 f% \" j% V! J" ~
- * N7 U7 z9 e3 j" U: x3 U- e
- #ifdef EDMA3_DEBUG
1 u/ _- T" o6 B' M& [( {/ A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' W5 P; s2 T2 r& o( L. ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; f, z/ Z4 c0 k$ i) v& A) A4 k: p5 w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& p4 s: Q8 \; N: P - #else
, O: b/ ~0 X" L$ t( h+ ]& w# |8 y - #define DMA_PRINTK( x... )1 Q- K3 h$ q5 w7 l
- #define DMA_FN_IN7 S" ?# y& W: F* M; `+ j8 k
- #define DMA_FN_OUT
: k# ~7 B: M3 M) Z - #endif
! n9 K+ v4 b% ~# y! P5 E$ t - # t; K4 @2 r* D' D$ `8 G% }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 X6 T8 m& _% k1 q$ f/ W- A
- #define STATIC_SHIFT 3
2 ~' K$ B v2 ]$ w$ F4 J - #define TCINTEN_SHIFT 20
) u) ^& }+ T. Q" f' [; O - #define ITCINTEN_SHIFT 21/ B) }. n$ G+ P+ i$ ]6 i! a
- #define TCCHEN_SHIFT 22* |4 ~7 f0 C: N) r5 l6 u+ a
- #define ITCCHEN_SHIFT 23
- Q" H" M! C( }' B - - h9 {! I: B7 z7 X* X( }& {
- static volatile int irqraised1 = 0;
" y2 H2 g3 D9 b - static volatile int irqraised2 = 0;
+ X, J+ Z% f: u$ w2 y6 c& n
# `8 p* x" M# Q0 [; r& l6 j. V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' s0 j$ k# ]9 v, \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* W8 P9 G: m9 P$ K5 ^0 [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 f: r: l+ S& @3 c9 a$ w: d1 h
% J1 o" q* Q# M5 s- dma_addr_t dmaphyssrc1 = 0;/ L' F* E, }3 N( Y* Q0 M
- dma_addr_t dmaphyssrc2 = 0;
2 R5 |4 c) W% w5 W( X - dma_addr_t dmaphysdest1 = 0;
" Z+ C6 ]$ a. J - dma_addr_t dmaphysdest2 = 0;
! X/ l* S0 n! Y# W; P
, {- E# p- q Y' k- char *dmabufsrc1 = NULL;
+ c5 U% K: E+ x1 i' P, T - char *dmabufsrc2 = NULL;8 d7 x4 R& i! z' [6 F
- char *dmabufdest1 = NULL;
' k' J: d- _8 I! | - char *dmabufdest2 = NULL;% \% q# P0 C; W6 z
- R* h+ y) x' g2 N/ ~* `* K4 e9 x- static int acnt = 512;$ I& r, R* a( L0 E4 w/ y
- static int bcnt = 8;
. U7 N# v P& `8 o2 {; N R - static int ccnt = 8;6 A+ F; J+ _2 O
- 3 a8 a$ {) T" f+ j" `/ D* T4 i- t" X
- module_param(acnt, int, S_IRUGO);* T* m- {7 ~+ R" F, D) P
- module_param(bcnt, int, S_IRUGO);4 s4 v S* l% F# F& ^
- module_param(ccnt, int, S_IRUGO);
复制代码
6 L# ~! t6 O2 b' A3 |* F t6 V6 A3 v" h8 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' C; J' m) M/ U4 p7 \- R+ larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 R5 ~& z$ ]1 X0 i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 z! e+ v/ O, K' M. n; a. f& F! h9 Y
1 m u1 Z1 L' u5 W4 H1 Z- L
1 O/ X0 n+ F* W, s3 C8 S6 o* s" z |
|