|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " c, l# A7 H4 T& i2 Y& X: B, M0 F* s
- [code]EDMA sample test application
" D1 b. L* m5 C$ I: u9 z0 N. w - /*
- V H9 k8 v) n' P4 H3 w- ]* V - * edma_test.c4 i% U6 ^! _% u+ i3 M# {/ |8 U+ n9 h8 F
- *
8 s5 U5 p' C |" U* U1 L% G - * brief EDMA3 Test Application
' Z2 q( A5 ~ ?; o - *+ f" ^- @2 O& l& h6 {( S
- * This file contains EDMA3 Test code.
3 ?4 l8 I. O. h2 w9 l0 N; Z3 O# b - *
) P& q4 Y0 o; }, s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' b) O4 |$ c" n6 V D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ I" L+ F# c: m ]( o4 K8 e) r
- * TO CHANGE.
/ u( y/ Y ^% _- C - *, s! U! w& e: x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 q) {& H0 a# n, t8 @. X7 ]
- *
4 q, d9 N, S! t - * This program is free software; you can redistribute it and/or) k8 A, ?9 ~! Y4 o% V: Q5 g; X
- * modify it under the terms of the GNU General Public License as
) S j4 I, A+ |- c4 w' J5 L - * published by the Free Software Foundation version 2.; U3 m+ d- A7 j' i6 D) o
- *- S U9 W+ g/ m* h- C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 j" D, b5 C: ~4 b
- * kind, whether express or implied; without even the implied warranty
( ^. F6 I1 n1 E, h" M7 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* C x& L' {5 ^8 \7 h
- * GNU General Public License for more details.
: m0 D% O; R* \; U/ \5 ^ - */
0 [ ^- p# q0 {0 i$ D+ A
! r/ c3 c) {- e4 G2 [( `- #include <linux/module.h>
3 M) h, l$ H0 M" G9 N% W - #include <linux/init.h>
2 A0 p8 d% {- M' C' q - #include <linux/errno.h>
$ v% e# Q+ Z) { - #include <linux/types.h>
0 m6 z1 O) u$ l2 L1 ] - #include <linux/interrupt.h>! w& [$ ]6 s( d8 g
- #include <asm/io.h>1 L2 L& T* D8 o+ n
- #include <linux/moduleparam.h>! W. l9 u& c) O3 j7 Y& z
- #include <linux/sysctl.h>
+ G* l+ U* i( L% A - #include <linux/mm.h>
7 P: I5 P: ^ ^ - #include <linux/dma-mapping.h>/ t! n' R6 S& X: {6 q' a _
* c, F; |5 A& P) r- #include <mach/memory.h>
% e% t/ e9 K n; ? - #include <mach/hardware.h>
' |% r& N0 v4 F9 y4 \* z0 e - #include <mach/irqs.h>
9 ^% f: R `* J" |4 ]( r; W d* V - #include <asm/hardware/edma.h>( `5 m" ~- a1 F# X
- # j z+ _2 @3 L) {, ?) ^# V+ G
- #undef EDMA3_DEBUG
! S! L5 e9 k1 f: q - /*#define EDMA3_DEBUG*/0 K( a, ^4 q; c- |7 u
- * B! N2 t7 H, ]& v+ V3 g' Z( X7 _
- #ifdef EDMA3_DEBUG, e( `/ l _6 f- j/ F0 E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 j+ L6 v2 k. J4 Z& _! i0 q7 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 I, L) p7 x8 D- V) K: B. M, C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 c* {" u( h5 K7 A- Z* i# ` - #else: j5 V( Z0 Y1 B: l+ I
- #define DMA_PRINTK( x... )
2 i" D+ l" o% P& C - #define DMA_FN_IN% T F7 B- s% \) ~1 q5 ^& v
- #define DMA_FN_OUT
" l* L, v3 L3 {% `! S/ a6 { - #endif9 E6 S. H4 K6 z3 Q, \
- , A) X. w' T2 q0 M# ]1 N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 z' x* C' q, Y* E% P, Q" L# W, P - #define STATIC_SHIFT 3$ K: F+ t4 |/ O9 x3 J
- #define TCINTEN_SHIFT 20- ^$ O$ `% c, D+ ~+ n0 P* c
- #define ITCINTEN_SHIFT 210 ]. N8 D( W2 s/ k4 ?* d
- #define TCCHEN_SHIFT 22
6 Y# q# I+ \( e - #define ITCCHEN_SHIFT 232 `& l" q5 O& M: m
- ! w" ~" @1 n/ _: g) ^: T9 R6 E
- static volatile int irqraised1 = 0;5 I% w$ v# V3 }( }
- static volatile int irqraised2 = 0;
$ v# e' G+ ~6 B, y& F - ; M# Q! _1 N0 W: U* } o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 I/ q: X2 ~/ ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 k' a! F: p7 P4 O# I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 n6 H; ^# r1 m
4 ]% F# b! \8 C% C3 [- dma_addr_t dmaphyssrc1 = 0;9 T! `2 A& M& S; f1 y, I' S# j
- dma_addr_t dmaphyssrc2 = 0;' l/ H( ^% B* ^7 W
- dma_addr_t dmaphysdest1 = 0;- G2 w% a1 H- Z. r3 h+ p- @4 m
- dma_addr_t dmaphysdest2 = 0;2 t+ }9 V0 }; j% j1 X- t' ?
- ( H, b" q+ w a" ~* i
- char *dmabufsrc1 = NULL;
$ Z* `9 t" \1 S( n+ D$ g; b3 n - char *dmabufsrc2 = NULL;* q8 d5 L& j/ s# o7 Y
- char *dmabufdest1 = NULL;
# t5 ~ D! V; w3 g3 Y - char *dmabufdest2 = NULL;) l: X4 R% N3 X1 B
- ( x5 S0 M) i, n7 B
- static int acnt = 512;
) m4 X1 C @" T! w - static int bcnt = 8;1 O' w/ s- E- {8 }
- static int ccnt = 8;- E" n; C/ K4 E
! x- Z {' u; X C6 Z2 M) f) K- module_param(acnt, int, S_IRUGO);
' v1 ~! O5 [' J) Q6 q4 { - module_param(bcnt, int, S_IRUGO);: _. n6 v- c1 {
- module_param(ccnt, int, S_IRUGO);
复制代码
5 k( O# F6 w0 r$ i+ C7 {$ P6 Z3 L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: R6 D( z& p$ @6 t$ b- C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 J9 }: P& H) q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% j1 r6 A% {* }) F; f2 H1 e0 X$ d: z- s' }
, P; Y* E; j8 f4 e |
|