|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; J% V5 s U6 S$ S, P- [code]EDMA sample test application; `+ h0 I6 D7 I7 [& A
- /*4 s2 ?1 q% {" e# w4 L
- * edma_test.c
4 F, H/ u6 K) P; l1 V& A+ d - *" b2 Y( U% G, R# N9 z g3 n& y8 [: d
- * brief EDMA3 Test Application# b) k: H, K0 R2 \
- *
* b# @, U- v P) J; f9 K - * This file contains EDMA3 Test code." ]1 {) g# U4 I" B2 ^# Y1 j# t
- *
4 n. K2 }; s( @" |( d1 U/ t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* e2 U: ^7 G5 P' s+ F1 [4 _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ F4 k$ e7 Y, F( F8 ] - * TO CHANGE.
' l9 { S4 A9 u' x @ - *
$ b0 C6 \+ Z0 _3 h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 Y" ~$ V( f F. A - *
/ H; A8 G X# w* H - * This program is free software; you can redistribute it and/or
' }, c: O# V% K2 b3 ^ - * modify it under the terms of the GNU General Public License as- P- o" U. k) D) W0 S' l
- * published by the Free Software Foundation version 2.
& ]( W: F# v" i9 i2 S/ D, P - *3 K6 {6 E) k# X+ \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, P# j2 B8 g5 Z
- * kind, whether express or implied; without even the implied warranty. Q/ z' t& `/ _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; f% N }# n- ?$ Z2 n
- * GNU General Public License for more details.
0 K* i/ V7 ?" U7 o. b - */
: C; N* P7 o4 A" p! S) f; u - # X/ o" C. U o' n4 @
- #include <linux/module.h>8 \) F+ K* O- D6 u& Z+ l
- #include <linux/init.h>
+ r; g, T/ t+ {1 ]# R2 I - #include <linux/errno.h>, \6 x" o! o! U L1 i
- #include <linux/types.h>$ Q F0 m$ w) @7 m
- #include <linux/interrupt.h>
4 U; S8 ^" f6 N" | - #include <asm/io.h>
5 f3 U: f7 u% o; L8 m - #include <linux/moduleparam.h>
$ q! H4 p* Y- [* N5 S. z - #include <linux/sysctl.h>
' M7 |& r5 D, e6 a4 p1 S - #include <linux/mm.h>
; K2 G6 h, P6 V9 r ^( s: [( i: | - #include <linux/dma-mapping.h>7 ]! ?) i. f& l2 v* r/ y
% R/ R: Q! v5 ]8 X5 t- #include <mach/memory.h>- n' X) R$ ^ _6 S! |' m
- #include <mach/hardware.h>* k4 x4 m* i& n o w {
- #include <mach/irqs.h>
0 A1 a1 e% o3 W7 f# G1 b- z a - #include <asm/hardware/edma.h>" q' `$ _! ?* P- o( k' P3 ]( n
- . Y1 r4 j/ l3 o. b
- #undef EDMA3_DEBUG& B5 t5 W4 n5 @ W5 l8 A0 C. Y. M
- /*#define EDMA3_DEBUG*/
/ w5 ^! }& Y% R' |* V7 V- Y; K% M - 4 v6 i8 ^+ e4 g# y& A
- #ifdef EDMA3_DEBUG
9 n, T+ B3 P6 k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 o9 M7 D5 [# S# h+ c! c& S; { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), K: f2 F4 K- ]. o6 y% b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 Z* o- \' C# l
- #else
& ]2 e6 v9 s" j' F2 x3 w0 X/ | - #define DMA_PRINTK( x... )
* V5 @: G2 a6 j( Z; C+ F/ ~2 ~8 Z - #define DMA_FN_IN, J9 U# Q; r9 k1 J. z
- #define DMA_FN_OUT% v3 y: }: x9 m* Z' O2 f% g1 [
- #endif
0 L' [) P6 {4 {; i0 B
0 D$ }2 w G% j/ W- #define MAX_DMA_TRANSFER_IN_BYTES (32768): l- ?. i9 @; A4 p
- #define STATIC_SHIFT 3
/ `, ~& t4 a" P4 C - #define TCINTEN_SHIFT 20
2 A8 |0 S8 G3 q- c( {% t% u2 W - #define ITCINTEN_SHIFT 21+ y4 L( f0 n" V
- #define TCCHEN_SHIFT 224 _9 |9 G" e0 D& U+ @1 F
- #define ITCCHEN_SHIFT 234 K, [( a: P( U. _8 Y
# w; Q* L0 I4 L2 F- static volatile int irqraised1 = 0;
8 d0 S! R2 K" X. y8 W3 C5 S - static volatile int irqraised2 = 0;; N4 G& |! |& u- ]
- % W5 x2 Q) G7 }; Y" m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: V( |9 K* N {; e+ J7 X* s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ H1 ^' r; T6 `4 v9 I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, H: R1 [1 \/ d$ O& E, B4 H
* g: L2 |# L3 s6 P% N/ H- dma_addr_t dmaphyssrc1 = 0;
$ l- q } m7 K. T. ?+ |# x6 E - dma_addr_t dmaphyssrc2 = 0;
: I+ \2 [" T* w7 B' p2 \2 j - dma_addr_t dmaphysdest1 = 0;
, D+ ^& n8 [. [5 w: I/ B - dma_addr_t dmaphysdest2 = 0;
* w- k2 L$ x. }% h0 S, x - * Y" ?, h1 f7 h. [3 r
- char *dmabufsrc1 = NULL;
$ [8 l7 O t6 {1 Z$ J6 `1 u3 L% ^ - char *dmabufsrc2 = NULL;
; z3 z( \% b6 Z - char *dmabufdest1 = NULL;- p. W# ]! W: d$ l& b0 N
- char *dmabufdest2 = NULL;
& ], i( O, H( e$ u- ^ - ( O6 y3 ]2 G8 K# n J& t5 r
- static int acnt = 512;/ b3 k. q) ]# z6 v5 W
- static int bcnt = 8;3 Y5 Q# M! z! @ f$ U( S7 c
- static int ccnt = 8;; W; d: }$ j4 a/ ^, w, n) ~- D
- 4 k' Z7 {. H6 \
- module_param(acnt, int, S_IRUGO);
! H/ _0 X7 X- Q, c - module_param(bcnt, int, S_IRUGO);
0 {0 P: d1 b. i - module_param(ccnt, int, S_IRUGO);
复制代码
5 ^* h, S4 h, K+ T- r3 K! S$ e7 N8 T+ F; [% Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 `7 Y5 C) O% i3 `% Q- s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 M- ?. v: b" _# y& N6 S x% b: A! S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, X4 w, h: j/ ]6 r7 W% C
+ [& E @0 ^, E+ X5 a, R% V% Y/ s" c8 S
|
|