|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ Z- x) ~- [/ D2 U, B- [code]EDMA sample test application) ]$ D# K6 f7 {: Y7 I
- /*7 L9 p% D6 z! I, p
- * edma_test.c, A' Q# G. r S& S; W
- *6 K9 k3 _8 U. {& g: t' Q# I
- * brief EDMA3 Test Application
4 l' D: F% r" t$ g& p- p5 M - *5 V8 O V R9 o) X9 S; T
- * This file contains EDMA3 Test code.5 l8 j$ e+ U. y) w; H1 _
- *8 V0 X5 e( n [: G( v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ C) R5 E) H" L* e- `" z# P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" Q! O- \1 _# ` - * TO CHANGE.0 R/ Z" D* _1 E* ]
- *1 B1 W1 ?& j* u# k! P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' b$ c' a; x+ S
- *
" S9 K. \9 a5 }' b3 K& Y - * This program is free software; you can redistribute it and/or
|) E1 ]. p; O8 S/ m - * modify it under the terms of the GNU General Public License as
* j3 g7 G# u: ~ P% t3 q - * published by the Free Software Foundation version 2.+ O7 Z3 V5 O! {- |
- *
n# \: x8 {2 C) g+ O) | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 m s" r/ X/ O( q7 i3 z
- * kind, whether express or implied; without even the implied warranty
& D5 i/ D1 z: T0 X; a# k0 w; D* f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \1 _6 W% \ s2 C
- * GNU General Public License for more details.$ k6 X! U- I3 Z& f' f
- */
2 P! B1 K# |9 R. l* A) n3 [( o* G - ! D9 j+ X0 w a" O5 o, H, w# O
- #include <linux/module.h>1 K) J8 I5 N( L3 v/ q `: r; |
- #include <linux/init.h>
9 K. o1 Y, H- U2 t. p* _1 l& F - #include <linux/errno.h>
5 D# Y6 u: \1 g" H/ H8 E! k4 T P - #include <linux/types.h>
0 t5 Q3 w. h$ F2 e- ~* C - #include <linux/interrupt.h>( o n7 _% B/ o( Y% F8 l
- #include <asm/io.h>
$ a1 J1 z* H& J4 B - #include <linux/moduleparam.h>
' ^: Z4 \+ \' ]- d3 B% A/ v. T - #include <linux/sysctl.h>6 W6 D6 D' {8 O% E
- #include <linux/mm.h>* O& R2 u7 |& x+ q- k
- #include <linux/dma-mapping.h>
+ \% B7 h$ ^6 Y( n
; _0 h. W9 D9 W- o3 I- #include <mach/memory.h>
+ O, O% P1 Q7 m& G. D - #include <mach/hardware.h>9 W" I7 Z6 M u2 [- O
- #include <mach/irqs.h>" ]- I$ I0 X+ Z9 l% L: B
- #include <asm/hardware/edma.h>, F; ?. m' a; B" E$ s
- 7 [' t8 b3 O- M5 M- \8 F
- #undef EDMA3_DEBUG7 h# r4 z3 J* P7 }7 ]
- /*#define EDMA3_DEBUG*/0 t. N; O& ?# c) Q' \5 q* @- \, Z
6 K) F' @3 K. p7 o# j* x; D7 l- #ifdef EDMA3_DEBUG5 [# Q, K/ e7 Z2 ~& x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 M4 g' M- M8 _& Y2 l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% w1 R( e8 @1 D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" L8 D i4 _* W - #else8 A. u% S- I1 V4 y. R, H+ X
- #define DMA_PRINTK( x... ). `) _+ c: e4 q9 u/ {) t
- #define DMA_FN_IN8 i+ k: l: t) R! h! e
- #define DMA_FN_OUT6 B* D6 o: V3 d: }
- #endif! H9 I( b1 z |4 Y8 ^0 v
# n' ~: Y/ u( Z: k+ n. {! \% Z$ @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# i% m* G& c# H$ q. @ - #define STATIC_SHIFT 3
% Q0 U( V* c0 e) `& I - #define TCINTEN_SHIFT 20& o- {6 S, b; Q9 ?1 d4 s' z
- #define ITCINTEN_SHIFT 21# R$ u0 d& _) y$ j; _
- #define TCCHEN_SHIFT 22
4 D# C) F$ r3 L+ `: |7 i+ [" z - #define ITCCHEN_SHIFT 23
4 I" g& w5 ~2 q1 _, E; Z - 4 U" [5 I |% w
- static volatile int irqraised1 = 0;
2 u& P! z: _- i" K7 b' Q1 V - static volatile int irqraised2 = 0;) M$ M$ P( C" Y, f1 I
- : L% I7 }$ P0 G3 y; z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 F8 w s Q; u% l# `. E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* @6 ^ U$ P! y. M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; C6 n- r5 a( B) y$ G8 y/ b) g F* ~ - ) l2 [$ l& }$ w# o K: i2 Q
- dma_addr_t dmaphyssrc1 = 0;* U4 t* N3 n3 y [' B4 ~* `
- dma_addr_t dmaphyssrc2 = 0;6 b9 q/ E: S R9 E# y* x$ U. k
- dma_addr_t dmaphysdest1 = 0;
* y! J8 | T6 m) ]5 G3 P- j - dma_addr_t dmaphysdest2 = 0;! {% W! C8 b* H
) r0 p7 R/ Q# U; X- char *dmabufsrc1 = NULL;) {0 M; J* r8 B
- char *dmabufsrc2 = NULL;8 I2 a1 J. H- _# `3 m4 a3 d- j
- char *dmabufdest1 = NULL;8 {' X7 v4 G3 G2 [0 K0 m* K
- char *dmabufdest2 = NULL;
8 h- y1 U1 c$ l - ) |5 Q: A. M. `# k% L
- static int acnt = 512;7 A7 l5 b$ Q7 B" o0 j$ N
- static int bcnt = 8;
$ u2 h& d7 q3 N# r* [; } - static int ccnt = 8;" [0 h+ J& w$ ]% |
- / k+ X& a# |& f% j! {- c( y: h
- module_param(acnt, int, S_IRUGO);& H; S# Y. ?& K7 [* R: f/ E
- module_param(bcnt, int, S_IRUGO);) K) r8 J& [7 s* v0 d
- module_param(ccnt, int, S_IRUGO);
复制代码 1 W) e( Z8 k* O/ e
3 }! l. E6 D8 n* `: C0 d/ c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% Y- R% k* @4 y8 q( {2 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" k# K6 T4 x# s. Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 r( u; x4 f; m( @0 e; D% [
6 Z/ r4 ]% P6 N2 s5 h5 y( k1 t. G3 X% b7 N$ E# W( L8 Y$ o
|
|