|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . a2 I j& Z" u
- [code]EDMA sample test application8 _) n d% x6 k7 W
- /*) r; C, H. c, n( d9 A- `
- * edma_test.c
' V1 D2 Z% ~7 x5 h - * S3 U& g: ~# z
- * brief EDMA3 Test Application2 z9 R" f1 F9 P1 U& U9 ~
- *
! T8 v4 P$ \ k4 t - * This file contains EDMA3 Test code.
6 Z2 H2 T7 P+ r3 X" p - *, K$ [! W) L+ r: ^" _8 z8 D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# T' G- d- Z" a- x( o7 W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! _/ ^7 X& z3 G" g. I" z b - * TO CHANGE.
3 J) T. B8 d/ }) y; z: C7 ~( A0 u - *) d6 j& ` e$ |! u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" L- X- p6 \% [ - *' E, p6 {$ |! d
- * This program is free software; you can redistribute it and/or2 Y: N8 y( Z* q/ O$ } ?
- * modify it under the terms of the GNU General Public License as7 {$ J$ i; q' }" Q' u) O2 `
- * published by the Free Software Foundation version 2.
# n0 r* n, x9 c& L: f& T/ ` - *5 |/ j+ Y1 Q: Q3 `4 f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 } j* N& e o0 H+ U% {: U( x
- * kind, whether express or implied; without even the implied warranty2 ~$ l; O R. t' [8 D$ J, z" A; y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 t% a# T; f- G; t z, ~: u4 H1 |3 }
- * GNU General Public License for more details.% b" ~ X% A" u3 U1 a4 e
- */- U$ ]: e2 c6 i) \8 o, a* k) [
# x' h+ S3 D, d( X5 E: p: X- #include <linux/module.h>
% G- m, ] t' l - #include <linux/init.h>
# G6 [ Z7 [" G/ W3 | D - #include <linux/errno.h>* A! q; G7 w( `# z
- #include <linux/types.h>
+ G2 N0 d+ Y3 Q4 Y6 H, _0 M" ^ - #include <linux/interrupt.h>
7 x2 N# a a) a - #include <asm/io.h>: L# s# Y3 C6 D+ }: ], {# N. J X
- #include <linux/moduleparam.h>
3 m3 c* I" S3 c - #include <linux/sysctl.h>
0 E' E" @% \9 S - #include <linux/mm.h>& J: y4 _' Y4 Q) X" s
- #include <linux/dma-mapping.h>
# m; }4 I1 h9 z2 M* [- { - * U0 d h1 e( @3 n+ u6 I. X: |
- #include <mach/memory.h>
& S# J- o! I" S* p: s; _ - #include <mach/hardware.h>
$ f0 T8 ]& L+ W - #include <mach/irqs.h>
; }! R; N! M7 ~# {. a! p/ k& ]' r4 s - #include <asm/hardware/edma.h>0 K( ?4 @8 Y7 ?# h, n0 Y
5 o3 G; k: j2 @0 R$ z, q0 e* L- #undef EDMA3_DEBUG' c1 i6 y1 x# H
- /*#define EDMA3_DEBUG*/
: o' A9 G. c( O9 e; M F0 K - 3 o* S; v0 p3 f& w% J5 }0 C9 ]6 @7 }8 d
- #ifdef EDMA3_DEBUG1 ]' A2 B0 N( _: _* G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 R! U D5 m9 o) x' ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 |! L: n2 i3 g# e* e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, n+ j1 }& W' z - #else0 b7 C/ | \$ _; C, R9 k
- #define DMA_PRINTK( x... )
* ~8 R" [6 ]/ Y: \ - #define DMA_FN_IN# H! [7 u" z# Z+ n4 A4 C P7 P( Z
- #define DMA_FN_OUT
) e p8 [$ ?' X - #endif7 E1 }0 V$ e/ k; {7 q
- ( s7 Q* V- r+ ~' m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) d1 ]) s4 B, E1 m0 E' q A2 u2 h, j - #define STATIC_SHIFT 3+ l! m0 i; N/ p* L% ]
- #define TCINTEN_SHIFT 208 R) f6 H0 |5 y+ r# w. a. a1 {
- #define ITCINTEN_SHIFT 21- V( U2 P' s M- q0 \4 R
- #define TCCHEN_SHIFT 22; `% K- R6 l+ V# J% m% ^0 J. P
- #define ITCCHEN_SHIFT 23, Q Q% L5 z: S$ h
, F3 Q) G$ D0 I- static volatile int irqraised1 = 0;8 r: N% _9 T& Q
- static volatile int irqraised2 = 0;( B4 g- y7 ?8 b) w0 y
- / @8 O0 Y7 O, D. D6 e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' t# P. J, k0 B( j+ m% M6 D! { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Q' S' n, ^" w0 ]. G, X8 z/ k* N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 N1 S8 \& P- I9 p- v
8 c c: B, Q0 c9 q5 o- dma_addr_t dmaphyssrc1 = 0;
. B R- ~+ N& g2 S - dma_addr_t dmaphyssrc2 = 0;8 I4 {( V$ U* `7 p
- dma_addr_t dmaphysdest1 = 0;
$ Z/ k. y# D9 m$ R; U - dma_addr_t dmaphysdest2 = 0;( L- C. N$ N' ?; U& a9 I% _/ Y w
8 ~$ t) J A! O. `, @ K _- char *dmabufsrc1 = NULL;
6 l# b. G( X$ Q1 k! d - char *dmabufsrc2 = NULL;
5 I7 F; j8 ]; g - char *dmabufdest1 = NULL;' ]5 E0 o& q8 A8 Q% K' e$ k
- char *dmabufdest2 = NULL;
& r1 L5 Y1 ] Y; g' m$ l$ T. P
( c" h3 L; t4 E8 s H0 h- static int acnt = 512;
, @ l2 n0 B5 i - static int bcnt = 8;
7 j- J+ M& J8 h0 R. l9 V - static int ccnt = 8;
0 B5 |( D0 X; n q - : Y* l, Y+ L9 P& T4 z5 A
- module_param(acnt, int, S_IRUGO);
0 E6 E: @" {8 J, P8 S% t - module_param(bcnt, int, S_IRUGO);
; b+ ~* P# D$ G, T6 }5 _6 ]$ c6 \ - module_param(ccnt, int, S_IRUGO);
复制代码
# K/ W* C& W! e( H" ?- U8 I k1 b( b# K" P8 E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 I# t7 A/ B4 w5 |5 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* t$ E; ?; O! N/ B7 V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ s! U* w$ `, C. z6 n
& A' V& i0 a: o# r! q7 r( E, J8 w
6 ]: W2 s& {3 ?/ w
|
|