|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; e% b% X+ m' o' D- [code]EDMA sample test application
% Y/ Z% @# K5 P. @ - /*
8 X" R* L) ]" J! P( m7 L& p - * edma_test.c2 V% a. g7 {' m# v
- *
9 N7 [2 Q9 J' A8 K - * brief EDMA3 Test Application" e9 J2 s* g: ]1 o) t3 }* A
- *5 _6 I0 W: s- N+ G
- * This file contains EDMA3 Test code.( w: ?" X3 r) V
- *
- Y6 H- \* O9 R; |2 L9 i4 q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 v3 b& w2 `/ G, u( A! @7 O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* w, a4 ~& n' { }: M/ x# }7 W' N - * TO CHANGE.' U. }7 z7 [) ~2 _% P! d# _9 ^
- *
( }% c2 e# V/ d+ K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
]+ Y2 {3 Y% _, z% R$ d. d - ** I* }" D( S, D: B1 d, N
- * This program is free software; you can redistribute it and/or
- s8 K4 }, R% e0 u8 `: s - * modify it under the terms of the GNU General Public License as6 `) {: G. {% T) ?9 U' R
- * published by the Free Software Foundation version 2.- Q; W1 w& A4 B
- *% ^# v5 m8 S" Q, J) T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 G8 l1 M2 P9 y, K# s6 d* Z/ o
- * kind, whether express or implied; without even the implied warranty% R5 m. K5 Z: x% @0 q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; r* _% k7 U* M$ v# I - * GNU General Public License for more details.' D+ F1 Q3 q: u/ r) k% C; Y
- */
3 s5 a# \% U5 Z2 n! @ - K- G. q9 Q! i2 m( o7 y
- #include <linux/module.h>. }. I, W4 m8 o" X9 B
- #include <linux/init.h>
# R" r( v9 H, o6 d; X6 q8 t - #include <linux/errno.h>
4 N9 ^' [( q6 j" h# y - #include <linux/types.h>
* D* y. K, M" C* F7 J% I) { - #include <linux/interrupt.h>
5 ~: Z8 ~4 g2 O+ D - #include <asm/io.h>7 S2 Q# N! b3 z
- #include <linux/moduleparam.h>
, A# E) G, v8 z+ Y - #include <linux/sysctl.h>. m& s* E \/ f9 H
- #include <linux/mm.h>
# k4 u' C; n1 J. L: _" R' w8 v q - #include <linux/dma-mapping.h>
; S- j! ^, L/ R2 k: i* Q+ B6 R8 }
& g. P& n- z+ b' `8 D( h- #include <mach/memory.h>8 T6 g0 g h9 x0 V( P% q# F
- #include <mach/hardware.h>
; ]& |$ t k9 V6 U% {3 H2 ? - #include <mach/irqs.h>
/ T- }8 ?' p, [: C$ { - #include <asm/hardware/edma.h># l s" R6 }4 o! T6 u& O* z; a; F# f
- - M" F. s r8 c
- #undef EDMA3_DEBUG' d7 O6 r# o, Y: V5 A
- /*#define EDMA3_DEBUG*/5 R$ b* k% t- R# p$ K
- ) i F, v" s3 o
- #ifdef EDMA3_DEBUG
- T, ]" f, G7 P3 k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ z7 r7 Q' [0 C) R; l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 ]$ ]0 D+ Y1 \; w, o/ \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! t9 {& V& a+ E! V/ y - #else: j2 y4 d( D2 W) V+ [8 s* e; s
- #define DMA_PRINTK( x... )& a) @0 a# v8 x0 y1 Q
- #define DMA_FN_IN( h& A# E' X! w
- #define DMA_FN_OUT
2 G" t3 z* g0 H9 V8 Y4 B. k9 z1 I - #endif
8 L! J/ x/ @# B3 N' R# V6 m7 k0 i* p - # w" W- ^! D W: G$ [/ \! @, k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ X5 Q: l+ m+ B0 p% W. V9 n5 I/ d - #define STATIC_SHIFT 36 M' C0 g& f5 R" U0 s/ V0 s
- #define TCINTEN_SHIFT 20
! _; i" N" k/ f& x" _! [* j - #define ITCINTEN_SHIFT 21) ^# K) k! @/ F% c1 }! B
- #define TCCHEN_SHIFT 22
& I1 w- G' |! M% Q# g3 y - #define ITCCHEN_SHIFT 239 t* m g* h, s, ]/ r& y" U% `) x
- 6 M: L+ P$ F- O+ ?; ?! K
- static volatile int irqraised1 = 0;
$ ?# q- l# p$ d- C. W1 n' R - static volatile int irqraised2 = 0;: T4 Y( t/ H8 k* S
9 V) c5 e- T! a* y+ T# E+ @3 ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 G0 x0 M, i* `2 }$ p3 C0 h6 O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! V0 V7 t/ q) t$ d$ }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 I% ^1 N g& [2 T& ~
3 R9 r6 O0 U P: f- dma_addr_t dmaphyssrc1 = 0;& g* d# b U5 u$ O8 }
- dma_addr_t dmaphyssrc2 = 0;
, A$ L3 ]) w. m. k/ C+ Z - dma_addr_t dmaphysdest1 = 0;: e3 ~: ^! P( Z+ H/ l+ ]
- dma_addr_t dmaphysdest2 = 0;4 N6 I' L7 s, r' D l9 G
- 1 R& I8 r3 r U
- char *dmabufsrc1 = NULL;3 k- x B8 {, V9 V" j. { u
- char *dmabufsrc2 = NULL;& n- p6 f: _0 t. b Q8 X
- char *dmabufdest1 = NULL;
# I" d p: |$ q" J$ w/ b# N - char *dmabufdest2 = NULL;/ q2 ~ ], v6 h( l% n( O$ [( K" M0 [
- - q7 ~% I/ j P: R8 P" }$ k
- static int acnt = 512;1 D# |1 w8 H) o: P, w
- static int bcnt = 8;: o0 [ k0 [) P. \2 _$ y
- static int ccnt = 8;$ o$ G3 s4 I0 g: i
- ( F5 ]% P1 i6 j2 E3 U1 R
- module_param(acnt, int, S_IRUGO);
/ o& J( |+ }1 }5 x9 Y$ t+ v. U - module_param(bcnt, int, S_IRUGO);6 f- k, V2 F+ m/ a6 O+ t
- module_param(ccnt, int, S_IRUGO);
复制代码
; g' l$ E5 W5 w7 x: U
( n' X8 e/ l$ \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 ~7 f, f" e H/ B4 D! r- X! g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 M( b7 o0 Q$ z) ~* H. U4 v0 F. o2 I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! T! j7 g7 b0 g; V' E; N+ h: X
9 P4 f' [# r% j3 _' n- N! l2 `; M# }9 x3 t* k! b, C6 c
|
|