|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; m/ I! K5 [" I l$ {! F- [code]EDMA sample test application
$ W! o9 e, [- G - /*( o* @8 ]: o& C, O+ C9 ]' ]: Z
- * edma_test.c8 s8 j% U* J' r% ~5 o
- *, a$ Y$ m$ e6 i0 @, p% ~" }- l
- * brief EDMA3 Test Application' n1 D0 O& H1 m, }3 d0 L7 n
- *% j+ X; \) E) S7 b1 i5 v# L
- * This file contains EDMA3 Test code.# }6 J" D; L0 V+ Y; v6 W6 I
- *
8 O' H% [7 v$ t6 I" u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ L+ L; q# \0 \& {9 p, l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% `2 D, q; u8 y7 o8 r! Z/ B8 L* H: | - * TO CHANGE.
. k2 C3 h0 e) s) p y# }. Q - *
% h6 F" V7 `5 C& n! f# I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. S+ r. L% Z1 Q1 Z* ^$ \9 i' } - *5 Z+ y- T- i0 D7 i5 j
- * This program is free software; you can redistribute it and/or, v; S V" Z6 ~+ r A' x5 p
- * modify it under the terms of the GNU General Public License as
& X6 d* v, P, F0 p( f/ f - * published by the Free Software Foundation version 2.
. o$ y4 f } ?" S( T9 }8 S* A - *
1 y1 [# B4 f! Z! X, ~2 L2 `1 ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( l2 t7 c. j4 C- h
- * kind, whether express or implied; without even the implied warranty
& X+ C5 b6 u$ C5 R$ l4 e* I; K7 C2 d* t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, \( r" ~! V8 i0 m" ?* x/ g
- * GNU General Public License for more details.
# ?6 l9 A0 ]% ~. O3 ? R - */
, K& V |5 ]& F6 h) H2 U - 9 M0 g8 l! ^. F
- #include <linux/module.h>
& _4 O. l0 J% {* N - #include <linux/init.h>4 ~# ~) K" @) S- I
- #include <linux/errno.h>
. x. O9 Q* [/ U: w: ], I% a - #include <linux/types.h>9 e& t5 e8 V: p' r) r5 w* s
- #include <linux/interrupt.h>$ S! m- d/ \+ j1 L
- #include <asm/io.h>
3 Y: t! S' Q0 K* K) I W5 U - #include <linux/moduleparam.h>
- V+ J; K# P L$ {" b - #include <linux/sysctl.h>/ s) |% U$ O/ _' _. i: e5 D
- #include <linux/mm.h>
! J l" e3 r& C [4 S! { - #include <linux/dma-mapping.h>: J; @! a* C: g0 t: \- Z) x9 r
- 4 E; P& {; O! D( ~( |, O
- #include <mach/memory.h>
! e" j( F1 l4 _8 I - #include <mach/hardware.h>" {" x, C& e1 ^5 y
- #include <mach/irqs.h>" c, a% c8 b. A/ L8 ?! Y$ ~, v9 o
- #include <asm/hardware/edma.h>/ T! j6 n5 w/ m+ l3 p
- 5 Z% W0 s% s0 N4 K; C$ y$ H: T
- #undef EDMA3_DEBUG: \4 k6 S- X+ T. |* [
- /*#define EDMA3_DEBUG*/
& k& S8 U9 k2 J9 ~" R1 P4 s. H. P
" G0 X- d& n) c. T, n& s* E- #ifdef EDMA3_DEBUG
2 k. r' x: ]8 W; w5 s6 J$ l0 l2 i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; x+ \! F) t+ ~$ ~& E; t) K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 R) t- c$ ]8 v$ ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 \" H" E) A3 i. \, T - #else
$ _3 J" w' O! t9 b* Z& R - #define DMA_PRINTK( x... )
4 N9 F8 y" G) } - #define DMA_FN_IN
) j Q7 \' Y2 T; |* K y& U) e/ Q - #define DMA_FN_OUT7 N9 a: ^7 p1 `' z/ M# R
- #endif; J: } [& u) t6 l4 U0 t0 N
8 k: P; i9 c3 C# i( a2 {, T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' O/ O! b& _) Z" v - #define STATIC_SHIFT 3& I ]& k3 J( E3 s& W
- #define TCINTEN_SHIFT 20! }8 m; j* r+ k" U4 k5 G, u$ s
- #define ITCINTEN_SHIFT 21/ |; B% [3 z2 ~
- #define TCCHEN_SHIFT 22' M2 _. O' Q4 O; @! P" {3 a8 n2 x3 b
- #define ITCCHEN_SHIFT 23! R* s- x9 Y! D, }3 H
+ ^: ?; n4 f$ S- static volatile int irqraised1 = 0;
: Q' E U6 h: {+ W# Y- k2 N - static volatile int irqraised2 = 0;; ~ k y. q, f+ { M" n
- . `' ?, g8 }7 d" w2 K% f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 R$ M. |: P1 G; H g1 k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! b+ e4 z. |. r& c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 v& e9 [5 V9 @) ^1 ` - 1 v8 \8 y6 Q0 Z* I2 n
- dma_addr_t dmaphyssrc1 = 0;" c/ u/ @9 p# y" T+ d. y+ u/ }
- dma_addr_t dmaphyssrc2 = 0;
1 t% O8 i; M. D, ^, A% p - dma_addr_t dmaphysdest1 = 0;4 ?5 ]+ `& T" G( S' j0 d9 b" |
- dma_addr_t dmaphysdest2 = 0;
, \- u* E8 m4 R4 I9 ` B
0 u$ o% w) x, ?, i& ~4 P7 F& \- char *dmabufsrc1 = NULL;
! R* q3 Y2 ~: U9 z0 F - char *dmabufsrc2 = NULL;
( B8 O" z" V5 e X - char *dmabufdest1 = NULL;- J# ^: _7 P; w% r- M- I0 K
- char *dmabufdest2 = NULL;
9 S- N: u: u6 c5 q8 k$ g
8 L2 o5 ^4 C8 I; j! p( Z, O- static int acnt = 512;
8 Y/ @' j- E( x - static int bcnt = 8;
7 ~& p5 x: h g3 u2 o - static int ccnt = 8;
; r/ X, A; c1 W. H* v+ r1 h
3 g" C+ v, k' \3 F9 @1 g' m6 p- module_param(acnt, int, S_IRUGO);4 s* k& o6 o8 U* B, Q3 y5 f( y: A5 X0 Y4 e
- module_param(bcnt, int, S_IRUGO);( s0 @2 ?; e& Q! d' C9 }. l
- module_param(ccnt, int, S_IRUGO);
复制代码
$ }% e2 Q% J, Y |
- @4 F' f: U" j! t" |: r* I9 H& n. I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; @: B8 p6 m& I7 Q1 t/ k: u2 q8 V3 Aarm-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 ?# X6 J) S5 ?3 ?+ W& B' x8 }1 F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) w) i9 }" u+ q2 b6 r
3 I# i: {5 ]$ D+ e- ~% B3 P1 C7 N$ r$ R( h {6 n
|
|