|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 @, z! C9 ?5 v, E$ `# p
- [code]EDMA sample test application& g! S* \0 H8 ] G" H% K7 E" f" H: m
- /*+ w& o8 |) e4 L; ~% q: c1 n
- * edma_test.c2 E- Y! l6 g' e' I( l2 Z/ t
- *1 n8 X# y3 g1 t. c7 ?$ K" B
- * brief EDMA3 Test Application/ O: ~3 o& V- r; @
- *
% f$ W- ], D- `' c" N( b - * This file contains EDMA3 Test code." [ X$ ^$ [1 p2 M8 ?( A+ i
- *- M, [) r/ w: w: ^8 I& X1 ^8 l- u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 z1 @8 Q, R$ X% d5 e3 B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ b% b( _, q3 z. N
- * TO CHANGE.
7 c) X# [/ u# S0 n% T4 W - *
6 y, ^+ M7 d- s" @% m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 Q4 G+ Y8 f( E9 B3 i3 }
- *( i, l9 ]0 j5 V( Q! E
- * This program is free software; you can redistribute it and/or
% z4 N6 @8 G* c1 B6 q4 s - * modify it under the terms of the GNU General Public License as7 c( p- v, e% n: J
- * published by the Free Software Foundation version 2.
+ Z; V3 V9 O' s, ^. { - *5 J3 w6 _) v" w4 ]: C& M3 d5 m- f6 Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 I- ]+ U7 _* D4 N; K6 a - * kind, whether express or implied; without even the implied warranty: H, `2 @/ h. M0 l% `; y+ o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 s2 v" Q: s( k - * GNU General Public License for more details.
9 g+ W* k, N* c/ N3 ~ - */+ n% J# g+ h6 ]/ k( Q8 H8 A% s- {; Z
: ~7 p- Y2 i, F" n8 q- #include <linux/module.h>8 x/ H' }9 [1 }3 k9 ?
- #include <linux/init.h>7 j, M3 d; ]9 |+ n; W+ z
- #include <linux/errno.h>
; T0 D& ?9 ^0 n7 B! i n, Y2 r* ~ - #include <linux/types.h>/ S x) a5 u$ I) Q2 g% x. Y& `
- #include <linux/interrupt.h>
I- J0 ]( ~8 W8 y0 p4 Y - #include <asm/io.h>4 N' C7 w7 C" [# o3 i9 U7 j
- #include <linux/moduleparam.h>
) _+ h* k! O. [* i- E% b# G% I - #include <linux/sysctl.h>
5 B! e: p, W0 x }' V - #include <linux/mm.h>
# K# N6 [$ Y3 L4 o2 v% ~ - #include <linux/dma-mapping.h>
. e* v, b* }5 ?+ R. J1 F' F2 |. A" | - 5 m- R& T/ ]0 [
- #include <mach/memory.h>. I) g3 u" ?. b6 J E
- #include <mach/hardware.h>/ K+ i, A. i9 p& V0 I
- #include <mach/irqs.h>. o' Y% a+ }. a
- #include <asm/hardware/edma.h>
" ?8 a* @( ^3 `" {8 f: l$ z; c/ i b
2 z: n0 Q5 M5 W* P- #undef EDMA3_DEBUG
& M! `% ^; ]$ } - /*#define EDMA3_DEBUG*/
& x8 V" j9 c* N; v; z( F
+ X1 {5 h0 X+ A R7 A- #ifdef EDMA3_DEBUG
- m# c! `" g9 K; R/ E/ C8 W6 {+ ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' P7 e! p; M9 d j& P/ E" c7 L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 P$ ^1 w$ l2 ^' X( N, N% r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" _4 W1 H/ T: v - #else! `/ N, ~+ {0 Y( K8 k# V6 Q& \
- #define DMA_PRINTK( x... )
1 X5 F, _+ f, {. B7 D - #define DMA_FN_IN# G* b0 H0 n# M
- #define DMA_FN_OUT
8 |7 ~3 ~/ z) R - #endif9 o9 |+ y$ L* [' D1 F
- $ w# S8 a8 a4 v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ Q/ Q$ B3 F! v - #define STATIC_SHIFT 3
* n4 c* ~* Q8 L: ~) I - #define TCINTEN_SHIFT 20
. R: P# h* U; D5 K" t, E - #define ITCINTEN_SHIFT 21
2 x; ]1 y V' [: Q1 q' A% y - #define TCCHEN_SHIFT 22
^3 P& g4 J6 T - #define ITCCHEN_SHIFT 23' F3 g7 }# j i3 Y
- $ M; A6 T1 _4 g# l( \' ?
- static volatile int irqraised1 = 0;
# h- Z8 H. D; r1 o, X5 { - static volatile int irqraised2 = 0; j+ m {" U0 S. }8 F6 @
- ' J7 j9 ^( [! [! V& g; m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ \" u- L2 S1 n8 {1 h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( q4 [6 u# Y2 ^) P$ @, x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 ~2 S4 R" V2 Q; p( ^9 F5 L1 h. K7 B - & z0 ]9 R2 K7 d. S- g9 x; X$ ]
- dma_addr_t dmaphyssrc1 = 0;
* a/ b" i' p- @6 [1 C- x - dma_addr_t dmaphyssrc2 = 0;- |. n7 L- D2 y' {( d8 `) U- Y
- dma_addr_t dmaphysdest1 = 0;
; u' Q& m4 F2 {* Q- P - dma_addr_t dmaphysdest2 = 0;2 x. Q' V$ p6 b2 l
. p* z6 Z4 [3 \, R0 u- char *dmabufsrc1 = NULL;
7 V) H$ M; B3 {' O" _+ g( @ - char *dmabufsrc2 = NULL;$ E2 A% M' I( H9 G* ]. c
- char *dmabufdest1 = NULL;5 @/ s8 n" b4 t B4 n
- char *dmabufdest2 = NULL;: [, d* z l) A7 Q8 |2 X1 ^
# {7 Z8 M- Y, X" o1 m, a6 Q" w- static int acnt = 512;
- I1 F) [+ ], V9 |0 r" x - static int bcnt = 8;
$ s( j* b/ ]( e3 c5 o' u - static int ccnt = 8;
' A3 b B: r+ h1 T, V M
6 x- A6 C' E; n; o' U- module_param(acnt, int, S_IRUGO);* K; Y5 {0 z, c, V5 y
- module_param(bcnt, int, S_IRUGO);' j* @6 m) U k ] @
- module_param(ccnt, int, S_IRUGO);
复制代码 " b* L0 i1 m* e. v5 }: ?& }5 a
6 a# s/ t( |, D* D) U9 v- n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( Q& s S# K8 A) p ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 c$ i5 d% [( f- ]. l/ t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; P6 ~) `. h g+ m" i" b$ i! n3 ^6 M6 h5 W( {' i! E4 t) _
) U0 `! G4 B6 p6 M& K) h+ F* B |
|