|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & x; N3 \ s2 ?- d; \) u. y( W) Z
- [code]EDMA sample test application* I+ u1 x4 i7 ^$ H3 P3 X! n
- /*
* w* ^8 w& ~* d0 P/ G, d7 z - * edma_test.c
) [: Q% m" V7 n$ E# P - */ G; X, |5 K# a- H# ?
- * brief EDMA3 Test Application
* G w3 f8 E; v3 g1 l7 M - *& t& z: \1 S* h# _1 \3 W$ l; {
- * This file contains EDMA3 Test code.
( \) Q* k6 Q1 X! k' c - *1 U5 A2 A6 k, b+ `+ r$ ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 R: M1 @1 Z* c/ |" k. O& E5 Z6 K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# M$ P' y2 Y; \. e {4 C( N! b - * TO CHANGE.
) n$ Y2 W' c! Z* g; c- i) J - *
( _3 D7 u, ] }! u0 h8 D+ ^" }' I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, X! u' ^( m( e4 _ - *
" C6 ^! n# L- \' s0 G+ M - * This program is free software; you can redistribute it and/or
8 h5 } L5 I# |# Z& F$ Y) {/ S7 Q - * modify it under the terms of the GNU General Public License as
! Z+ f; d: H3 d! M1 d/ q - * published by the Free Software Foundation version 2.
$ ?& k( G& x7 A( Y7 M - *# q' t7 V r4 X' ?9 W5 t3 u" M$ ~% d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! X, y" @- `+ b" s, D" T - * kind, whether express or implied; without even the implied warranty
P8 w7 C/ f; m$ Z# _8 p& a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& T) @$ N. ^* ]. p9 K+ } - * GNU General Public License for more details.1 W2 C0 V! \9 S/ }3 `( v: X& \% c/ l6 M m
- */
4 R- f7 H- E1 H# B- ]4 J) C n3 W4 _7 L - - a1 J- s4 C0 A8 g2 T5 H
- #include <linux/module.h>
* ]4 `( H! i% c: \ - #include <linux/init.h>0 ?7 V9 }9 V# E4 p# a
- #include <linux/errno.h># |% F/ p0 e2 X: F" p
- #include <linux/types.h>
@1 w9 T+ |" S0 p% _% Q - #include <linux/interrupt.h>9 N2 v4 w7 D# E8 _: v7 Z; Q. R8 h
- #include <asm/io.h>
/ c5 ~3 j& c" [+ H }6 O. f; M - #include <linux/moduleparam.h>8 n& {0 @# s$ x H! P; X2 ~ p
- #include <linux/sysctl.h>2 O& R/ l+ f# K! G, M
- #include <linux/mm.h>
7 ^7 d. e) a- Q1 o - #include <linux/dma-mapping.h>
1 l- h9 Z- j- \0 v/ r) a
3 R, M- e! b$ S: t2 A( p9 d- #include <mach/memory.h>
9 c B5 c7 ?: d1 T6 O; ?' S- p - #include <mach/hardware.h>* Z1 C/ v2 ^' K8 |
- #include <mach/irqs.h>
. q3 u+ U7 {$ [$ j: I6 {& l/ I6 g, G - #include <asm/hardware/edma.h>! @& C d$ x) [6 c9 ~
. m( T/ A" n* Z) @) n& ~- #undef EDMA3_DEBUG7 y- `6 k; |" D+ _5 J& S
- /*#define EDMA3_DEBUG*/
: W5 n# u8 g! D3 g
# _2 Q, ? { r3 D* ?- S8 _- #ifdef EDMA3_DEBUG
" ^2 N7 Z5 i$ y9 Z0 E) r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 u& t, \! Z" B1 p" t; q4 m5 Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ c) h$ s- ?+ C' q! P% X" J9 Y4 |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 f( C3 s( ]: V p; [
- #else* W- Y( s6 M; D3 `
- #define DMA_PRINTK( x... )& s4 [' e- j4 y( W6 w
- #define DMA_FN_IN
( w6 c" h5 M5 Q2 z( g - #define DMA_FN_OUT
& Y6 a7 N6 ], z2 f7 Z - #endif
* }% L# D: f) p5 k* N/ t! b+ Z - & h; q, P3 X8 b$ K- K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 p" e5 c4 p- ` - #define STATIC_SHIFT 3( L G `. z% K$ J- A+ I' ~
- #define TCINTEN_SHIFT 20
/ u# k0 J6 p& O/ H" f - #define ITCINTEN_SHIFT 21
; S0 |# q& h; o% C1 z. ^ - #define TCCHEN_SHIFT 22* V" F5 w0 c0 P" G
- #define ITCCHEN_SHIFT 23
9 Q4 @- ]4 l5 g: C( @
- k, g% F1 i3 B; b1 r$ m4 _- static volatile int irqraised1 = 0;
& f0 j6 o/ h" h: G4 B: H+ ~+ Y9 C - static volatile int irqraised2 = 0;
& c2 J1 ^' {. b Q - , e" @9 j5 r: g c. z; Z: K+ {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 S2 w, O8 f2 r% ` i6 t; h; Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) i7 b/ g1 s( y0 F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- P9 b) | V: b1 b1 y4 J
$ p( C) q: H- B+ X% ?9 P- dma_addr_t dmaphyssrc1 = 0;0 {* t6 n/ n- z7 q! b3 T8 y5 Y* q& m1 k/ M
- dma_addr_t dmaphyssrc2 = 0; T( K+ R& k: g" o9 V: Q4 V
- dma_addr_t dmaphysdest1 = 0;. E. i4 Z! r7 x, S+ z3 S8 I" {
- dma_addr_t dmaphysdest2 = 0;
* N- L' C. ~2 [& P& y. r3 n- Z4 O
1 D! d6 _7 F' \$ G }- char *dmabufsrc1 = NULL;
, S8 ]- r& w) J. h k! m - char *dmabufsrc2 = NULL;/ _ ]; y8 K8 O7 M
- char *dmabufdest1 = NULL;* n9 d# }( u9 ?6 P
- char *dmabufdest2 = NULL;
# o/ M7 X; ?* C. P% y! T0 s
' a Y y" f7 |$ E- static int acnt = 512;
# B( C4 Y! y, M1 h' @ - static int bcnt = 8;- y$ u1 u T( ?) F
- static int ccnt = 8;) N/ S; o( N5 \ ?
- . k1 ]2 L) L6 d: m; U! W* a
- module_param(acnt, int, S_IRUGO);
. k" c9 q+ ]7 Q: Y8 i8 ?5 Z6 c# l - module_param(bcnt, int, S_IRUGO);, E I/ e2 K" g# i7 a+ W, K
- module_param(ccnt, int, S_IRUGO);
复制代码 $ b8 P) W4 b% B2 g9 ~" O
# [) }: x) V5 _ \- M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! y7 I0 W7 q0 M$ p( d$ }& l# ?! J+ g. darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, H4 X7 Y- [7 s# R4 `8 i2 A2 G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; h) o: i( H; \" B2 i7 p8 z S0 }0 X6 E4 U* @. Q9 e2 ?# X* Q
, \( I2 @" x. y7 v5 r7 Z" s/ F2 o2 U
|
|