|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) } p3 g0 J- Y6 w1 v- X$ j- [code]EDMA sample test application
1 u, e! H6 H v3 c% | - /*$ a4 F" x+ N1 I( o7 ]; x) y
- * edma_test.c8 _1 m2 X* W# F+ E; N, P
- *" j3 E& ]! c7 Q. f, Q) T1 s
- * brief EDMA3 Test Application
) A, b* n4 V' c7 Q - *
- J; E- w$ E2 c3 S' T. A - * This file contains EDMA3 Test code.4 e/ Z$ G* H+ ^4 k/ |( p% x
- *, u+ j$ C+ n( E, }% S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! b2 K' Q# L5 \5 M6 b! b; w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' U N& R/ L8 \
- * TO CHANGE.
* q. b. K; J0 M5 t( \4 z' A# g. c - * ~1 C' l& {- x. Y3 ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" p( }- k- Z& s2 K - *
5 I, P* D3 f! X- t' T4 A. ] - * This program is free software; you can redistribute it and/or6 |& S/ ] K5 u
- * modify it under the terms of the GNU General Public License as/ j, y# f2 I1 C) }$ d& G& t! T8 W
- * published by the Free Software Foundation version 2., ~* W( z+ E0 K( y- j6 o6 `. ~
- *
+ `4 Q7 y7 ]9 }/ ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 ]% w' F! Z- L- \9 X: K - * kind, whether express or implied; without even the implied warranty+ P# P1 x& M6 ^3 r4 @* a8 M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 K* F2 d9 W! G - * GNU General Public License for more details.
/ k) z; {% x% x1 l - */
2 A$ n- I, S/ f! d, v - 9 C' j+ G- S5 g2 P1 {
- #include <linux/module.h>4 G2 g8 |2 o; b; S- ]4 P$ T# v$ e
- #include <linux/init.h>
* a) b3 L [" s) e; ~$ `% B2 H3 P5 U - #include <linux/errno.h>
$ x3 B; F$ J1 f4 H1 h) m - #include <linux/types.h>% ^9 I/ @$ }7 e! C8 o( v5 {
- #include <linux/interrupt.h>
" `( W9 `: P* d | - #include <asm/io.h>
4 t5 v: r7 ?, }- C - #include <linux/moduleparam.h>
% f- Y/ ~9 l4 L - #include <linux/sysctl.h>1 {6 |. [& Z% d8 q+ F
- #include <linux/mm.h>
% A* y. A- a5 a+ y - #include <linux/dma-mapping.h>( T) j$ P. d& L/ X; I
- ) R Q; f$ ]; l& h
- #include <mach/memory.h>4 ~1 t( ^* j& s O5 w2 ]5 ?
- #include <mach/hardware.h>
, O4 H i. r( N$ t - #include <mach/irqs.h>& z- D- Q3 p$ R- b
- #include <asm/hardware/edma.h>8 ~3 S# j9 V+ U$ [- b1 z7 i
- . a* L9 K. c4 r1 w ]+ m/ J% |% Y6 ]
- #undef EDMA3_DEBUG/ _% \, F- t2 N6 [- E2 V
- /*#define EDMA3_DEBUG*/
% l- F4 l u# {# m# Z) c u7 W - % J2 F0 U i( l, k- D S, i2 x" W
- #ifdef EDMA3_DEBUG
& W. ~9 ~9 T* T& j2 d. K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( c. z( w B/ u, I) f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' d! O) h! M' S4 e% s: U* ^5 ~ ^7 n6 h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 j" A# t6 f+ ]; L4 B
- #else
' Y, n1 x# _2 e0 Z7 y - #define DMA_PRINTK( x... ), v' ^7 w6 R- l5 s) A
- #define DMA_FN_IN
9 p* V3 c [# i/ p9 X3 p5 P& u - #define DMA_FN_OUT
. q5 |' W" W7 ]& E - #endif; D0 T# }, @: l [$ y& _
- 1 R) Z5 A1 E; b' N4 N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 _ J6 x! U3 d
- #define STATIC_SHIFT 34 _* o3 W# t4 M) t, m
- #define TCINTEN_SHIFT 20
7 i4 ~4 n( u9 V' j$ h/ ] - #define ITCINTEN_SHIFT 21& k7 K. T" f9 k$ o# k
- #define TCCHEN_SHIFT 222 x7 y6 t, F( L" [; N" p8 F$ W
- #define ITCCHEN_SHIFT 239 Y$ j9 k% j8 f! z/ P+ P
- ' f3 X& D2 ^. H8 }" n+ m, I
- static volatile int irqraised1 = 0;
3 c9 @* ~6 _3 V2 x - static volatile int irqraised2 = 0;
( p5 c! ^. j& P' R$ }) d) e" s
2 L n- a: Z, K$ C/ j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
e0 ]* ]' b. R* w4 [- D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- I: f. M" T) P& p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
K9 n" u; v! o1 q/ ` - / I ?0 b9 Q' ]8 u% H- t' F8 `
- dma_addr_t dmaphyssrc1 = 0;
: d. w& c& G- @ ]' Z - dma_addr_t dmaphyssrc2 = 0;
: Q9 m0 V" ^2 O, b8 _1 i# P2 p* p i - dma_addr_t dmaphysdest1 = 0; Z3 y/ M* i3 ~$ z& A0 g' B* ~
- dma_addr_t dmaphysdest2 = 0;. z6 ?* u7 v) d# x8 S4 ~7 m
- . t) M% |2 g1 [
- char *dmabufsrc1 = NULL;8 F' u' {: b. J+ ~
- char *dmabufsrc2 = NULL;+ o/ x7 I0 p' a0 K
- char *dmabufdest1 = NULL;7 d$ ~ j& w+ K9 B
- char *dmabufdest2 = NULL;: Q( `. _* K8 u, Q& m6 x7 p
2 C, Z4 g6 P3 w" e! V% p0 R' b X- static int acnt = 512;
: f' V6 E- O5 c* p6 s - static int bcnt = 8;
* G6 A2 ~" t5 N$ B7 Z e4 d - static int ccnt = 8;, P- y# Q8 Z: v, S
- $ t+ B" O2 H2 q' }+ t; n9 h
- module_param(acnt, int, S_IRUGO);$ u. r; k0 m+ g w1 u$ M
- module_param(bcnt, int, S_IRUGO);
E5 V6 ]+ D g! x6 w) N0 A - module_param(ccnt, int, S_IRUGO);
复制代码 3 b% ~& I- A% N( f( Z) v3 L' z% h+ O; y
+ A$ r' f+ t$ E8 j* K* G1 K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& n/ q! D( T# r% H \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& |: ]% [ _% X- @4 }5 ?0 T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. M k( t# S1 X \5 {3 q! q2 j$ q: V+ `* ^. B1 R
' v/ t0 [8 K* q% Q0 |, q& Z |
|