|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 z$ Y [) S% j, V( F- [code]EDMA sample test application3 x J5 x; }0 I! A" L/ B6 T
- /*
6 R p* h+ B4 y. a" s2 D, J- M - * edma_test.c3 S, E2 Y% {. f
- *
( `$ f3 r( M* k - * brief EDMA3 Test Application
& G) j, U( w! s& K - *. Z* q: M7 k+ o
- * This file contains EDMA3 Test code.
. I6 z9 c. N) @7 S' F3 o+ L - *% z# `5 ?) K! b* o" g7 f4 Y, B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& q6 l) }: \, `/ v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ }6 Q+ ^& t$ I' B, n
- * TO CHANGE.5 d' w0 _3 W2 L9 g
- *! k/ a2 N+ _: u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 g; V* k4 }+ _/ ^1 h, D; D. u2 D4 V
- *4 {7 ]% Q% R" w
- * This program is free software; you can redistribute it and/or( Q; {" @! a1 n) @- ~# }' h
- * modify it under the terms of the GNU General Public License as/ ]$ M, [; J. f5 z' M) S6 z
- * published by the Free Software Foundation version 2.7 H7 ~! l; p8 I, ~5 Y
- *" K; n" v8 w7 p3 z T4 e, k) w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 i. F9 n% ]5 i% T0 }! `
- * kind, whether express or implied; without even the implied warranty, Z8 o% @ L5 \ j# Q* E! X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( b4 i) i- z% ^
- * GNU General Public License for more details.. {' X. l5 h; z' ~9 ?8 \' @! z! o
- */
' Z* W$ M1 G& K
" S4 z) V& j0 ~, K+ e2 @% H- #include <linux/module.h>: S$ ]! F4 h" {
- #include <linux/init.h>
) S; }& H) C& ]+ S9 \, v - #include <linux/errno.h>
: M* v8 T7 V" n3 A# { - #include <linux/types.h>6 t! {- t4 W" g. [5 I
- #include <linux/interrupt.h>
5 ^$ a9 i) U' N- ]9 J8 i - #include <asm/io.h>
- ]& k7 v0 R" @9 ~6 i; l# t - #include <linux/moduleparam.h>) N2 z* h# y' q2 Q$ c- q3 g) E
- #include <linux/sysctl.h>
) a, J) ]" y: g, C3 [ _: M - #include <linux/mm.h>; C" b0 k/ q1 T! J1 ?; a
- #include <linux/dma-mapping.h>
! ~- C- V7 w* [. O. @( i
$ p% O1 a# E; b+ I4 G- #include <mach/memory.h>
9 G# `$ H# d! q1 d9 O9 D - #include <mach/hardware.h>
! r+ z+ ~5 k# r$ g7 M - #include <mach/irqs.h>9 m0 G! t* D, K. T. V9 M# }1 ~
- #include <asm/hardware/edma.h>
k2 @3 C. v1 {( M - 9 B, q( C# k) ]3 f; y
- #undef EDMA3_DEBUG4 d* n/ v9 _+ ]4 S% F x
- /*#define EDMA3_DEBUG*/
; D0 C9 I4 P* e3 C$ f
) q% w0 w5 F" J+ v. C0 b- #ifdef EDMA3_DEBUG
; [* j* H/ g! b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): r& ]4 W/ O! q' L8 [! ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 M8 C P1 O* m N( f! f# u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ C& a7 K2 p1 ^$ j" P - #else( @8 N' Q9 s! S- W
- #define DMA_PRINTK( x... ), m( K8 m1 o8 ^
- #define DMA_FN_IN6 o1 a) [% n. p- ?$ h1 i& h. R
- #define DMA_FN_OUT) P+ w! Q! t7 y5 z
- #endif
0 V0 w; W; o1 m# B; U: g
& w# G' d" B/ y' E, X2 J# }/ w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# l* q' t6 P, p - #define STATIC_SHIFT 3
; R! A& w- U& d4 L ?2 | - #define TCINTEN_SHIFT 20
8 X& I$ @3 k% q5 {! q9 `4 [ - #define ITCINTEN_SHIFT 21( u$ B! M3 b) Z) t3 e
- #define TCCHEN_SHIFT 22/ h( v) u* v0 q& u4 J M9 H
- #define ITCCHEN_SHIFT 23
2 x% W8 h- r2 _5 n) X
" t7 D- s U8 Y9 \3 M- static volatile int irqraised1 = 0;
' s/ n2 m) W& c$ _ - static volatile int irqraised2 = 0;) z; i8 z4 k8 `& l% _. N
- + O& V" O% H: S3 J9 y: `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% j5 l( F7 s$ k' ~* N9 V( r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& m" b; M0 G: N s/ J: ^/ {& }- ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 z5 B ~! \ q. p, m
7 Z R/ A- L3 m" a& \6 Y) J A- dma_addr_t dmaphyssrc1 = 0;
/ D P& R5 k. j - dma_addr_t dmaphyssrc2 = 0;
; K& F; F5 b4 o7 S' p - dma_addr_t dmaphysdest1 = 0;
1 Z. E+ t' L- A7 {5 E - dma_addr_t dmaphysdest2 = 0;
9 j. N0 v0 H* ~; q/ y9 F6 y# n5 j* O1 q - 8 [2 w% D* D! @
- char *dmabufsrc1 = NULL;: s& Y$ P# o% O9 j4 V" d- l
- char *dmabufsrc2 = NULL;5 a2 r! L4 D, S2 W4 |
- char *dmabufdest1 = NULL;
4 ^6 n8 V- K2 F, y; b# V/ [0 v - char *dmabufdest2 = NULL;7 O/ l. _* C8 t0 Q7 Z
- ( d& G5 G E2 J
- static int acnt = 512;3 q6 X# C# K" u' y( J+ S5 |
- static int bcnt = 8;5 v& a# U# W# w/ J, O: r2 ^1 T2 x
- static int ccnt = 8;
0 q+ I, y4 b# z/ B$ ~1 a
0 H- Z! ?" @7 W. Y: R- module_param(acnt, int, S_IRUGO);7 x" m: d% W+ ~: y# ]2 w
- module_param(bcnt, int, S_IRUGO);
4 s: i4 B5 H5 `, C5 U - module_param(ccnt, int, S_IRUGO);
复制代码 M. J6 h/ _, ]) q' Y
# _4 z8 C9 I! D$ ~. I' c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: c1 E; }2 p2 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 X' k, F8 N5 p9 W" p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 n' p8 f4 a0 I' j" ]
0 y) r# t( I6 D+ r0 J h! U( {7 s# t& J5 L
|
|