|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% G: i& }( m+ ~* z- [code]EDMA sample test application) A! [" O' x8 ]: w( }' D: d! M! E% J
- /*% C2 }5 G, Y# ~) Z
- * edma_test.c
7 k; n5 D: ]' W' B& r - * h0 B6 i9 X8 b8 U& Y% `7 P4 |" i2 n
- * brief EDMA3 Test Application- T% Y) E% U8 w9 R3 I2 @! u
- *' y7 g) l8 S' l. T5 D
- * This file contains EDMA3 Test code.: l3 ?: \4 ~; ?
- *' B# d) X- \1 F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ D: G) e4 g! @1 f4 I% n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 a& e2 a6 C7 M - * TO CHANGE.+ g- D$ U1 i) l: A% G
- *" S# d( f+ P# K( X" N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 [ A1 J, H( o8 E8 y - *9 r, ^1 x/ s, w9 V% c' }7 w% T H
- * This program is free software; you can redistribute it and/or
; T6 y% X w7 y0 J - * modify it under the terms of the GNU General Public License as8 @3 p1 E# b9 ]7 |
- * published by the Free Software Foundation version 2.
c9 _# P3 }2 j6 e& _ - *
. a( x5 I% A2 |. C! c7 f. J1 f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) O( Q, t: z7 p7 o* K& ~
- * kind, whether express or implied; without even the implied warranty
! n, j8 y G# a- Z5 s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: o6 @, e% ~; E) p4 E" p
- * GNU General Public License for more details.! E# s' a' q7 c9 _: T) G" k9 n; |
- */, [7 W! l+ G# F S, `) J9 v; ]
- ! k7 E4 X @8 X1 ]+ w, h
- #include <linux/module.h>
% X, |, W. ?% d! o. z6 v8 }/ L8 o+ | - #include <linux/init.h>5 M* j" Y& i4 T* D/ C
- #include <linux/errno.h>
$ ?& m3 |$ ?( J- X4 n! f& u - #include <linux/types.h>( d- m, k. A! q( a
- #include <linux/interrupt.h>
7 ]8 ^8 a+ `1 d, G) }3 l+ i - #include <asm/io.h>) `3 s8 |/ s4 v: N! F
- #include <linux/moduleparam.h>
1 u" v4 H, J! v$ ? - #include <linux/sysctl.h>
4 M& Z) B( [5 o/ H6 Q2 k - #include <linux/mm.h>
- Z# O$ { h8 H4 S% U" ?- b - #include <linux/dma-mapping.h>! u1 \8 e4 m" b0 C0 C8 V
- / z% A/ Y5 u' O# ~ o7 T1 P
- #include <mach/memory.h>
O# J0 Q1 ]7 l* b - #include <mach/hardware.h>$ S4 H+ w y* j: ?+ C+ b4 G
- #include <mach/irqs.h>3 B4 }; b+ @2 T* E% ~" C& {# w
- #include <asm/hardware/edma.h>
$ F9 n. P" H9 { `7 K' s2 H
5 p7 O- B7 y, A$ q) L; W- #undef EDMA3_DEBUG
3 ?2 _% `7 A8 c: n - /*#define EDMA3_DEBUG*/
" B+ Y- I3 r+ g
! `. v" [* e: w, s! B/ G, k- #ifdef EDMA3_DEBUG
8 T% g% y% n7 L: j6 u" P( W$ d$ }* D - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 E% o. h8 r* C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- r) A8 C* j0 h. Q2 ?8 d4 | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) ]6 x! I& j) c. w u( y# B: @
- #else
* ]+ D1 H a( I! M9 b* ?) u% z - #define DMA_PRINTK( x... )% `( @2 c. p1 Y) d% g$ U6 u8 R
- #define DMA_FN_IN
$ p- M; L0 ` j4 r. _ - #define DMA_FN_OUT2 v- Y, h; Y# ?9 g6 h* k w3 r
- #endif+ E" `1 U/ N* J3 L8 \7 F, t6 ?
- F0 ]; x2 f$ L* _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 j. ]+ S- z. } - #define STATIC_SHIFT 3
% i6 Y v0 z5 v( m" L6 P5 w - #define TCINTEN_SHIFT 20+ U4 @% c# i6 c" d8 ?
- #define ITCINTEN_SHIFT 21
8 w7 O/ R- l: Q$ U1 E3 r - #define TCCHEN_SHIFT 22
$ {/ s" v4 ^; h4 h - #define ITCCHEN_SHIFT 23
# |) ~; A$ b }- o& O
8 i, l" U* H" R" ~- static volatile int irqraised1 = 0;; y& j# w) f7 V
- static volatile int irqraised2 = 0;1 ]3 ^' q* `1 T% K
- e2 Y- T. v: n( f9 |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' L9 ~$ C8 i( P0 Q' D1 | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- e. Q% Q3 i* }! H5 f8 d/ X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 L& j9 J3 r; }: v* |) y - * l+ d7 G# ^( r( A1 W x! \
- dma_addr_t dmaphyssrc1 = 0;9 w! O1 ~ w" C# p" I. h
- dma_addr_t dmaphyssrc2 = 0;3 y, F, ~5 d7 t3 G+ a
- dma_addr_t dmaphysdest1 = 0;5 y" u2 ?) C3 u" e! |' y
- dma_addr_t dmaphysdest2 = 0;
! j( ?- w! \- @4 d' V
/ o* N N4 P2 z9 d8 t- char *dmabufsrc1 = NULL;2 U; U1 ]. c- B9 S' ]3 T; {
- char *dmabufsrc2 = NULL;
- [6 t" g2 p, B" Q - char *dmabufdest1 = NULL;
q8 u5 B# @# `/ z7 q" c1 ] - char *dmabufdest2 = NULL;
' h# p" J' t, W! a
9 K b/ }8 I# I- ?- static int acnt = 512;2 |3 v5 u* @: |6 w. W
- static int bcnt = 8;, ^2 r0 n( d2 Y2 u: ?
- static int ccnt = 8;
3 T5 L8 t0 W: k& `# I
! c, D5 f8 e& {$ H' g5 Z1 J- module_param(acnt, int, S_IRUGO);4 E9 U1 R% {& Q3 E, m5 {
- module_param(bcnt, int, S_IRUGO);
_- k! Z: p- i9 p, J( D+ e - module_param(ccnt, int, S_IRUGO);
复制代码 . o s$ O3 w; y9 t+ `
( K c5 m3 o1 @1 \" x G& K) b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 a" E6 {, e/ O3 B: ?( d- farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& ~+ k& | x' k$ N9 m6 g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- n; l0 F; A5 ~! c+ y
1 g0 y0 n) A. U4 s7 `
0 m# _, Q. {1 K8 V" F4 s% r |
|