|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 C9 W4 h( n; `$ d4 P t Z4 d
- [code]EDMA sample test application
8 Q/ P- `% a9 ^! ?- ` - /*
7 i4 C' D/ {. h7 G( ~: L9 k# I - * edma_test.c
; D' L( \$ c& q+ H - *
4 p& e2 y8 l; a3 p - * brief EDMA3 Test Application2 u( o6 j t' c. P6 y9 \: Z
- *6 U. p; x: V* M4 M: \+ G6 b8 C
- * This file contains EDMA3 Test code.
( J) ]) M: {6 e7 N0 k+ C5 r6 T - *
) W; B5 \9 }, l s: _/ z; A; f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 |, \0 S: W, |& `, Q2 O4 H5 R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. y% r; V2 q+ V
- * TO CHANGE.
$ z- H/ Q# Q8 e" d3 Z - *
# p, ^- A7 `7 I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 [9 t; X4 U; j8 ]- I3 D# V, k - *5 {' U+ S7 A9 m9 D" k1 }$ e6 l
- * This program is free software; you can redistribute it and/or
: c4 o/ v( w0 e6 i. q! k% e: c/ M1 l; ?# q - * modify it under the terms of the GNU General Public License as2 @( e+ c) o; |0 z2 |# w) Q$ P
- * published by the Free Software Foundation version 2.: Q/ Z' Z! S+ j0 h
- *
$ Q; x Z+ A& Y0 f/ e% v2 ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 V/ a1 `& i6 S3 ^# r8 C - * kind, whether express or implied; without even the implied warranty
1 ^. q4 e7 n- f) \% I" ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) `% f. q j Y& V+ {% d6 R; l - * GNU General Public License for more details.
& L7 J: W; g! I4 X9 P - */. L# L5 w8 ^5 u+ m% M9 j
- : | @/ R# W! M' T. x
- #include <linux/module.h>. }* ^& J0 b7 I6 _1 O
- #include <linux/init.h>! @( [4 L# K( f4 D5 w, \& X
- #include <linux/errno.h>) d! f# k; i+ _, K% g) k; H
- #include <linux/types.h>
# C `- O' B% p$ p- S - #include <linux/interrupt.h>% @' }7 Q1 W- G) Y
- #include <asm/io.h>
2 N8 {, r9 u3 w1 O8 R - #include <linux/moduleparam.h>3 _0 s5 }% C! f3 m
- #include <linux/sysctl.h>; X; k: c5 f# }
- #include <linux/mm.h>% l7 D# n2 L! z d
- #include <linux/dma-mapping.h>
5 {# i' v5 h( r5 p- ?( C# l5 Q
7 N1 {$ u/ s9 G$ c: n4 d. N8 Z- #include <mach/memory.h>0 n' |5 u: C( R2 |' \3 q8 ^
- #include <mach/hardware.h>
" O$ R) p, N9 B- Q% a - #include <mach/irqs.h>7 \7 Y1 Z% r) d
- #include <asm/hardware/edma.h>" i* b' L. I' W4 P R/ o& a- O
, d% w8 C W5 A+ H2 p& v! R- #undef EDMA3_DEBUG
- A$ b- T5 U6 F$ B5 q% Q0 R% y: E - /*#define EDMA3_DEBUG*/
$ c% t$ m* \6 m% _, \, j: y - 1 w; ]9 X" H1 l
- #ifdef EDMA3_DEBUG u r! E7 y: j+ G* X. E/ d4 E/ `. ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 ^( b7 |0 P+ a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ i5 J$ e9 [, C' W" O5 A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 R {9 C% |' {9 [/ Z6 N0 r5 ^: R
- #else' w$ x7 @. s7 G. V* a3 K( c) o
- #define DMA_PRINTK( x... )4 p, B5 [# o4 P4 R( J
- #define DMA_FN_IN
+ N8 d4 v* F# O) M2 C* n. L - #define DMA_FN_OUT9 ]# S& n. @: m. y
- #endif: C. s: i& q- ]% I$ ^- P# B# S2 Z
- ( Z" U+ F( U2 V; Q, @( @! @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* M) A P1 m, A! I2 p - #define STATIC_SHIFT 3 m0 n& M+ ?" |% Q
- #define TCINTEN_SHIFT 20( I& a8 @1 d+ @3 C) b a
- #define ITCINTEN_SHIFT 21; ?3 j9 w2 o5 C: B0 A- U
- #define TCCHEN_SHIFT 22
* U) K+ T, S- H - #define ITCCHEN_SHIFT 23
& \: H/ R. O7 K" X - . W3 L* e$ `* t- S
- static volatile int irqraised1 = 0;2 ~1 s- M) s4 p; V8 s
- static volatile int irqraised2 = 0;* ?$ ]- R" O) k! |4 T& t
- " m+ D. [# G+ N6 t! q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) }' P" `- P) K3 N6 r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 @$ k6 l1 ?9 S$ M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); F$ H6 \ g7 e- r' D2 d8 x, } b
: ^4 Q9 C& v& D7 }6 L) z. z- dma_addr_t dmaphyssrc1 = 0;
. q5 w# }8 W6 c7 }3 O - dma_addr_t dmaphyssrc2 = 0;% E3 H4 b& c( G7 R6 D+ j( Y
- dma_addr_t dmaphysdest1 = 0;' |# o# |2 N) o! h' A+ d& e' @- x
- dma_addr_t dmaphysdest2 = 0;1 N7 V- ?/ z9 G/ W0 l0 O
& _; f+ Q/ h0 g; {- char *dmabufsrc1 = NULL;/ h1 e6 h8 K3 @; w. C! ~
- char *dmabufsrc2 = NULL;1 a C0 J3 s }0 m0 u5 Q
- char *dmabufdest1 = NULL;! m# a. ?* \- \( V" I. G2 ?
- char *dmabufdest2 = NULL;
@/ U2 J7 T6 D( z8 n - 9 X$ v' v) V+ Z+ |% r$ O( _
- static int acnt = 512;, x' m& S: P/ }% R3 Y" g
- static int bcnt = 8;
3 E- n& m0 ?* K1 e - static int ccnt = 8;5 [: [$ r' |( d" l7 z
- $ Y* t0 @* J( u) D6 S; c; _3 O1 q
- module_param(acnt, int, S_IRUGO);
+ u: r! X9 P t5 j& Z* S - module_param(bcnt, int, S_IRUGO);
/ r$ \) _$ Q/ ^& i% e' F - module_param(ccnt, int, S_IRUGO);
复制代码
$ k, U$ g4 |* @6 V. b6 J( N9 X) m
6 a2 N4 Z# I; @ A# ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! \4 r+ Q9 ~4 g* \% Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ A+ x$ z. f* K3 V6 k0 O( [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 B! S. x1 q3 \0 z5 R
; Z% ] I: K$ J
! \0 ^) E% L4 w |
|