|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) Y7 x( ~, |, P; {0 A% \1 ?
- [code]EDMA sample test application1 H0 d% C7 C2 J8 i, }
- /*( ~& U; M4 L+ `' O$ s$ D' W
- * edma_test.c1 T7 s+ |9 _3 \6 O! o; f. l* E
- *
4 p( |, R# E5 u# L! s. t) {9 k! z - * brief EDMA3 Test Application
3 _, Y9 W# f- `7 X4 n - *$ [5 _9 p# c' Y$ a c, V, }% g4 Y
- * This file contains EDMA3 Test code.; h8 |* u( D) E5 X
- *6 |+ s, B7 \' U7 O- ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. ^7 r3 j( I8 D# g- w7 S0 U$ H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* H- e# L- X' I1 O; Q% T* x - * TO CHANGE.1 J l6 ^5 s% P) F
- *
% P, c3 T! O; Q$ N. {4 G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; T; p% Q4 K- u - *
, I. R3 r; O& K9 D( d - * This program is free software; you can redistribute it and/or, H8 }* \5 V0 |
- * modify it under the terms of the GNU General Public License as
9 i4 b: @! c a$ C7 w - * published by the Free Software Foundation version 2.+ ~- E3 R% f. U# j+ s4 J7 k5 l$ F+ A! h
- *6 x% n$ Q2 S& s- z! z9 c6 G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& z# F3 |8 T& ]3 R - * kind, whether express or implied; without even the implied warranty
1 ]8 Z4 j# O/ x! D. _" E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 P$ M! c4 [2 O& b" M5 b% j
- * GNU General Public License for more details.& [/ G( f- o( i0 F
- */6 v! O9 A" J3 l: s3 u
- & s) ~; ?4 g' q& \' z" M" x! T V+ x
- #include <linux/module.h>* S; w2 c2 c$ T. ^
- #include <linux/init.h>6 N6 L+ E% Q, J+ ` f" g- x" ^
- #include <linux/errno.h>
/ \- S5 O9 w: J+ M S3 a3 D) U - #include <linux/types.h>
' G& y K# K( q9 u8 I+ u: ?2 |5 A) Q - #include <linux/interrupt.h>8 A' S% b6 b; ]: }4 W
- #include <asm/io.h>
" k4 K( T5 ~9 G( d$ D$ o0 C - #include <linux/moduleparam.h>/ h& N3 n( i& q8 @9 S9 O. N) T6 q
- #include <linux/sysctl.h>' t# k& R2 d' n$ Y* c$ J4 C9 n
- #include <linux/mm.h>
9 p% i" @; p' O7 ^) c i- W - #include <linux/dma-mapping.h>
# H) l: v& ^, L0 ~4 V, i M. v - ! D2 j- Z/ [) z I, e/ [
- #include <mach/memory.h>5 Y% j" r) q; R4 N* t
- #include <mach/hardware.h>7 j: Y; Z/ b) F: ?6 w
- #include <mach/irqs.h>/ R1 |% e: N6 D1 X
- #include <asm/hardware/edma.h>, G$ U5 U$ N: V
% u t: w4 [/ [; D- #undef EDMA3_DEBUG0 ]" r9 s( ]% e6 `
- /*#define EDMA3_DEBUG*/
: ]9 n4 r- G# M. ]8 n
( n( u7 X6 a6 Z! J- N6 p' x- #ifdef EDMA3_DEBUG: j$ p2 j Y, m" m% ~ _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 j$ N6 |) J7 C- O5 i' i4 h* g, t1 C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ }9 m/ n0 q, J/ Y. Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 e8 N% H7 b9 h& ?% U5 k- C - #else
) P9 @2 w3 r& r( h% r" n - #define DMA_PRINTK( x... )
' z8 p, M) {( f: J4 y, Z - #define DMA_FN_IN
, {0 t" E4 I. D" `0 Z# U$ \ - #define DMA_FN_OUT" m# W+ O6 o6 \
- #endif
$ C2 D0 ~# T6 j/ I7 _ - 9 l0 V- \; C" b0 y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 W1 n. y. f% B3 d8 Q: j - #define STATIC_SHIFT 3
1 t& C3 s* L, J* _. V) T1 ]' i - #define TCINTEN_SHIFT 20+ q: _; N: R5 L
- #define ITCINTEN_SHIFT 212 z# |6 X3 ?5 B8 p! }& D% s+ @- z
- #define TCCHEN_SHIFT 22& ^ O5 t( j6 J* a2 f T$ W
- #define ITCCHEN_SHIFT 23* d7 {2 M1 V, w/ j. Y
' ?0 o. c+ X' n1 [8 h V8 L/ E- static volatile int irqraised1 = 0;1 G% Z" v8 P, o' `# A( ? Y
- static volatile int irqraised2 = 0;
, e i6 L7 j8 ^5 E @
# n. w; |7 s8 R0 @: l& a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) ?6 b! @) l1 T$ ^0 ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; S& J4 b9 N- N6 t, n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- q$ u, f+ `5 n% U - 4 h. w$ M1 g" ~$ I9 d% L( G
- dma_addr_t dmaphyssrc1 = 0;% ?0 K( w z* B" [. F
- dma_addr_t dmaphyssrc2 = 0;3 o9 o! N2 k3 Y. y7 T
- dma_addr_t dmaphysdest1 = 0;
$ H( o) @8 t- X3 D% n1 O i - dma_addr_t dmaphysdest2 = 0;( c+ z3 p& b7 C0 T5 T! w# h, T
" ?: k( u6 ~& @- char *dmabufsrc1 = NULL;! q. b6 c. V) l2 E0 @) f2 n2 ~
- char *dmabufsrc2 = NULL;
- |& d8 x8 \$ T - char *dmabufdest1 = NULL;( U P) M, C, @3 j4 U/ h
- char *dmabufdest2 = NULL;2 U: D( p2 a; I# d0 T+ a$ i% D
- $ O/ ^# _5 I2 | ~, |
- static int acnt = 512;. G: r, \* U' Q* _! W* H" ]
- static int bcnt = 8;; e/ U3 [- g6 V2 o6 D
- static int ccnt = 8;; c3 m, i# i" ~( N$ U
- 2 j9 _+ a9 S: T' J5 z O
- module_param(acnt, int, S_IRUGO);
& r, H& _9 U, ]) {5 { - module_param(bcnt, int, S_IRUGO);, L- S# z: W% ^2 p
- module_param(ccnt, int, S_IRUGO);
复制代码
$ k" g; p; U- A0 c- H; K5 P2 _) b( e, o0 }9 V" `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ v- A+ E' M: R; K% Y$ carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 p7 ? ], j Z1 o1 \4 r! I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, `) L' F3 ? Q9 `; L4 ?% P# O! w6 J
- s% K/ Z( T# u* J
|
|