|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: B3 H0 L. z1 k! T8 L* c% L- [code]EDMA sample test application
9 _4 B8 S; @' A% Z1 |6 A' ] - /*
+ y% L6 v: ` J5 h. S2 C - * edma_test.c0 B g5 U9 Q0 _* A
- *+ u, V# e v% ?8 B+ U
- * brief EDMA3 Test Application# S* |2 C6 V0 I- }5 e
- *
K+ {& Q9 ^: p9 t8 \! G7 h - * This file contains EDMA3 Test code.
4 H/ K- c- d0 A2 v* O8 n7 C - *
/ Z( U; b3 f' | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. ]. l d. {/ R8 N; m' N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 o C( c3 S- E6 @ - * TO CHANGE.3 v7 w8 ~8 W, ]; y7 y( m- v
- *
8 O8 y( h) I. }7 H* a1 J J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 |5 c# X/ X" d' l7 x" h
- *+ \' `9 o: B8 }' e" p6 |- Y* h, ~
- * This program is free software; you can redistribute it and/or5 m$ {3 g6 t' F @
- * modify it under the terms of the GNU General Public License as
0 ?! s2 |" @" y3 |* c7 r' x - * published by the Free Software Foundation version 2.# P( q8 \1 ~; {" n
- *8 U, G8 z& ]9 Y, A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! g: N- w! H( ]( }1 _' e
- * kind, whether express or implied; without even the implied warranty3 [, o4 Z \: |( d9 E. Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ N6 y; `" Q) y0 G/ H - * GNU General Public License for more details.
9 K- M) |. B9 F7 ]. J9 l+ K - */
$ _- s. x7 u) c) A6 E+ r; d6 |/ x* W" s
& k8 C$ \$ ?2 N9 [- #include <linux/module.h>
, B& U$ Y9 t8 g0 ^ - #include <linux/init.h>, b p( `2 q$ h$ ~, W6 Q
- #include <linux/errno.h>
( f! @" Q0 H) P4 K) ~2 @" m - #include <linux/types.h>
4 _, K6 s7 N$ W; ~9 f2 _ - #include <linux/interrupt.h>
8 K; p) Q* [: ~6 j# C9 ?& J" e - #include <asm/io.h>
" j& v1 P! I/ E - #include <linux/moduleparam.h>( J0 _: S- D9 g; V/ S1 c
- #include <linux/sysctl.h>
! r+ H5 C* |" H8 i - #include <linux/mm.h># d! j- r+ C0 F; G
- #include <linux/dma-mapping.h>
# {0 z1 C. m& b# w3 j - ( t0 e, S @! h6 }, C8 I+ |9 [
- #include <mach/memory.h>" x' D( N7 \* t! I6 V2 Z6 H4 i
- #include <mach/hardware.h>
( f/ t/ l4 j u0 N - #include <mach/irqs.h>8 k# g1 \* y/ c" _2 o2 i N
- #include <asm/hardware/edma.h>
1 R5 J* ]/ d: d) B6 N3 M
8 r6 `: L- R5 }2 a! r- #undef EDMA3_DEBUG
$ [& X& S! M1 X5 Y' z1 d) x' x - /*#define EDMA3_DEBUG*/
& B& n% `9 w# N- H# S$ R8 h% y
! D) }) @( B1 B4 g- #ifdef EDMA3_DEBUG
" y. g, `+ J# p+ C l/ O+ F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ y2 a, V$ v1 v7 q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' I0 t) M( F( A C5 q' |/ T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# W, `# r u1 i0 U2 N7 ^0 s6 r
- #else3 i- E* B9 D2 w+ C- S( B
- #define DMA_PRINTK( x... )
# A3 p; a- w2 c& f4 r. F% b+ i - #define DMA_FN_IN4 a" z1 W' D- z E
- #define DMA_FN_OUT- @1 K- N6 l& J
- #endif) Y6 s4 T2 j, z; ?7 C* m# c& {
+ f2 H) [, \5 I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& Y- X. B& ^! \7 V0 k# [" H - #define STATIC_SHIFT 3
0 b/ d( R9 h! E, G: h) u - #define TCINTEN_SHIFT 20
/ E7 q7 b5 ]" {5 B/ \( [ m7 l - #define ITCINTEN_SHIFT 21% |8 Q' d4 X4 J$ W- X7 }7 |3 s
- #define TCCHEN_SHIFT 22. d P8 g# j( i+ L+ S& t
- #define ITCCHEN_SHIFT 23, i* U" D) B! D$ [# m! a" d
- 0 b: ~* p9 w4 |7 K6 B5 _
- static volatile int irqraised1 = 0;1 X$ r' [5 b$ P+ r/ b4 O
- static volatile int irqraised2 = 0;
5 H6 b% O" ]4 y- S) \ - ! w9 E/ t# q$ U& [1 m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 Q: x# G( F# _ e( d' z4 U; k3 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# a: o& x# ]" | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' d( V% Z i& v/ N% f - ! x, ~0 ^/ @/ R- F
- dma_addr_t dmaphyssrc1 = 0;
* H' ]1 U5 f5 K* p) L. m1 P* \ - dma_addr_t dmaphyssrc2 = 0;! x$ m* p1 n Q7 r% P- f
- dma_addr_t dmaphysdest1 = 0;7 g e2 c/ m P4 b1 _6 G
- dma_addr_t dmaphysdest2 = 0;/ T5 F# C% [2 U8 I# j
- % [8 z/ Q. ^/ @, Y
- char *dmabufsrc1 = NULL;. y% N3 r' L0 j. J; `# G V
- char *dmabufsrc2 = NULL;; V: W9 o7 w( ]6 q% o) l* v" _
- char *dmabufdest1 = NULL;
$ p0 u/ b2 x$ ~ X9 G8 K3 I! p - char *dmabufdest2 = NULL;
7 w6 P$ m s* K* S* [1 V - # X: \+ ~( P/ _4 y# Z
- static int acnt = 512;( ~( d( Z* [+ k& q" w5 `' x
- static int bcnt = 8;0 C' h- I" R8 c$ j4 E8 g( f) ~) k) ]) n
- static int ccnt = 8;
: L+ @- @ a9 y6 F: t5 s2 }0 L: D8 Y6 E
5 Q" w# C" _0 `& k. A" I+ z6 {- ?! Y- module_param(acnt, int, S_IRUGO);
6 L9 b# D" d& Z, P$ V - module_param(bcnt, int, S_IRUGO);
5 B# R- M6 _# I4 P3 S$ D - module_param(ccnt, int, S_IRUGO);
复制代码
0 j; w7 {4 k$ M) N- Y
) @- G$ u/ w! \7 q' c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 M0 d1 l8 z& ~$ Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* Y8 j1 i5 I7 u6 d0 p) {: w' l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! r& G1 M/ Z( F! {% ?4 P
8 U! R) t' [- E6 A+ ?: e) ~0 D
+ R U) z& w; c" @3 ^, P: u |
|