|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 u/ _( V8 Z* q( j/ n" k) A. f
- [code]EDMA sample test application
) k& N- O- [1 Z# {. G - /*
! q! B4 I9 p: t7 L3 A" K7 O4 O - * edma_test.c
8 [4 D" v# ^% T7 H }/ r: r - */ S$ I0 w, w% z; K0 y
- * brief EDMA3 Test Application: _ F! H3 F+ i) ?' ^1 P
- *
$ l& L2 _. [; r4 u - * This file contains EDMA3 Test code.
0 K! |3 G% L1 m" d) K9 ? - *
5 ~$ I7 D5 R, Y, @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. G7 _! a: N, U2 k/ F6 W! V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( ~7 \- ]$ Q4 Z; k, b - * TO CHANGE.
- [+ k7 c5 \# W5 W - *9 Q8 h/ G2 J% N/ n2 m" u7 q/ |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( u2 D% I( l Z! o) `. v
- *' S: ?9 Z" a) O: s7 t
- * This program is free software; you can redistribute it and/or4 K) N R" L. H0 Q, f; c
- * modify it under the terms of the GNU General Public License as
3 J0 s* f9 X" e* ?" G g- G! J - * published by the Free Software Foundation version 2./ k# W5 I! X. F$ \2 j
- ** h* K+ t$ N2 B) T: e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( ~3 v0 \0 n5 X: @. S1 P
- * kind, whether express or implied; without even the implied warranty+ e" t& Q9 O: Q, O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 u5 k3 V' m% O" [& s- ^ - * GNU General Public License for more details.
' m+ G/ U/ P5 H# Y+ U - */
& B' @5 C: k8 d+ F% N# e# W
! ^1 E- U$ r- ^7 @! D4 e, f/ M- #include <linux/module.h>
: G6 u" G8 n* k5 N' Y - #include <linux/init.h>, g5 N0 W+ h, L; U1 `3 p% X3 x" S
- #include <linux/errno.h>
! U+ B( a3 h1 Q/ G5 c- Y/ } - #include <linux/types.h>' R# A' S. d; Y2 z& j" J% {
- #include <linux/interrupt.h>; w8 c. w% @! v* f: K4 Y; F
- #include <asm/io.h># u& R$ M' U. c# h H: U
- #include <linux/moduleparam.h>0 ^0 Q. b/ E$ ?" P8 s9 c& d
- #include <linux/sysctl.h>! B9 K& F; g2 _9 D4 w8 j
- #include <linux/mm.h>" o1 I; A g0 s' K8 v! {( z1 Y
- #include <linux/dma-mapping.h>: a- _* o3 u* M' t. V9 |" |
- $ K0 ?7 g' A; U: |7 [0 a2 H
- #include <mach/memory.h>
/ [2 B3 @; Y. E; Y4 Q$ ^ X( k - #include <mach/hardware.h>1 B. F7 y- x- W; ~3 x0 j3 `' k
- #include <mach/irqs.h>
, t* G- L+ P' o) d3 l" J - #include <asm/hardware/edma.h>
6 G* \( L" T% v7 G- m( n - 8 V9 T: D1 M7 n) [
- #undef EDMA3_DEBUG) g& {6 P* u2 n; U+ b
- /*#define EDMA3_DEBUG*/
7 V* } U) _& P6 B& y/ }8 v; N, O
$ h* `" }, x; P% V- #ifdef EDMA3_DEBUG
0 t/ n: X0 Q2 N4 ^, c9 o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( |- O- }- o/ F: A7 R6 ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 H, v h, Z' _+ \3 `# o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- B9 u y& v$ L; S
- #else" R# u8 g. L$ c, B# d
- #define DMA_PRINTK( x... )
' i: A* Q) {8 d2 ]- `$ g9 O - #define DMA_FN_IN" ]+ d7 i& ^% T* H9 _0 M2 f
- #define DMA_FN_OUT
: k$ Z. T9 O7 L- X/ N. ^ - #endif$ ^# t/ U8 j$ W! B P8 k8 E
" q9 K9 ^- w: Q% T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! g1 h) y+ L0 `' N* [ - #define STATIC_SHIFT 3
' U! I5 C& i) X, s - #define TCINTEN_SHIFT 20
. D) n, J% j# V, t/ i _1 [ - #define ITCINTEN_SHIFT 21
6 ~7 q, z6 N# {0 d+ o - #define TCCHEN_SHIFT 228 X) x; L6 ^" F" S$ Y; G
- #define ITCCHEN_SHIFT 23
) X" V6 Y+ I6 ~ - 7 ~5 h0 M3 l: F) [) a
- static volatile int irqraised1 = 0;
" t& [& Q4 m! Q$ Z' g - static volatile int irqraised2 = 0;
! B1 U; C! o' ], r - ; _! u Z% d5 ?+ ?' k+ X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# W2 P" b% Z: x( l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 @7 i5 U# u1 k/ M g5 g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( C6 V. R% a0 X& i6 B
; h* i7 O$ C& n6 G; E8 s0 C% \- dma_addr_t dmaphyssrc1 = 0;
, F( {. ]% M9 E. k - dma_addr_t dmaphyssrc2 = 0;
Q& Q+ Z8 b$ C6 `+ d - dma_addr_t dmaphysdest1 = 0;
5 g: H4 Z& a# [$ u - dma_addr_t dmaphysdest2 = 0;% ~9 C+ e$ b8 _- ?
- 1 e X; E" R4 Q3 Z$ ~: ~7 ^
- char *dmabufsrc1 = NULL;2 C2 s) W+ C( v8 \$ a
- char *dmabufsrc2 = NULL;) E1 T0 D2 p" e- X4 Y
- char *dmabufdest1 = NULL;
3 a; c# y; x& O0 t( H& C - char *dmabufdest2 = NULL;/ D- B4 F, @- }( v! b
$ y, D' M4 J) }- static int acnt = 512;1 y% r5 E# h% C0 P- K+ f! k
- static int bcnt = 8;; Q7 `9 o, U9 f1 G+ k
- static int ccnt = 8;
! v: E! h, n& E3 l; |# k' I5 ~8 t - 7 O6 }( R* i: r* @
- module_param(acnt, int, S_IRUGO);, w0 ~) R9 ~( @* e7 t4 C5 Z: d+ R* z
- module_param(bcnt, int, S_IRUGO);; a- k1 P) @. W& r8 x
- module_param(ccnt, int, S_IRUGO);
复制代码
, [0 H$ G, t# w
( Z' X$ m5 M5 N! Y3 O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 e% z4 u( U S% A, iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. y0 F7 Y- o, t: Q9 T6 T+ q" U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& U' o3 x) |7 z" f6 Z' |
7 i' u$ P, } ?7 K, v9 M& Y) A8 B6 f% N, a
|
|