|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* u3 ~5 ]0 y8 N- [code]EDMA sample test application
* S- \/ c- L4 n/ o* c' C' {/ E, s - /*" g4 M6 x2 W& s2 }* q5 t
- * edma_test.c
! }. V: T; ]( P1 x5 M - *- d; I" o4 {8 b
- * brief EDMA3 Test Application
* X# M. m* `0 [4 _ - *
# x2 q8 o* b A9 e3 c - * This file contains EDMA3 Test code.
$ }/ z# |& Y1 u# M3 o: ^2 _- k - *; {1 ~+ q7 t( N6 L3 i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* c- e; @6 S; a2 O# _! x# `8 a+ q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" k( R3 X8 H1 _4 `6 T, y
- * TO CHANGE.
0 m3 {( g6 c' I - *
5 l3 o8 K2 ]& I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* ^7 \( ?# N4 j" H8 }2 u" D1 Q
- *5 l) v% d. J+ Q3 j+ U0 D0 ~
- * This program is free software; you can redistribute it and/or2 ^& i( S- R V2 o* _
- * modify it under the terms of the GNU General Public License as
l" P+ m4 U# F; x/ p3 T3 q7 T) y - * published by the Free Software Foundation version 2.5 ~& C2 P6 j% _/ S% R( C
- *1 ^: y7 }1 `# ~# x. f L9 z3 i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ A; B4 y0 R; R) {1 | ]" t
- * kind, whether express or implied; without even the implied warranty
% {2 I1 J3 b3 Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( z) J" M" ~) i, f0 h
- * GNU General Public License for more details.
6 ]3 R8 o v1 {% y - */
4 E: M) h2 w( s- L0 L - # ^# {# L! a( I* D, U" q5 K7 q
- #include <linux/module.h>. ?( m) g6 _5 O% V7 L7 g* {
- #include <linux/init.h>
# C0 L, S) }+ r. \* Y7 W0 [0 G - #include <linux/errno.h>
! Z% V" W% L& V0 X" b - #include <linux/types.h>
: X2 z, e5 }1 s6 }0 x* B1 ?) d - #include <linux/interrupt.h>3 J- ]9 R4 d. T7 S, g
- #include <asm/io.h>) K4 q' c; C+ J1 P3 h! S, ~
- #include <linux/moduleparam.h>
# y/ y" g1 B! v - #include <linux/sysctl.h>
2 N/ k1 k5 b W, u/ u - #include <linux/mm.h> j7 J5 w$ m0 S; ]& E( q' l. h
- #include <linux/dma-mapping.h>
5 ^7 W: [2 n, ?3 C5 r; i7 Q
( n0 ^4 i g' `3 d" @- #include <mach/memory.h>
; N S4 H6 q- @, s - #include <mach/hardware.h>3 |/ `% ?! U" P: y: v h
- #include <mach/irqs.h>6 G3 h( s7 h/ \7 X* T$ z
- #include <asm/hardware/edma.h>" {$ V {" p9 d7 E
1 j/ R- v" ^4 P6 z, i- #undef EDMA3_DEBUG$ a1 D) L0 C1 u# r$ t7 ?
- /*#define EDMA3_DEBUG*/+ ?/ F, Z( d2 ^5 J# M o: k
- % ]' U, X0 b0 l
- #ifdef EDMA3_DEBUG
, v9 K1 L; y1 M; h% v) P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% ~& G6 O+ `# ? S. u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 m0 d# S5 @6 k# F) L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 H- X# M4 c: Q N
- #else( I6 O1 `" W3 R- f
- #define DMA_PRINTK( x... )
5 T9 l/ N' @6 C6 c - #define DMA_FN_IN2 H; P3 N$ r$ i- X: j+ q
- #define DMA_FN_OUT
$ Q+ `. ^: f2 G - #endif4 G8 s! V- ~! o; `1 x4 G
% ]6 e3 a+ u7 `. S( K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" Z: s5 Z5 e5 k) C) e - #define STATIC_SHIFT 36 w( N9 r4 b2 O$ A) O& q) @/ m3 @
- #define TCINTEN_SHIFT 20
$ A8 p) \' E+ {% y - #define ITCINTEN_SHIFT 21
" o6 C! U3 |7 U& `! U% i - #define TCCHEN_SHIFT 22: W2 `. h4 S' F6 n
- #define ITCCHEN_SHIFT 23' Z4 _3 @: c, N5 I5 U2 C
8 c1 x7 F! G; p4 `7 o1 ?' S3 V3 `- static volatile int irqraised1 = 0;
# x% l8 P2 F1 }1 B - static volatile int irqraised2 = 0;
" q0 W, w0 B. t6 [
' r6 D# @; h5 _" t5 I9 }. l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% C! E1 I# ]/ A( {, l4 @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Q- x6 W, W' Z' M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 L9 a7 C ~& j" h( C - : L; Y. s& x7 b: u. [, a
- dma_addr_t dmaphyssrc1 = 0;
4 U- L3 v1 @+ B" Y+ [ - dma_addr_t dmaphyssrc2 = 0;
- q2 X" R4 e$ m F7 ~ - dma_addr_t dmaphysdest1 = 0;
) E" o" V: O, L& p/ @+ Y" D - dma_addr_t dmaphysdest2 = 0;
6 V; t% K" \* G5 V, Z: y - + r$ h g- l5 P7 e
- char *dmabufsrc1 = NULL;0 Z B f) [& L: P9 f$ M
- char *dmabufsrc2 = NULL;# Y3 ^8 g7 n% }8 S% N2 v; ]+ f
- char *dmabufdest1 = NULL;& X# \% A" y6 D! a. a" n
- char *dmabufdest2 = NULL;
6 z, R7 T7 ~/ n8 }7 k; N" j - 7 E* ]& z" S8 @7 c, H- A& L2 e1 I3 i- C
- static int acnt = 512;
6 o2 B+ m5 `: @ m% F - static int bcnt = 8;+ v+ H u8 \& k' B/ ]9 C
- static int ccnt = 8;* K" d2 z8 c# j9 G; _6 f
d7 u& K; `& G. \! f7 I- module_param(acnt, int, S_IRUGO);
" }0 T8 y+ [' M2 I- w - module_param(bcnt, int, S_IRUGO);& a5 w) A1 ^) G5 o. K( S
- module_param(ccnt, int, S_IRUGO);
复制代码 % @8 f" R* R& `; t/ k
7 V' V0 @0 S3 M0 {; w, H" } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- Z5 b% j1 w# z- uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 x: A5 h, C7 C1 t* h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ n- D9 @/ c/ U* z0 M( q
6 ^, c7 B t- ]; w3 p6 H$ R) K3 @9 q
|
|