|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
]$ y+ s. I$ p; g- H' R/ h- [code]EDMA sample test application
: L. e+ E4 [% M7 w7 U: R0 h n: f/ K - /*
5 [* b" z) j) U6 M - * edma_test.c
- o u9 W% O/ p2 t8 n' E - *
+ o+ o3 V6 U+ V! O! F6 E - * brief EDMA3 Test Application
% l: P9 s) a0 ` e( W9 q. L: a - *. N# ?# y4 c- ?- r6 S
- * This file contains EDMA3 Test code.
( V* j2 I- i3 g8 _& \( h8 F - *8 T0 x" C5 X2 o* \( @( ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ r( \" `3 _- ]; ]% r5 w1 z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- _3 f @1 I% {. F$ V: X - * TO CHANGE.
, z# a/ X9 n* A! V. { - *
$ o: ?8 B1 A0 [' L6 l+ }, Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 n, t, c' P0 Y9 `3 b& v
- *3 ^- [' y# }& T- @0 z
- * This program is free software; you can redistribute it and/or
6 ?/ T. I' f. E5 J8 {, }& F - * modify it under the terms of the GNU General Public License as
9 X% B2 s2 M2 u) B- h6 u - * published by the Free Software Foundation version 2.
! _" x; J9 O: N( }1 ]3 N- O, } - *
! v+ m( t' u/ Y& \0 g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 {- G: u/ Q9 V' c) N
- * kind, whether express or implied; without even the implied warranty
9 p7 I3 R3 M! { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: }9 B+ E. u' h4 O w9 M; F, k - * GNU General Public License for more details.
! Z1 N( A/ _- [0 L" p4 y, o - */
. R, w, b' ^* q+ q0 c6 W( F
/ ?4 a5 K' |2 ]6 ^$ ]$ k/ f- #include <linux/module.h>
1 s- E! L. G; E/ i8 `6 }' E - #include <linux/init.h>
7 v) z7 U, p' c3 i( ~ - #include <linux/errno.h>+ c8 c9 a. o' W b
- #include <linux/types.h>
# y3 {! }5 p" _, _2 V; d% P0 r - #include <linux/interrupt.h>
v0 t2 p* \4 C; I - #include <asm/io.h>
) u8 N% j$ O) S8 Y8 B& q& H K9 T - #include <linux/moduleparam.h>
! v$ ~& r" ^/ N& n" a1 F8 _2 i$ f - #include <linux/sysctl.h>
p b# z' q( ^# e; w - #include <linux/mm.h>' m# S R" Q. a% r
- #include <linux/dma-mapping.h>* _# S' Y- Y# H4 C
- 8 v) }6 W3 Q# @5 W% x, c- }
- #include <mach/memory.h>
2 y/ \: i4 |9 c! x1 O8 x - #include <mach/hardware.h>
4 d4 t+ g9 H5 I# e7 Z9 Z/ v5 @ - #include <mach/irqs.h>
5 R- E" ~9 m: e8 n( M" } - #include <asm/hardware/edma.h>
; @7 o4 g. g8 e8 O* f' D( r, t - " K3 G; \7 S, _9 @0 X; N! C
- #undef EDMA3_DEBUG# d3 g' d j! S( X4 _7 a) n
- /*#define EDMA3_DEBUG*/
`$ [$ R3 T8 a$ [; r
# h, v4 s3 o& D% } O- #ifdef EDMA3_DEBUG
( N! Z4 G$ i# I- D - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 Z4 B. B# q' f% S! b" B3 A( E+ y) K+ L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 ~. Y9 O& e# }" P* `$ M: H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 z# |+ }- B* g5 _- _8 A/ H - #else, Q7 N) E8 w) r$ V
- #define DMA_PRINTK( x... )) ~" p) A5 Q' v8 w5 U
- #define DMA_FN_IN
+ \6 \3 o" y' q0 ~) @/ {. o( R0 Y - #define DMA_FN_OUT
( l( k% S4 c8 |$ p) q$ o - #endif o! d7 Q! J$ @$ q! v
9 i: j9 R! ~3 o$ c# b* j1 K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) z# N7 @! y* X/ d% ?$ s/ e - #define STATIC_SHIFT 3- [. D3 }/ N4 w9 _: q( W) G8 n/ | |
- #define TCINTEN_SHIFT 20
( ^8 v3 c- O! C) o2 A. F' M8 K( t - #define ITCINTEN_SHIFT 21' Z( m' O9 z# G* H/ S) @/ Z8 w
- #define TCCHEN_SHIFT 22/ x+ s( |% H/ H9 @
- #define ITCCHEN_SHIFT 23( p2 z9 n/ _; Z7 G$ H
8 O( D* F& a) f. g1 w" ?- static volatile int irqraised1 = 0;, J, J7 U4 B+ }4 _
- static volatile int irqraised2 = 0;
# T( J+ X9 w, W- s
5 ?! M: D7 T3 I g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ B' R/ q3 Z0 J% D% X+ P, @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ k, O! S7 s1 M$ x: |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 }8 f& Y3 ?0 y) {1 o& P( C
( ]# l) \# l7 O" P5 P- dma_addr_t dmaphyssrc1 = 0;
: t$ T! _( @, C9 b( T l7 }6 @ - dma_addr_t dmaphyssrc2 = 0;
3 C' l* @& K5 ?+ I - dma_addr_t dmaphysdest1 = 0;
, `1 o6 j3 ?0 C" k - dma_addr_t dmaphysdest2 = 0;& D# w7 T6 D& P0 K# n4 I, _
- 3 m) b+ w7 c6 t& C
- char *dmabufsrc1 = NULL;
5 u# b7 \7 U& g: _& } - char *dmabufsrc2 = NULL;5 E( A5 x- ]! e; E
- char *dmabufdest1 = NULL;
4 O1 g' b2 R3 P3 l. d - char *dmabufdest2 = NULL;
0 Q) ]6 U2 I% v, Z$ @6 V - : H( d" T4 k! n9 h' q
- static int acnt = 512;1 W& |# b6 |4 c$ y O) V4 C
- static int bcnt = 8;
: p9 d- B. |& F6 {0 x z! N4 }. z - static int ccnt = 8;- a; Z P/ |5 [( V* i. a2 {
; l- T: n0 N: `8 y3 }" I2 S8 j. w, R5 k- module_param(acnt, int, S_IRUGO);
/ N. a2 b1 X5 T - module_param(bcnt, int, S_IRUGO);
, B, u2 k f4 ]1 S! o& Y - module_param(ccnt, int, S_IRUGO);
复制代码 1 K x4 ~5 q) A8 G/ c4 L: c
2 B' Y6 G# j* r4 \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 J+ K* \ ]9 A4 d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ V9 }2 k2 ?; H$ B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; N8 x. n1 {9 u: r) d* F
7 V6 P6 T9 Y' Y! R) e& b) u9 P2 s+ b" G/ a4 X0 p' V
|
|