|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( z2 k8 |# Q0 G( v7 y) b- [code]EDMA sample test application' |/ x5 y e' R7 U2 i2 A
- /*4 |+ ^- p4 @ W4 H
- * edma_test.c* {5 N; B/ X0 n1 {5 L' _
- *
: U" N. E4 q+ b- V# }4 U( T% g - * brief EDMA3 Test Application
1 \$ ^) K; a" s! m- s - *
# \+ ?! T0 U/ W: o! P - * This file contains EDMA3 Test code.1 ]/ X' t) P7 _7 W% T
- *
8 g% z! Q7 i9 t* h+ S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ V2 S& v/ w, P `* u( }: f; b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( J* u: I/ o3 G0 k" B - * TO CHANGE.* A8 Q( Z: \/ ]4 B# X
- *
( j8 i, u& J+ Y0 Q6 ^$ | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 N$ E" v |+ s8 }! D
- *0 {$ P- {' ~( }
- * This program is free software; you can redistribute it and/or( v% E) k) ^/ k! h6 i B+ m
- * modify it under the terms of the GNU General Public License as
0 u, p) C6 h' B# _1 K! i1 v - * published by the Free Software Foundation version 2.
8 e& J$ T1 L" K+ d, `* g - *0 R7 y, b4 f4 j5 F- `% @+ z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! \9 s0 A: a0 C0 I3 K6 r8 g
- * kind, whether express or implied; without even the implied warranty
5 u n$ [9 V. _, u3 f+ w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* [+ M+ j! A' H/ D% G) T8 T7 V - * GNU General Public License for more details.
3 i3 N! R. R5 |3 h D - */
' z# r. m" x9 _( r. { - * h' v" M' R! _2 c0 i2 J R
- #include <linux/module.h>! R* V! E! l8 Q; f! Y- b! ^. v
- #include <linux/init.h>
' j9 {. h5 z! e( H0 j9 a, S - #include <linux/errno.h>
/ m4 e3 V. s4 h5 D - #include <linux/types.h>; K: K( _$ }6 o* r
- #include <linux/interrupt.h>" a M6 G2 q( e' V3 A8 ]
- #include <asm/io.h>
( B: C8 `$ O( R" c, i1 J. l, P - #include <linux/moduleparam.h>
; m% U$ U9 K- F5 J& ?6 \) y - #include <linux/sysctl.h>
' r$ ?; Q" G& b, P9 m }, ]3 x - #include <linux/mm.h>1 [0 j3 P" y* t* Y. J
- #include <linux/dma-mapping.h>0 @& L6 O& O7 y9 ^7 o9 {
- * L( K, h" ~7 z
- #include <mach/memory.h>
- C6 l5 ], I+ ^/ e9 j2 B - #include <mach/hardware.h>
9 |5 t9 o$ N4 p- C } - #include <mach/irqs.h>* y' Q! E1 L: p! T5 z4 W& z
- #include <asm/hardware/edma.h> R0 Q1 H7 y$ G' _
5 e/ S4 [6 D6 M8 D, @4 N0 Q5 M, h- #undef EDMA3_DEBUG5 F* [+ [( i/ A, w
- /*#define EDMA3_DEBUG*/
+ C+ ?* B5 w1 k! U
. H! W! \2 u- j% D- F9 i6 d' ^- #ifdef EDMA3_DEBUG
4 t1 W! y( M: E# [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 s% O) h3 D. l3 G9 M8 c5 |: s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ q( ^' u0 ^* R5 `# B8 i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# x7 k' V- G. B8 L5 f7 Y8 p - #else
2 r3 c1 Y4 X& b- ]& [$ ^ - #define DMA_PRINTK( x... )1 k2 T4 A! m: {4 N, t
- #define DMA_FN_IN
" `/ j) _$ p2 R6 p A' s - #define DMA_FN_OUT
. B$ F8 m- l1 p6 R/ R) n; t, T' H - #endif
6 M, q6 m6 }6 X: Y
S5 B4 ~3 P0 L) o: A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( X G5 O) w5 H2 D& b - #define STATIC_SHIFT 3 `. c. z- ^4 N6 a7 @
- #define TCINTEN_SHIFT 20+ [3 E- _7 M$ G& l
- #define ITCINTEN_SHIFT 21
& \7 t- {" L- s9 R( ~- C/ ? - #define TCCHEN_SHIFT 22
8 ^1 s6 e, J7 Y% X2 D - #define ITCCHEN_SHIFT 23
|% k& X6 G9 H) C3 C
p, v# K6 Y c" m- static volatile int irqraised1 = 0;! [$ a+ |9 E3 ^! o7 A8 J1 s
- static volatile int irqraised2 = 0;% U J" W/ H" ], b& P0 G$ w
; C+ Z' E8 I# Y% \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 j' n' B! `( j4 S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- y, f7 K1 e/ E; K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' Y, q0 X3 x3 r0 k - 9 g2 f& d5 S) i3 C7 F+ ~. N
- dma_addr_t dmaphyssrc1 = 0;% v* U$ m0 S9 R5 E7 @
- dma_addr_t dmaphyssrc2 = 0;
+ G1 k. |9 j5 q4 e6 b. V- {/ M! _ - dma_addr_t dmaphysdest1 = 0;
# F6 L' K7 z9 S/ F" w$ {$ E - dma_addr_t dmaphysdest2 = 0;
& ?: @5 _$ e9 l - 4 I3 |) ?& K( R2 \* r9 j# j4 O2 `
- char *dmabufsrc1 = NULL;
l# s- v% u% \+ U/ C" ] - char *dmabufsrc2 = NULL;6 t% n9 ]' k" M! D7 c% X
- char *dmabufdest1 = NULL;+ X+ y3 I1 `% Y8 _) I
- char *dmabufdest2 = NULL;* l, ~1 w) O6 o, P% i% j
- 0 k7 Z& h8 o7 E; d
- static int acnt = 512;
! ^, L1 T7 W7 Y6 z/ B - static int bcnt = 8;
! A2 p3 R$ d% r' c - static int ccnt = 8;3 M. K+ r3 e) n. u9 B5 ~0 e
5 Z8 S; X D/ B- module_param(acnt, int, S_IRUGO);- e) w7 ~* y5 c- u$ z n
- module_param(bcnt, int, S_IRUGO);
" Z- p& \ R* E3 R! g; f: j - module_param(ccnt, int, S_IRUGO);
复制代码
9 [& ~# [) R J
[! J& v9 |( ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 l4 {7 J9 b( v: b6 E2 k/ L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 M1 ^" B+ T- n( x' K( O' L) n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* l! Y5 O* x. ?3 e3 ~0 w6 V$ s( N6 @8 @4 \
5 P/ x( z# ?* L5 i |
|