|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " O, h- r- o( [
- [code]EDMA sample test application
$ C' }, w* Q4 w+ S. g - /*) }0 b* n8 Z6 @. ]
- * edma_test.c
/ T4 M& T% ?+ Z" d6 ~3 a* B7 V - *$ |7 n8 g/ }. B, o
- * brief EDMA3 Test Application, R7 S0 n9 x9 I' }" I! c: ^
- *5 v6 A0 P% o. D3 D0 G( I9 y5 V+ g
- * This file contains EDMA3 Test code.' w8 f, y0 t6 ? C9 Y
- *
/ S9 p' v. e0 k3 N% G, w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ O3 d, P( Q- {9 u- _" z& i. W f9 ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 p: u, r1 |: ]9 G& X- L- S - * TO CHANGE.
: N+ }8 X, I: r - *
; h, }9 Z5 N7 x1 g. S* E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
A& ^1 f& g' a/ _% m' o - *
. c5 {0 \5 Q5 i4 h' Z - * This program is free software; you can redistribute it and/or( S# ~/ H8 I! Z6 ], I( s" i9 T
- * modify it under the terms of the GNU General Public License as
* Z8 d6 a V; M, m7 @" ` - * published by the Free Software Foundation version 2.! h* Y, ^& Q3 w; m: l( a7 D. v
- *. U1 h" P$ V! A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 h( a; _8 s4 }, j2 M. t
- * kind, whether express or implied; without even the implied warranty
7 @; U- Y8 u; H: E" W1 a* y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' t: N A$ ?# a- ?" Z$ }* K
- * GNU General Public License for more details.
' g( Y' W" E3 v- D+ d+ v- d* X - */ T% F i4 w* |4 n: U
3 F2 D) Q2 I1 n T8 j: V- #include <linux/module.h>
4 n( S. E7 Y- F5 e: r* _ - #include <linux/init.h>- E) y- X: W7 M& I
- #include <linux/errno.h>. y) r: z/ h+ F# q6 N
- #include <linux/types.h>6 J2 @: z* j9 |6 Z: T# K3 Q
- #include <linux/interrupt.h>
: m }9 ^" \6 c" O4 Y' c - #include <asm/io.h>
7 |$ C- W( N8 v* W* O" X - #include <linux/moduleparam.h>
3 e9 P" b9 {* _' h2 E - #include <linux/sysctl.h>* o) T" w) A7 }! |. i1 y. x
- #include <linux/mm.h>. j+ |4 U- B6 n# P4 z
- #include <linux/dma-mapping.h>
( _+ `/ Z, T n9 D
% W, B# a6 U2 V; j- #include <mach/memory.h>
6 ?* `3 B/ k4 Q* c3 @+ ]9 Y, `& T - #include <mach/hardware.h>
5 f, V* d. R2 r. n$ F - #include <mach/irqs.h>5 B# e+ R2 U3 b0 A7 o$ [, m- G
- #include <asm/hardware/edma.h>! g' E% M3 m* X
( s/ |2 z0 |1 j- #undef EDMA3_DEBUG ] u: l6 Y, R& T* E+ e; f+ f, c4 L
- /*#define EDMA3_DEBUG*/# N+ }; m/ M* i8 d: b8 U$ S
9 {- ]2 t( } U5 A/ ]9 ~, U: j- #ifdef EDMA3_DEBUG- G, o+ @/ i9 ?' K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* b& W7 O4 I' y) q$ F0 n0 Z4 d% \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 {, Y4 O5 [2 k: k; e* R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ X' S, }2 c1 [+ X - #else
k% F$ k4 e% X. E5 _: B9 l$ M* O$ o - #define DMA_PRINTK( x... )( e1 K3 Q# s: E. K( ^' D
- #define DMA_FN_IN( J; x6 }% N/ ?
- #define DMA_FN_OUT
t+ A9 K, f g4 A7 K# G - #endif
! m4 u0 M3 x! F+ N2 ~ - " }/ W2 p3 t! |4 j2 e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ p8 r. G4 A/ q, J) D: C8 R - #define STATIC_SHIFT 3
+ ? U6 k0 E* \& c& I5 Y: l9 a4 c - #define TCINTEN_SHIFT 208 _# _8 a! y% W2 ]9 B, L
- #define ITCINTEN_SHIFT 21
8 T$ X7 s @- G2 h - #define TCCHEN_SHIFT 22# ]3 J) Z) ~; n2 U i/ e+ Z2 V
- #define ITCCHEN_SHIFT 231 }" D5 F# ^' ?
, o; W7 C( h7 z- static volatile int irqraised1 = 0;
7 W: S+ C0 u+ o; s - static volatile int irqraised2 = 0;
& u* V" G( h ?7 l5 j, A
6 ?$ ^0 U* ~% L. H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' x. P/ M5 w( F3 E* t* m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& K* K$ T( G/ C. b" Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* ?6 t' I- g3 f3 A2 ~0 _3 u - ' O6 R0 @: m: b3 ?
- dma_addr_t dmaphyssrc1 = 0;3 G* b) C/ Z% e6 t) h' n, ?' S% l2 j; L
- dma_addr_t dmaphyssrc2 = 0;
2 a' q( L% P+ i - dma_addr_t dmaphysdest1 = 0;- E. G/ Q, z3 Q! b
- dma_addr_t dmaphysdest2 = 0;- ?5 `3 l2 d( {$ x- [
5 v O \2 r2 h" G, ?/ Z" ]6 q- char *dmabufsrc1 = NULL;8 U2 ?; _/ J0 ~; S( \- P" @
- char *dmabufsrc2 = NULL;) T1 g! b" p* a( i2 _6 y: r
- char *dmabufdest1 = NULL;( V9 A! Z# I, i" \+ P
- char *dmabufdest2 = NULL;' S: ^3 w, o) P# x3 Y6 o
- " U% n, b. w# J6 O
- static int acnt = 512;2 H @( ~) S9 y/ B, a/ ?" d
- static int bcnt = 8;
' I: R6 m" ?; n; y: v' h0 k+ z - static int ccnt = 8;
& E1 t. k) @2 A S4 n0 S F - ; D- A' u" g- e! e: j8 O5 p
- module_param(acnt, int, S_IRUGO);" F2 W! f( x7 w, }
- module_param(bcnt, int, S_IRUGO);& k9 e+ k! M" q& g) }$ P1 `
- module_param(ccnt, int, S_IRUGO);
复制代码 ! I$ X- C( C- t6 e, c
7 o* t0 ]7 h9 d) p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: m7 h4 {; V( ^" Y7 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; S+ j3 W# t, a1 L# x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" D3 `% J+ X' {3 `: }8 `
$ h* O. u8 D8 y& P/ h4 ~- d u4 _
|
|