|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 W, ~' n. p$ x4 K: Q! y- [code]EDMA sample test application5 M4 l8 M" j8 F. Z
- /*2 c+ D9 g0 @- R# ]: j M( r
- * edma_test.c7 e; l) q3 u; m) X4 Y0 y
- *& e& v: d2 S0 A' a
- * brief EDMA3 Test Application
( l& H3 S# ]. O - * J( B4 V% K% n0 J$ u, U) V
- * This file contains EDMA3 Test code.! j3 {) U0 R9 {
- *
2 C' w0 J( E) ]1 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 i1 }" u; U# p1 u- ~- Y4 N5 [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' b9 E8 c* B8 i: F/ [
- * TO CHANGE.
4 n$ D/ q+ {4 t! Z - *
2 M0 \, h4 p1 J3 N r# @9 z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& w& ]0 w) K; E: h - *( l9 V' @# i) J
- * This program is free software; you can redistribute it and/or' _: z- @/ }! @7 \$ j$ m. b
- * modify it under the terms of the GNU General Public License as( J0 Z1 h: w6 D# g' |0 t
- * published by the Free Software Foundation version 2. S' n/ J- U. n( t5 i$ S/ C
- *% v5 [/ C' m' K+ m1 h: ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& f, M) K: M# A
- * kind, whether express or implied; without even the implied warranty3 w/ k# J% O: r3 M+ S7 ^' U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! Q6 i" q! t+ u1 L8 x# S - * GNU General Public License for more details.
5 t$ L+ `$ A0 z7 S9 r( y; R - */
. l' D& I5 ~( a3 C* D0 T - $ e5 O. q. }/ N3 B
- #include <linux/module.h>
! z2 C% d0 R4 I7 a, Q, w: W - #include <linux/init.h>
5 i# r- m8 h" G& M - #include <linux/errno.h>1 X8 N* `! u) n
- #include <linux/types.h>
6 v% k6 ~( S8 i$ o3 l - #include <linux/interrupt.h>! ~: O& Z8 k1 I" t
- #include <asm/io.h>2 D( C# E( M& V
- #include <linux/moduleparam.h>5 ^# d5 H+ R# g2 R0 S# c& v
- #include <linux/sysctl.h>
& K' U. f' S1 {) E7 Y - #include <linux/mm.h>* N$ H e9 d2 ?; Y& w% l% i0 P
- #include <linux/dma-mapping.h>0 O, L/ c) I- r5 P2 S
; h( j5 _+ X# R- #include <mach/memory.h>1 r9 L$ T ?8 g( F) ?
- #include <mach/hardware.h>
+ v7 s4 P" g" K# V& C+ K ^ - #include <mach/irqs.h>% T7 \8 K8 W8 ^$ A. [
- #include <asm/hardware/edma.h>
' W E9 A" I M5 i5 H - ( P/ R |0 q# r6 d) R2 H' V) }
- #undef EDMA3_DEBUG
9 C3 _8 q# o# J9 X - /*#define EDMA3_DEBUG*/1 T( X* ?; U/ d
8 b- e) M3 V( J( ]& t q# h; ?- #ifdef EDMA3_DEBUG( ~0 d) r: f3 {9 U9 }/ D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). Y' c7 ~! t; M! A) F4 f7 d: J1 a" @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# f$ l8 i1 S, F* N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 b* L4 v* X: j( I' E) ~8 L( }
- #else
5 O3 I0 u2 S Z - #define DMA_PRINTK( x... )
" f& J6 d6 b7 `% m3 r! {9 } - #define DMA_FN_IN' O2 c! {- |+ Y8 B- h1 l
- #define DMA_FN_OUT
6 G8 N" x8 i* ]4 U! ^ \6 y - #endif q+ Z$ X+ }0 w+ }% W
$ a" A: ]: W" m& G1 S& G6 E7 l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# f7 M5 {1 L" m( F' ?) b% i - #define STATIC_SHIFT 3
# p* U/ b( a" W3 h/ z. y; D - #define TCINTEN_SHIFT 20
Z5 a9 r4 g9 U' r - #define ITCINTEN_SHIFT 21
4 F* X+ M! p, `. x! F7 D - #define TCCHEN_SHIFT 22
# G3 t0 |8 M3 S$ x5 e8 } - #define ITCCHEN_SHIFT 23
4 w' w- I5 c0 L4 D6 A
: v/ V% L3 {3 c- S% _6 {9 \. S- static volatile int irqraised1 = 0;
. M8 q& S0 ~% Y4 n0 e) w - static volatile int irqraised2 = 0;
x5 H3 k* ?4 r4 J$ ] - & P+ i; p" k0 o" z4 A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- t1 g+ ~0 N9 Q$ T/ P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- `* G# Y5 O6 P1 j% A6 K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 u$ f3 L# i4 `% b. p- T" B
- $ ~' s. I/ i! Q) `- K
- dma_addr_t dmaphyssrc1 = 0;
$ C& t7 T6 {( U$ R- P - dma_addr_t dmaphyssrc2 = 0;
+ L" x* F$ o7 J0 B. P' c* n - dma_addr_t dmaphysdest1 = 0;# o I$ d6 _% O( T) _: @
- dma_addr_t dmaphysdest2 = 0;* C6 T9 ~' f/ {7 Y: \
- ) u/ ]. r) e8 Z6 y6 y
- char *dmabufsrc1 = NULL;; G8 _9 p4 w# A, Q
- char *dmabufsrc2 = NULL;
- ]* b: B4 o+ x2 m, H - char *dmabufdest1 = NULL;' c ~4 R# Z5 w
- char *dmabufdest2 = NULL;
# \: l- L8 Q# a7 L9 h( k# g
+ Z O, \1 q( s6 S. f) U- static int acnt = 512;
+ k: T( b6 h3 U: B0 o: L9 @ - static int bcnt = 8;
* O7 R9 D$ d+ C2 j7 }3 K6 Z5 N! B - static int ccnt = 8;
# G: L6 f' U) w - 3 h, y3 w1 @/ `4 n& e% w
- module_param(acnt, int, S_IRUGO); I) u! m. R5 t3 B" b3 v$ R
- module_param(bcnt, int, S_IRUGO);
1 [, _+ g2 o* E0 n - module_param(ccnt, int, S_IRUGO);
复制代码
! R$ c7 q( X! k* p- X2 Z- O( u2 S# J5 ~) o k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 ^8 {: E, C- V& A* V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 C1 }$ s# D! U4 F/ }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- i |, o8 k( Z' _) I1 n
) ? }% O+ G5 C7 {+ \4 u
) ~; S) a3 g4 S/ J% u+ \9 n7 c |
|