|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) E3 t$ O0 \% c' N' ^. o* m" h- [code]EDMA sample test application
6 y) w* Y2 M+ m8 u - /*- o" u2 a% v- J1 Z
- * edma_test.c+ P+ b5 }: s1 ~. z# |
- *
H, j$ k" l+ O - * brief EDMA3 Test Application7 q. d9 I$ P$ T! P* U8 {5 \7 H
- *
% O3 }4 A+ c$ c) ^ - * This file contains EDMA3 Test code.
" n$ w$ n x P$ ^1 k& j T' Q - *
# w4 P$ g1 Z$ `5 t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, a/ G! v; ^3 x Z% A2 R- y- B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! u0 |# _) I! J; f6 }6 s - * TO CHANGE.( m- L0 _/ a( Q( q s7 o
- *
# i; n$ Y4 D+ |# k9 {6 O+ [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ e+ D$ g- a" g' v
- *. d, U0 F# p% P) ~9 I; I0 w, [3 g
- * This program is free software; you can redistribute it and/or; w. x, q8 @# F n
- * modify it under the terms of the GNU General Public License as; M! J% X- f) h/ i. F
- * published by the Free Software Foundation version 2.* b- {3 R& H" X2 S/ F
- *
( m" G/ K) | \2 O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- N7 k8 G) u- D - * kind, whether express or implied; without even the implied warranty
5 L4 I2 D( f \% [& G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- o ~: P" P* {9 Q' b1 [8 E - * GNU General Public License for more details.
( b/ h0 p) u6 l" g - */
1 v: Y ~1 K" Z0 J - 6 L+ a, g6 s3 Z# g$ d: F
- #include <linux/module.h>
" d9 ~6 o8 x8 [) ? l! B. S - #include <linux/init.h>$ n! @( d& p. |. R0 r6 u. X
- #include <linux/errno.h>
. r5 c6 {* j0 A, h* D9 m4 h$ H# i - #include <linux/types.h>
k! M9 N; { r7 B - #include <linux/interrupt.h>4 T, A( n s: Y3 t! A
- #include <asm/io.h>
4 Y" {' ~, h' K. f' @% r - #include <linux/moduleparam.h>
5 y/ f5 j# \( Q1 P) k2 v9 f, y - #include <linux/sysctl.h>
3 e ?9 C" g; v" l% c8 \4 L, X# j - #include <linux/mm.h>0 d$ e j+ V$ ?* K+ H- f: m% P" {
- #include <linux/dma-mapping.h>
2 b7 m# u) h# ]% L: m, ^
" u* {4 \4 X6 H; \2 |6 U1 C0 M- #include <mach/memory.h>/ i) R+ W$ R# P, @6 m+ q
- #include <mach/hardware.h>0 L+ H5 c1 N8 f+ m& U. N
- #include <mach/irqs.h>
# d6 a4 _5 b& Q( P - #include <asm/hardware/edma.h>
6 \; I9 n P7 ]% g8 @ - } M( D- U- {* J$ s8 @: {, K
- #undef EDMA3_DEBUG+ p W3 c+ A. I& ~
- /*#define EDMA3_DEBUG*/- k0 o) C6 |& h- i7 y
- 9 f* t1 d, a9 p) \
- #ifdef EDMA3_DEBUG
( [2 J( f. ~& L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( {; [+ O( }) }2 }. C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 ]1 _0 s) M% y2 R2 A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% j, j; w( s1 m, R6 V - #else
2 }5 a' e, w0 P- F0 \6 R - #define DMA_PRINTK( x... )
1 W3 G8 J; `4 e& Y7 O# h( r - #define DMA_FN_IN
% z9 w* G9 o3 _; }& f; w, ~- c - #define DMA_FN_OUT% m( Z/ u: {. ^8 m% d% L+ _
- #endif8 @0 S* d9 f) ^8 |3 Y
+ R; P2 |3 [( i: l2 g- #define MAX_DMA_TRANSFER_IN_BYTES (32768); ]/ N7 w w5 |9 ?2 q" v. x: F" Y! V' u+ t
- #define STATIC_SHIFT 3+ y. {$ W* Y7 l2 Z+ S! I6 [
- #define TCINTEN_SHIFT 20
' G0 |0 v; l n: l& j" _% o - #define ITCINTEN_SHIFT 21
& K0 Y$ U! P( O, _ - #define TCCHEN_SHIFT 22
; g- L ?, A5 X- N0 Y) y8 { - #define ITCCHEN_SHIFT 23& T3 p& e" R! {7 s# T @
- + Y7 z% N a0 D2 J
- static volatile int irqraised1 = 0;
% c1 j( S# _. O( e$ c. J - static volatile int irqraised2 = 0;$ N A$ c8 O: Q& W
- / ^& f. B- U; d. n# B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 V8 g4 d/ F* d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 x* u3 H8 d5 z. u& q5 b% o6 }8 z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 v6 D& e8 i; x5 L4 [
. Z1 T. Z: a0 U' _2 z- dma_addr_t dmaphyssrc1 = 0;
/ z' {4 a6 `& j* w8 Q# i - dma_addr_t dmaphyssrc2 = 0;) ]% R' ?. D7 H: M+ o
- dma_addr_t dmaphysdest1 = 0;
* A Q) y, v4 J' s5 c - dma_addr_t dmaphysdest2 = 0;$ `- K6 w. V$ ~: C3 v
- ( H' T1 m% p# O3 @) u& R
- char *dmabufsrc1 = NULL;1 a" b( t2 r8 j4 a+ w
- char *dmabufsrc2 = NULL;, V. s9 V" `- ?7 }# d5 v
- char *dmabufdest1 = NULL;
% x. Z, I2 U1 m2 I0 w, I& S - char *dmabufdest2 = NULL;3 s+ [! p7 p) K" t- ~
) J6 B+ F! P7 G. s. @- static int acnt = 512;. U9 O) _7 R) M; ]
- static int bcnt = 8;( j9 A( n: W# b! G6 k1 D6 H
- static int ccnt = 8;
, O$ `1 u8 h- f
; \$ z. L/ b4 a5 q2 F: |4 u: N- module_param(acnt, int, S_IRUGO); D( d6 x3 o5 n/ A9 d4 o; ^6 [
- module_param(bcnt, int, S_IRUGO);7 Z. S& o. d% X E7 w
- module_param(ccnt, int, S_IRUGO);
复制代码
s, R" k$ k2 _2 i* c
( g/ ^5 i% ]8 T- { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) b7 t3 Y! ]! r) F& s6 F9 Marm-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 J5 `( k/ P- F! N1 v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ V6 m [: w, s/ C2 k1 c/ s1 f) n9 ]9 U
1 E1 {5 v M& ], a |
|