|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( \6 q! k; Z1 G9 |! U/ F
- [code]EDMA sample test application8 A a% _4 F2 f: ~! I
- /*
% \# F% y1 l7 g- r, o - * edma_test.c
* U9 x+ g9 F/ ^& Z2 x - *
" E k7 [9 L! s2 `7 u4 e' A- a - * brief EDMA3 Test Application7 p. d, Z- i4 s3 ^3 }! ?: q
- *
6 e S# F& n5 ?0 u - * This file contains EDMA3 Test code.9 W; ^5 J [( ]" N- ~( f& b
- *
' c2 r! k2 W) ?9 u4 I' w/ N! @! g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: M z" M/ k, [' S" Z4 Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: Y4 w6 `3 Z0 _; _, Q# Q/ x - * TO CHANGE.. K" D! |4 m! P1 \- i
- *
. ^; }' z4 K- R+ I" V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. b+ e( {! u- W8 |. f! k- Z4 K - *
* H _# _ Z: e# D; l& G - * This program is free software; you can redistribute it and/or
; @" d5 L* M. I - * modify it under the terms of the GNU General Public License as# @. u3 t A' T; l) l9 e: j: I! R
- * published by the Free Software Foundation version 2.% J8 F9 ^ W: P6 Z; K3 L' s* J
- *7 l+ B6 D3 v0 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
c% V% T( J( ?) y$ L+ Z - * kind, whether express or implied; without even the implied warranty+ ?, Q3 [! b9 x% B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 n1 d+ u; i1 g" m
- * GNU General Public License for more details.5 c. C; T& w2 u# B+ T. |
- */7 G2 P! D+ Y2 q) v
* ?# K. H; l8 C8 U4 k% X2 w- #include <linux/module.h>+ j# u- h" D: w; S
- #include <linux/init.h> B1 e; Q/ B% Q6 o0 \: a
- #include <linux/errno.h>3 y/ z* F7 V! `, S7 K8 {
- #include <linux/types.h>
. |8 @" d/ A6 o/ M6 c; Z0 y, l) I - #include <linux/interrupt.h>' @+ W' A6 X. R9 Y7 T& m4 Z
- #include <asm/io.h> ^2 i2 C9 \4 i. g V$ Z$ z
- #include <linux/moduleparam.h>
' K: N) f5 }! M - #include <linux/sysctl.h>
" S% T: p n; @9 R' ^ - #include <linux/mm.h>
/ @# H- F! @) a2 s" u - #include <linux/dma-mapping.h>! l1 B4 s6 {! e. U, c
- / ~, m; @% l8 C% e& h( j& a
- #include <mach/memory.h>$ T! L9 p5 r7 C1 x
- #include <mach/hardware.h># v. h0 _ Q, n1 ]3 C% ?( E) \
- #include <mach/irqs.h>; `( k4 Z; o( M7 k( B( t* E) n" l
- #include <asm/hardware/edma.h>: C0 f& A! s& ]( Y' n; \
0 e, ^8 P& F4 `: X% ~- #undef EDMA3_DEBUG
* c5 T' }4 ?0 A2 B. Q7 b9 s - /*#define EDMA3_DEBUG*/
. M; \ C) \) O1 R - ) _# m! k# [% w7 p
- #ifdef EDMA3_DEBUG
# m6 H5 V0 q& D7 u6 k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" C7 f6 r; X" B/ X' Y* f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" t! e: \: ?5 L* \5 p Q1 s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' P' l4 i3 T5 u, l0 ?
- #else
; `+ F% ^5 x+ y4 B5 S - #define DMA_PRINTK( x... )
' B7 \+ }/ r1 b5 F7 _3 X5 F - #define DMA_FN_IN8 \% Z( x% N( a, y% S
- #define DMA_FN_OUT/ D c* U$ s( l" X- W" W0 J
- #endif
+ y& l1 B0 a1 n" R - 0 s" G9 H2 h* F" a3 {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* P1 v; V% f$ [4 U# I4 g4 ~& E - #define STATIC_SHIFT 3
4 y( L. n/ H# |# _1 A% ^ - #define TCINTEN_SHIFT 20
$ @8 i$ u# i. ~* H% J - #define ITCINTEN_SHIFT 21/ w2 v" {+ u- M. B
- #define TCCHEN_SHIFT 226 R* F/ B5 X5 L
- #define ITCCHEN_SHIFT 23: U8 M0 \, |+ V( A' B2 t$ x' Q
: h; ^: m8 I# U: B# ]' j* ?- static volatile int irqraised1 = 0;
1 O4 b y3 O V4 V - static volatile int irqraised2 = 0;
% W( N! h" ?0 w8 R* u
: |4 r4 Q8 g% E6 J2 y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 L: ` p7 S2 j8 R) E, }* f: [( I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 f( r: o" C' ^$ G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 M0 {( F" J& b! V - 0 o5 x) ^5 h8 V
- dma_addr_t dmaphyssrc1 = 0;0 R' |" O! E8 V. k& s1 a
- dma_addr_t dmaphyssrc2 = 0;( W7 ]2 J" L0 S/ s
- dma_addr_t dmaphysdest1 = 0;
& U/ U$ Y3 e, o8 ]/ ^6 F2 G - dma_addr_t dmaphysdest2 = 0;
4 l9 b1 p7 |& X# w) v# G - 9 ^* V0 i4 M' i9 p, D* j3 q
- char *dmabufsrc1 = NULL;
6 H% \" s' d. \; Q+ D: V- K& ` - char *dmabufsrc2 = NULL; B8 v: i& A4 B1 I8 C, j
- char *dmabufdest1 = NULL;. c& O( @6 v* N8 n* H9 l3 ~' w
- char *dmabufdest2 = NULL;. v$ ?4 D: M5 ?) O- @& o1 K7 X
7 Y4 f8 H8 K+ L9 Q- static int acnt = 512;; \" W( m0 q4 B' [
- static int bcnt = 8;
' y6 r E3 g% U" [3 {9 K - static int ccnt = 8;# ^: W$ L7 r+ P& ~9 O
2 K& l8 a/ r# ^+ s1 G0 z- module_param(acnt, int, S_IRUGO);
/ {( d& p7 P; t; G - module_param(bcnt, int, S_IRUGO);; m$ h8 ?; N- t' K0 |- ^, X
- module_param(ccnt, int, S_IRUGO);
复制代码
" t) x3 f7 O& q# \; D6 b
, b9 b. g& E$ g& p1 v' l4 K) v/ d- H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 k) F4 P& s+ }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ q" `% i0 s9 u: |+ s# A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- U( _, _+ {: x/ y' K1 a3 k) m: b* O! j: l2 H
0 g3 g( X* t; m |
|