|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- d" n5 S; r9 N7 k* J3 I- [code]EDMA sample test application
( k ?* I/ J! N, ~3 A: u% _ - /*
n: h; e/ J3 z0 v/ A) e - * edma_test.c
8 `- m6 j3 R: z9 i1 g/ d# B - *( c! E- }7 r* V5 {' M6 a
- * brief EDMA3 Test Application
+ q# g% ~: S. s+ T: K9 h - *( y# D' t" h/ N3 A9 u$ {: ^
- * This file contains EDMA3 Test code./ T4 G9 v$ H9 D4 C4 b$ n& u
- *
3 j/ Y& l. P1 h) R% y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 [+ \5 N7 m0 T3 i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- V$ n. H; O: l! K2 D w, ~3 \% Y4 Y
- * TO CHANGE.9 K+ l/ z2 G# v D: T5 L
- *
) u; J; p- g' H. H% m9 c! a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 A: j* t, x. W( I$ Z - *; J% v9 B5 S& H$ M
- * This program is free software; you can redistribute it and/or8 Z/ R9 L5 _9 g
- * modify it under the terms of the GNU General Public License as/ U0 O5 E* x% L1 v& P) d
- * published by the Free Software Foundation version 2.3 k* C! k6 m+ I+ n; Z8 `
- *
* u" n9 i0 ]- K5 Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any @" X% D; K W! m2 X
- * kind, whether express or implied; without even the implied warranty; ?0 Q2 Y/ ^8 E/ h0 }( U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& P( A+ A! u' v1 P( O - * GNU General Public License for more details." l1 }9 C2 S6 K/ I% _8 Y) G
- */
# q/ c& y$ Y- ^+ G/ l/ x
( Q# }+ [9 e' \9 a5 M0 M- #include <linux/module.h>8 R) C1 |, m3 M5 D# i5 h
- #include <linux/init.h>" `- V# i# Y2 V6 q* C# O3 s
- #include <linux/errno.h>- k- v% l3 }% g6 R$ z" J# E
- #include <linux/types.h>, w0 T' N% G" \5 V7 \
- #include <linux/interrupt.h>
( E7 T' L8 ^. m6 S* h' s! F8 Q - #include <asm/io.h>
& j' K e5 R) Y* H! J - #include <linux/moduleparam.h>
! e% K9 k% _# m7 z7 _9 ?0 P/ d' V - #include <linux/sysctl.h>6 a. F' K! ^5 C' }
- #include <linux/mm.h>
, m9 q" J g3 z! ^& k3 D - #include <linux/dma-mapping.h>
) w# _: i" b% _1 X
! G1 S6 w4 T- x* G' J; Q/ O: [- #include <mach/memory.h>
; O6 X( u0 y8 h' D z - #include <mach/hardware.h>' T @! `& b& Y7 y$ R6 J9 |
- #include <mach/irqs.h>
e' t. q2 m* w; [& W' {4 c - #include <asm/hardware/edma.h>$ \( a6 m+ s g+ j, X: ]4 d
- ' O: B, p/ ]. s4 I3 ?
- #undef EDMA3_DEBUG
! B% w9 ~# `' F( d - /*#define EDMA3_DEBUG*/
- U3 o6 D: x( j% ^& o8 u9 J& s - 4 i5 z3 K b( f9 {$ L5 g
- #ifdef EDMA3_DEBUG
, y0 G: Q! M7 ~ g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# `; V$ x, g6 ^9 g" C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, f8 }2 W2 p2 C! G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), ~2 z2 s \9 T0 K. d' Z* [& p8 B
- #else( Q6 h6 e4 n( ?7 a1 |7 J& e
- #define DMA_PRINTK( x... )/ |' y% m' X0 Z! N! l
- #define DMA_FN_IN
. d6 [1 E$ b0 v# `7 D - #define DMA_FN_OUT! s7 U% V# h6 ~
- #endif
2 `$ h. a. D" m) S3 R - & s! E4 g7 W# I! _! L- ~, p/ a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). s% {% Q4 I( G6 i9 Q' U! A: _
- #define STATIC_SHIFT 3
6 L2 t& ^" Y1 _, w' q% ~ - #define TCINTEN_SHIFT 20( I: E! q. Q d! f+ G
- #define ITCINTEN_SHIFT 21% n* q3 p: P: n3 ~# F
- #define TCCHEN_SHIFT 22* B+ R' I3 B; `) W" t ]
- #define ITCCHEN_SHIFT 23
' m6 j4 V2 {+ K; P3 v, j9 i
8 f* n( h5 @. ~$ |- static volatile int irqraised1 = 0;
$ F* ~7 J- O- p+ q, Q% R; t - static volatile int irqraised2 = 0;% d g }0 u+ Z% w6 {, P
- $ r0 J+ v4 I! E" K8 e0 z% O! h$ T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 X* o+ i+ q: |8 J& J" D( `5 D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; m( Z$ _0 {# _0 ?6 g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 o4 ~( j+ \2 L7 g9 h; ?( J: t1 m
+ m7 ~6 W8 G$ [* K' W1 g+ y/ g- dma_addr_t dmaphyssrc1 = 0;
1 C/ ~' ^5 `( e, ]. {( r - dma_addr_t dmaphyssrc2 = 0;, I4 e% t8 a6 U& `; H( W
- dma_addr_t dmaphysdest1 = 0;
: I6 Q4 j% }3 K" m1 \9 k$ ^* e - dma_addr_t dmaphysdest2 = 0;
2 D( I- M7 B3 x
! F. y& V! W; h! `2 i4 S: a- char *dmabufsrc1 = NULL;
3 O+ Y% L8 E$ D' m- q - char *dmabufsrc2 = NULL;
( M% Y: \( y) Y9 p4 Z& N3 \6 w/ k - char *dmabufdest1 = NULL;" z6 ?0 \" X& t- |2 Y
- char *dmabufdest2 = NULL;
) y% M" ]# w4 g2 W7 t, K R. L - 0 a3 z- S8 d, H8 T
- static int acnt = 512;. g8 S# f0 ?* Z- j, Z; S8 a8 O
- static int bcnt = 8;
6 L: N. @" o) h' R - static int ccnt = 8;* v8 K! P; h9 X8 l i
- , t1 c6 g. H, C
- module_param(acnt, int, S_IRUGO);
* M3 u c" @& a& p/ a0 |( x- m0 w - module_param(bcnt, int, S_IRUGO);$ Q: i! @5 L) G
- module_param(ccnt, int, S_IRUGO);
复制代码 , W4 D* l' Y6 Y" _1 {
+ [% l4 o/ Y I7 F2 M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
I6 W6 A* }" E$ Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
h( z m; i& _3 x6 g/ a- s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 d9 `# j, g/ a5 [) r1 e
9 F/ K3 a) y0 |3 q
8 I. \; u% W! P+ x4 r |
|