|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 n$ x/ i! K8 C q3 u# v
- [code]EDMA sample test application, i# A: S9 }4 {$ N5 n4 @6 e) t5 a
- /*
) B% m$ V7 z9 N) x$ \# J; _ - * edma_test.c/ e9 U( {/ J. f7 Y' i8 g* h) G
- * J) ~4 W: k& f4 m- k! w
- * brief EDMA3 Test Application1 S9 \* _/ G% v9 Y
- *$ C' y7 h' `2 v a7 |
- * This file contains EDMA3 Test code.+ |* k/ W; J* ]. T
- *0 F3 F/ [1 G, B. ^, p8 F: ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& ?6 `$ p( z2 P8 R8 r0 |7 ]1 N& _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) S: W% f: n# v1 D0 e7 [ - * TO CHANGE.
" L/ Y) F$ d. g" {/ l - *
' x3 H7 d. n' h$ } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 {4 k8 n+ s* T; }; n3 ?
- *
8 Z9 \% H3 H( f - * This program is free software; you can redistribute it and/or, S2 y9 B, n. q+ T7 }+ K+ l
- * modify it under the terms of the GNU General Public License as
F# n0 A& }2 W, Q( Z0 r- W - * published by the Free Software Foundation version 2." E2 H( h8 b1 O. _: d0 d
- *3 @3 g# E/ ?3 _7 J# C m3 l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 [# ?$ o8 p' ^: ?+ \) Q; E7 y - * kind, whether express or implied; without even the implied warranty
. F2 ]( F' D9 u$ i/ W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 n, ^2 m3 b' u+ Z8 ~+ { - * GNU General Public License for more details.
8 ]- W5 O" k1 l' h - */
( c) A. A$ ]; @
$ V1 {3 {! ~( ~3 t" Q- #include <linux/module.h>' i/ Z/ \) Q1 S+ d) K
- #include <linux/init.h>
# G6 P" o6 q, h8 {2 L" M - #include <linux/errno.h>
' w. d# }+ U) ?0 K - #include <linux/types.h>
0 G, z5 R7 t, d5 |( d- _ - #include <linux/interrupt.h>) Q( {, _4 Q/ r2 G: G a; \! `
- #include <asm/io.h>
3 _6 c& a9 p: l. W) Y1 b - #include <linux/moduleparam.h>( w- d. M) q& X; @) V7 Q; n
- #include <linux/sysctl.h>
2 |# I+ P }' V6 d - #include <linux/mm.h>
6 ~# Z8 G6 }& U* u - #include <linux/dma-mapping.h>
: {5 P' n5 W6 T+ Z" U/ k- H2 D! H
$ v7 s7 S' w$ u0 C2 w- #include <mach/memory.h>0 n6 J- L- J# ?2 N; J5 E& s
- #include <mach/hardware.h>7 T) L8 p7 a _- F( {5 i" ^2 |
- #include <mach/irqs.h>
+ x% S% @- ?& q+ d - #include <asm/hardware/edma.h>
( k$ _( {$ c# J8 f* H0 J; x
1 ^2 L. b" c5 M3 q' Y- #undef EDMA3_DEBUG: t g& I, z7 z7 t$ o0 m3 W
- /*#define EDMA3_DEBUG*/
, Y2 A ~. h) e9 i( j/ R% G5 z8 g* E - - O- K. I5 N( G: r9 `% z+ K
- #ifdef EDMA3_DEBUG
( j9 d6 K3 W: U, ?+ D4 j& d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 N" i! F1 x# k# |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& u* p+ w& g1 {: G9 N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ f! {! d6 ?( |- P! H0 r |2 u
- #else3 t9 }! y2 x2 s! k
- #define DMA_PRINTK( x... )
5 E: k+ p/ S+ C - #define DMA_FN_IN
6 v- I8 K5 `( s( z1 S7 n - #define DMA_FN_OUT1 O& U2 | p7 e8 z
- #endif) a/ b9 H# @6 j
6 {' I9 ~5 o' ~4 q! H, ~# O; a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ Q2 w1 V% i( p2 @3 K- `9 C - #define STATIC_SHIFT 3
1 H T: `8 k/ h7 e& _+ B - #define TCINTEN_SHIFT 20
/ A2 `: t! s$ @3 }, u1 @ - #define ITCINTEN_SHIFT 21
& c4 U2 ~# S$ \" {/ e. D3 D2 f0 T/ S - #define TCCHEN_SHIFT 229 M9 p* f& x6 K* s8 f; {7 |
- #define ITCCHEN_SHIFT 23
. W }6 z# d; R2 b- A5 u
# _2 S8 D- D: n* @" W3 K- static volatile int irqraised1 = 0;( E- o w+ D/ f. a
- static volatile int irqraised2 = 0;
3 T3 j( C3 Q. ]# a
) G# S# Z- G4 G9 e5 f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& c1 T) \* `7 M& ?% x0 O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: F0 g8 K K+ C6 O! A W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ \, }3 l# U) Y1 t; R8 L; J
% c6 w6 h% Q5 c; N, o- dma_addr_t dmaphyssrc1 = 0;; Y+ Z: [( X! w9 q/ p6 v. m" R
- dma_addr_t dmaphyssrc2 = 0;
6 ^6 [# r1 f! f5 O3 A - dma_addr_t dmaphysdest1 = 0;
. W* B. n3 K" p0 h) y$ I! M. S - dma_addr_t dmaphysdest2 = 0;
& G& t) a% Q/ o q
* I6 }( U% G% Z5 H- char *dmabufsrc1 = NULL;
) L) \/ R+ E( {$ U - char *dmabufsrc2 = NULL;2 u' A: `$ E9 a' D9 d8 ?$ x
- char *dmabufdest1 = NULL;; d6 D/ K0 j5 S8 f2 M H
- char *dmabufdest2 = NULL;- X8 W. P- \ e$ Z2 N+ L, F( f
- 4 B* b c @/ I) V
- static int acnt = 512;
, T% y5 K) ?. l - static int bcnt = 8;' S0 d" S( }8 g# ?7 H5 T) f
- static int ccnt = 8;3 u U! e( V6 ^
* _+ t8 l8 @3 }+ [6 x: b- module_param(acnt, int, S_IRUGO);& w0 }4 j, ?/ Y0 p3 U' y# w. s
- module_param(bcnt, int, S_IRUGO);
1 K' U( G+ ?; h b - module_param(ccnt, int, S_IRUGO);
复制代码 . j& Q* \+ \6 v7 d' O. [6 a: ]; m
# c& p$ O- X# F4 [. G j. Y4 k6 {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, f P# e- ^7 S* d/ X; Harm-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 Q5 @1 [; i. W5 a. t* o5 w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* u: O N- I9 |/ y+ V5 L7 R0 O7 _# }% I1 g
- W! z/ q) L/ D+ m4 _, d- ` |
|