|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # K4 W7 c) g8 @& W w
- [code]EDMA sample test application2 p! }2 q o% S' U3 K2 A2 R
- /* K. o7 l' z1 J) `* k8 B. s1 h
- * edma_test.c
! q1 ? Q: Z0 t - *
: d8 {2 ~; [& o$ L6 R& G* i$ U - * brief EDMA3 Test Application
8 N, D5 M2 O' e+ G* S* n+ h - *! ~2 d% {( Z# T5 e! }. B6 i
- * This file contains EDMA3 Test code.8 U& j, s4 X! L l& }5 {/ u
- *: I; T+ f+ X1 V. f: g! u) n1 h8 e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 K- |3 t. _5 l2 |+ V( `' L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. }) i2 u# T8 F+ N - * TO CHANGE.
; H0 h w B' v6 D - *8 Z" z4 l8 a7 h4 ~" z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// _7 ]! {. N1 i; p7 [
- *" u0 U/ y7 c9 d& Z
- * This program is free software; you can redistribute it and/or+ R5 b6 R' m c0 v2 z
- * modify it under the terms of the GNU General Public License as
' e7 V) f. B! ` - * published by the Free Software Foundation version 2.
* j- V4 T4 g! e! i) S7 U - *
' R J( a* \! y; f7 a& ?# ? - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 x! A, `& f+ \& F1 A4 _. p" C B, @
- * kind, whether express or implied; without even the implied warranty9 b8 l6 ?- K ?% A+ v6 S% G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 M, L( _- c* u7 s- } - * GNU General Public License for more details.
" o5 V1 C" i# ^% L4 d9 m - */5 H+ s0 _" v5 q- e
- @8 l+ V: ?) E J& L6 M) U7 U
- #include <linux/module.h>1 E! N ^; q6 R# h/ |
- #include <linux/init.h>: e0 P" d$ z& u, s* O0 b
- #include <linux/errno.h>
C9 Z' B$ O: ]! Y/ Q T - #include <linux/types.h>; O* v3 e# h N
- #include <linux/interrupt.h>+ i. J- r8 M+ ~- ~0 O% ~! U
- #include <asm/io.h>
5 W5 K% m+ x# i1 c; q/ v+ E - #include <linux/moduleparam.h>- L. z, t; u$ U E3 S
- #include <linux/sysctl.h>' t/ t2 R q9 J, C# G
- #include <linux/mm.h>
3 _! e, ~4 Y0 ^& T* K& W" V - #include <linux/dma-mapping.h>. ]2 `& j: c, E/ G
- 1 s' N8 T) ^. R3 z4 Y
- #include <mach/memory.h>
6 k2 a; v5 ^ Y" Z& v - #include <mach/hardware.h>
8 |' c" ^+ {' ~) N: N7 E - #include <mach/irqs.h>4 y% H8 Z; O3 p; Y6 m% X. K
- #include <asm/hardware/edma.h>
: ?# b, [7 t i4 m7 i7 _ - ( u+ t, N( K% o7 B- [/ h! e
- #undef EDMA3_DEBUG
* F9 N, Y# D, [! \ - /*#define EDMA3_DEBUG*/
: N% L. i# |# b w/ q
+ F8 G+ _& o! z- #ifdef EDMA3_DEBUG
! k1 r/ k6 A; b6 |2 a( Q1 Z* X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! m- v0 R# @( h% Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ G+ Z( c9 w0 J0 g! q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 W5 t; l5 W ]8 l, @# }% m
- #else: ~8 V8 t v* I( T' R4 ~
- #define DMA_PRINTK( x... )2 o2 d& {, u# J' O
- #define DMA_FN_IN
, v2 V- W/ P% T - #define DMA_FN_OUT4 f& N, j- N1 e% i% K# Z: Q
- #endif
5 r; t L6 N( A0 C; @/ q; k
* M& W; c7 ]3 N3 G7 P$ \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' i' o! ]# q6 i - #define STATIC_SHIFT 3
- ?5 h4 ?* d( ]2 a% C - #define TCINTEN_SHIFT 208 |) B2 z0 V& k" u# v3 n8 G
- #define ITCINTEN_SHIFT 214 E* _ }% G0 ^, Y4 o# J
- #define TCCHEN_SHIFT 22
* o% }& |, T" w/ \; m - #define ITCCHEN_SHIFT 23( Y [4 l6 c, L" Z: B0 Q& o+ u6 y/ j
- 1 I+ ^1 _" E) j. v9 ^$ K; ^
- static volatile int irqraised1 = 0;$ x, `2 q6 Y* U/ C2 N
- static volatile int irqraised2 = 0;' Q4 Z4 D& v5 `3 ]9 g
$ C0 U. h) `- j5 R9 y. _, v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" c% w: M; A% C- L' X0 A f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: @( e. y1 V. `. t% \7 G& W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# j/ I9 D9 N# V$ t* }! @
4 s# [; e" M. b$ |; {" ^- dma_addr_t dmaphyssrc1 = 0;
& S* L) S. A$ j& v) N: B - dma_addr_t dmaphyssrc2 = 0;
( t. o& o. Q3 P; ~ - dma_addr_t dmaphysdest1 = 0;- q/ L, W6 Q* ]
- dma_addr_t dmaphysdest2 = 0;: D3 X) {7 Y' L- @9 u: L
M8 ]; N# U" D. U3 Y+ D1 r# n- char *dmabufsrc1 = NULL;
! u: @( E1 z! ~4 ^. y1 L! @7 W - char *dmabufsrc2 = NULL;
: o# ^: B; m3 V - char *dmabufdest1 = NULL;
* z+ u1 G7 U( M% u' j0 A ^$ E+ H - char *dmabufdest2 = NULL;- G9 c+ F- s& F3 {1 m, s9 S# }
) ^; U* Z; U" Z( r2 ^- static int acnt = 512;/ H1 L) R& r+ F2 c
- static int bcnt = 8;$ N* ^; \: M4 _$ c2 W$ e1 M
- static int ccnt = 8;. C8 {$ F" L, h
- ! C$ [4 Y P5 W, V( d: m6 f: j
- module_param(acnt, int, S_IRUGO);
& X4 p: h d: v/ h - module_param(bcnt, int, S_IRUGO);/ {: V- ~4 c/ F/ b# R$ P3 d: }
- module_param(ccnt, int, S_IRUGO);
复制代码
! a7 j6 ]/ _: [- Q8 \3 G+ g7 r- ~1 d7 Q1 f; x" m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# d6 f1 Y: y/ R- j+ t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 Q9 ]) g1 J% |, {* D" [. l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 m) {6 O8 {5 P5 w/ |' ~! U
! S. l4 w5 F' {2 ?% `1 q% u' U
% n2 v* z7 H8 v: |$ b
|
|