|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' \; \' p, q* x0 i8 _4 W7 {8 Q, h5 w- [code]EDMA sample test application
, w4 ]; D: C3 \) V- } - /*
) f& x3 [/ z S9 X0 a0 M - * edma_test.c7 d+ \8 @5 E/ \
- *0 p5 C4 Z5 g( @$ o& S" B
- * brief EDMA3 Test Application
1 U1 a* E) i: r3 R T% b6 t - *
3 o- ]6 x4 T, s! \+ L - * This file contains EDMA3 Test code.! T* e. R/ f, P" B+ I- v
- *
" R3 B0 m% ~0 X) ?) }4 H; q- m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE _. x3 Q9 k9 a8 T9 ^9 t! T3 R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 A4 x, X H1 f/ z, [' ~
- * TO CHANGE.
9 f5 r. ^/ f1 I' ] - *1 e' S4 R [5 R! R2 g8 ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 P, V) u' g( A; a8 [' ~- n7 R
- *
' t$ m4 b5 \' R0 W- G: \ - * This program is free software; you can redistribute it and/or; S2 o. m' h- U. M
- * modify it under the terms of the GNU General Public License as
9 ?6 N7 G. X9 J% j - * published by the Free Software Foundation version 2.
0 Q& T9 X. O+ f) H - *6 b+ z1 p% n4 q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ Q5 n* i" O0 U! y
- * kind, whether express or implied; without even the implied warranty
2 ]/ ~1 s" a- S2 ]0 @. B9 {: n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: G+ |- _3 W: N) ?6 R; r; b; Q
- * GNU General Public License for more details.+ \/ e1 _" a+ p- F: `7 ?8 a
- */' c; z6 p; J' H& V4 t: V! J
- ; @9 `1 _( B3 k
- #include <linux/module.h>
5 O2 x: c d5 v' \ - #include <linux/init.h>
- y5 q! X2 s$ `2 X - #include <linux/errno.h>, H Q. H3 d9 L8 u' D0 `! k) |
- #include <linux/types.h>
( k! b2 g! Y o5 V/ r$ b7 A7 ] - #include <linux/interrupt.h>
0 W. i) q1 ?8 `# K, V - #include <asm/io.h>
! G) `+ |+ u' w; P- i - #include <linux/moduleparam.h>
4 q* {) z% ]* `: T; } - #include <linux/sysctl.h>
( ?" {7 P. v0 u5 ^0 v - #include <linux/mm.h>
' H7 i+ T# ^5 L/ y6 B5 \$ w - #include <linux/dma-mapping.h>8 g; p. Y1 `' i8 N- n! R4 P
- " F. p( x* E1 f" b/ U- U
- #include <mach/memory.h>* n: |% Q7 m& b) O v
- #include <mach/hardware.h>+ A* M: L0 f/ E2 n4 H
- #include <mach/irqs.h>8 g f3 L4 h/ m& w- g
- #include <asm/hardware/edma.h>, X G) [7 b& t: L
1 j* L- T/ U/ G2 e$ `8 Y- #undef EDMA3_DEBUG' I5 r/ U$ Q. W" r3 @7 M6 C5 p$ u% Y
- /*#define EDMA3_DEBUG*/" e8 v& O h3 y* G D1 C+ f
- % _1 w8 A5 L. v* r
- #ifdef EDMA3_DEBUG/ t; |8 ^( T* G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 J! N; F- B1 X. ?; C( i# d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ e6 x( @ A9 `- ?+ W+ ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% S- |- {. O$ ^5 h* D
- #else: c: z7 k# `! q3 t5 ?7 g, |
- #define DMA_PRINTK( x... )
$ a/ U/ y. y: T. h1 w - #define DMA_FN_IN
( Q7 J2 a9 h7 t- s4 @! [# L - #define DMA_FN_OUT% j8 I6 ]$ S0 y% d
- #endif; \& a5 M8 L/ y- I$ y3 K" C! O% Q3 G! I
4 C+ c2 k$ I7 T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ r9 y H# p1 x( b! D- G' A5 g - #define STATIC_SHIFT 3( E- E4 \6 R1 B w$ b. i9 n
- #define TCINTEN_SHIFT 20
o+ A1 Q; L0 p - #define ITCINTEN_SHIFT 21$ `* n6 d* O, P: j2 f* x! D$ w
- #define TCCHEN_SHIFT 222 d! p4 Z( z, j5 O- ^7 v
- #define ITCCHEN_SHIFT 23
: {3 Y; v. v/ r& b( r8 o - ! V, `+ J+ J& f9 a. C
- static volatile int irqraised1 = 0;
) z; B- {5 K& W( b* p# s - static volatile int irqraised2 = 0;
7 e: Z& C9 p0 V6 a4 w
6 j" T" e: w, y" s3 i# H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! e) ` y" X' {4 z8 T1 [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* C" _6 ~$ n: E! S7 x5 b% K7 q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* o2 j9 O$ S. Z1 V" b - 8 ^& E' w4 B# W! Y1 I0 e* z4 b3 a
- dma_addr_t dmaphyssrc1 = 0;
; }8 B& p2 V, y! E - dma_addr_t dmaphyssrc2 = 0;
( s2 n$ d$ {) k6 x9 V( f' H' v - dma_addr_t dmaphysdest1 = 0;" Z& ]1 [- X# {8 d
- dma_addr_t dmaphysdest2 = 0;$ K' z Y! r8 H
3 k; }$ T; g9 i. r Q( d @- char *dmabufsrc1 = NULL;
( ^: c1 Y9 s5 J$ A" f% I - char *dmabufsrc2 = NULL;
2 Y2 \ T4 M+ y: z, X$ q9 X w - char *dmabufdest1 = NULL;. S& K; a V' v% M# q
- char *dmabufdest2 = NULL;! M/ A0 V* T H) t* j
$ v5 c+ Y+ Z T" p5 q' Q- static int acnt = 512;
2 X5 c' K" \1 N3 c5 K - static int bcnt = 8;
* G1 Q# v& h% A% ^ - static int ccnt = 8;
8 y/ j0 _- V. K
2 F) M4 `5 k3 v% P& H- module_param(acnt, int, S_IRUGO);
& b. i7 V* O# h4 [' T/ ` - module_param(bcnt, int, S_IRUGO);6 Q" H, A2 i! ~$ g
- module_param(ccnt, int, S_IRUGO);
复制代码 2 x( g$ o# O6 j2 O% r+ d$ s
+ Q( a4 Q0 F) Z6 h: h) b% |; M( }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 [* c1 L' J: Q5 uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ U- N: t9 V) S- d2 W! f# q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- }0 e; A) Y" y; h
" `$ p9 ~9 A1 i0 R5 a/ @
1 N5 e8 T9 F$ w6 w# R8 t: P |
|