|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 q% Z: t$ J1 ~" g/ N- [code]EDMA sample test application2 y- u5 D7 Y J9 F$ d
- /*
; I6 Z8 f2 j9 a7 I2 f6 v! b0 E - * edma_test.c
- c- p; _( J. G2 H" A. ~7 K4 O* U6 W - *
- p! {1 ^; t/ N4 W8 G2 h/ X - * brief EDMA3 Test Application
$ G- d% N: k3 @! j) z) }$ \ - *5 n& Z0 _& C! z9 j- h% v
- * This file contains EDMA3 Test code.1 R6 T7 k/ I' _( s6 C0 z
- *
. e- w7 ~" L) {/ f9 n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( B/ z2 U; I" W8 J: f$ e: w! @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 j4 Q0 X' p+ }" l
- * TO CHANGE.
2 N2 l b! @5 ]8 x& S2 X - *9 p. k, V& s$ h5 l" t* \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// b* x2 q, A% W, s2 ?) c% M1 W
- *
# s3 c h1 N1 S8 n5 b% O' l) q4 A - * This program is free software; you can redistribute it and/or6 v i: e) E5 X. Y0 [
- * modify it under the terms of the GNU General Public License as
6 K# m( |0 w' [ - * published by the Free Software Foundation version 2.$ R* U0 s6 `5 F5 l+ i
- * e" a# R& |: F( l; `1 e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 ^ C+ F5 U. s; A! y4 H; z* Q - * kind, whether express or implied; without even the implied warranty
: D7 R( T7 s. H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" H, d- h. w& c2 A( K+ G
- * GNU General Public License for more details.
& b' P C8 z' i1 R6 i4 c - */- y8 [1 e( D) J: V8 f
- 5 o6 _$ ~4 t' i" [7 @* D+ V
- #include <linux/module.h># a3 v4 b% ^( b% @5 j8 x7 N5 p i
- #include <linux/init.h>( b5 B' e( A" a# }
- #include <linux/errno.h>
3 H) @+ {/ v: a5 e1 X4 R8 c k - #include <linux/types.h>
* V3 Y) m' z' F& G# @9 ] D3 Q - #include <linux/interrupt.h>
2 O, q8 ?9 @! c$ J, ` j - #include <asm/io.h># a* ^( n- C6 l' n
- #include <linux/moduleparam.h>) n7 n1 U: ]) B$ s7 g- k& r$ K
- #include <linux/sysctl.h>
; c& |9 z6 Z% J# w0 z - #include <linux/mm.h>
: t0 p5 K( X8 _$ v3 {" ^ - #include <linux/dma-mapping.h>
6 g; \5 }; G% W Q7 n' F& p; u
% [: {# A0 u- g0 t, c1 _- #include <mach/memory.h>7 p4 ^; g- N& b' v/ b- H" _
- #include <mach/hardware.h>
& n X9 j( I$ e: N* U% ^ - #include <mach/irqs.h> L3 H7 A5 h2 l
- #include <asm/hardware/edma.h>
( Z& S7 Y1 n4 K# ~ - & c- t9 P, N; y
- #undef EDMA3_DEBUG
) p& ~& `/ J" q1 ]7 u! u6 S% W9 Q - /*#define EDMA3_DEBUG*/
$ s6 |3 n F+ F - ; H: M9 j- u* i2 t# S2 v q
- #ifdef EDMA3_DEBUG/ X3 B* H* s; n6 O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
f: B& x' X) J( o1 B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 e/ m. O3 e. @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 F: {( `$ y2 v1 z( k8 h - #else8 J/ F. k- ~% o6 m- T g; D
- #define DMA_PRINTK( x... )
! @$ c) E. Y- X, z9 `3 p1 t - #define DMA_FN_IN
* o1 R/ Y% v) v( K* I# y - #define DMA_FN_OUT; T x5 S5 M4 \6 {( ?0 E
- #endif
/ _( }4 m8 \, P+ b
* j4 a2 a) t& B' {# R. Q4 @( a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, A; n% [& P9 z! }" p2 d - #define STATIC_SHIFT 33 g- u7 D6 o. D0 Q& I& a* v" a
- #define TCINTEN_SHIFT 20
n6 m8 d* {: b+ B) @" m - #define ITCINTEN_SHIFT 21
c1 P& Q* V) l - #define TCCHEN_SHIFT 222 k3 g' [# _* n- O) r& w6 L8 b# p
- #define ITCCHEN_SHIFT 232 s8 F/ k. X. ]$ i' y
9 U8 U8 j* h8 j( e/ a- static volatile int irqraised1 = 0;0 }# o* I+ s$ B+ V
- static volatile int irqraised2 = 0;
7 A6 f d. }+ j( ]) D3 {9 c- T' ?
# V/ s2 L Z) d5 Q/ h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; E' d0 h+ c/ z3 p8 Y$ K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- P' Z; D4 B& I! X3 b% D& ^ t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 e) @6 N+ [4 y
5 u) s9 O5 T, i: J$ |- dma_addr_t dmaphyssrc1 = 0;
4 Y3 e- g5 y# S - dma_addr_t dmaphyssrc2 = 0;
7 [/ p: J5 K P& S; S/ L2 E& k& o - dma_addr_t dmaphysdest1 = 0;
, e, }0 M y4 r - dma_addr_t dmaphysdest2 = 0;: S* C$ h7 f8 W# Q; T) p
# A( v) d4 ^3 a6 ]7 K" A3 r* W- char *dmabufsrc1 = NULL; g& D$ c/ Z( T' P
- char *dmabufsrc2 = NULL;
* h, v* v+ J6 r; ] - char *dmabufdest1 = NULL;2 N4 F. e3 I( f. A$ K, `: X
- char *dmabufdest2 = NULL;
0 E$ _8 J( P+ j - * y4 q% h( ]* b; N' L
- static int acnt = 512;3 S2 R- A$ w- {: _- ^' [6 v2 B
- static int bcnt = 8;
9 C# {: g" }. e6 Z7 T- q# D - static int ccnt = 8;2 O7 i. Z3 i+ g% t' ]! Y; F# t; ?
- " c9 ~1 u4 ?. m8 Y( m3 z4 q
- module_param(acnt, int, S_IRUGO);
3 }0 r# `* ~" k$ a2 B I' R - module_param(bcnt, int, S_IRUGO);. E& b! G' ~. e5 g; ]% X: d |: A7 E
- module_param(ccnt, int, S_IRUGO);
复制代码
% N% j* o( K! |' H- H. x8 e' @' N( E N! L* o1 e# \+ j% v l- m4 ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# A: n) n" V2 j Y3 e) B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 X/ w$ ~: O" x7 P8 t6 i3 `9 D! J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 P1 v8 d: l; w# Z% O2 F0 {# f# K6 X! L8 ~) L+ X5 V
8 V6 j/ ?: `4 g |
|