|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: E1 e+ c# f5 i% z' ~) F M" m) q- [code]EDMA sample test application
5 j* P# ^: Q0 @- T+ C - /*
! F V7 y8 s9 ^9 B8 t7 ? R" i - * edma_test.c5 ~+ Y5 z8 H" O0 L
- *' B3 g, p0 |$ K
- * brief EDMA3 Test Application3 }, m7 [# x3 L
- *
( Y' ?& V5 k/ n: d% ~% ` - * This file contains EDMA3 Test code.- u9 n. w$ O R5 T2 C1 j
- *" j7 F: B5 v. ?7 p! Y4 ?3 @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 |7 \% a+ w/ B. T2 \! ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) {5 w M5 v( Z4 K4 n. H) \ - * TO CHANGE.
! P! J' [1 g! x( n! ~ - *
1 N* }4 h+ A8 n$ M; t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 ?- h! C# i- v9 @' o2 u6 ~ - *( z2 I7 P8 b! R) O" x2 X
- * This program is free software; you can redistribute it and/or
* w6 l6 O% L: C- L' @5 S - * modify it under the terms of the GNU General Public License as
6 i% m$ X! E% _- C3 w% |8 d' o - * published by the Free Software Foundation version 2." H+ D& {+ i6 ]4 K" U% q
- *
) f9 E* L" O8 N7 w% ~& n( N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! f- U" X' {. f+ r
- * kind, whether express or implied; without even the implied warranty* b6 O8 J/ W/ R. z8 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" u5 p! D) Z. v; f# h, H6 E# _
- * GNU General Public License for more details.
6 f3 l0 ~+ e# d7 y) K( Q - */
9 ^) h6 ~, D! @$ {, B9 g
. G* E+ v6 y7 O& a. z; m4 B- #include <linux/module.h>( Y* y: Z( Z6 y4 p e6 h
- #include <linux/init.h>
' ?/ m0 V$ h, R6 ^4 x- a8 ]) Q - #include <linux/errno.h>
( S! x5 U2 M# V - #include <linux/types.h>
( ]0 c. R" w9 f! Q+ e - #include <linux/interrupt.h>
0 e- m! D! V. @2 [ m9 d8 m - #include <asm/io.h>
- r, a# M* a5 G1 o - #include <linux/moduleparam.h>. Z0 U, X6 X1 e- d k
- #include <linux/sysctl.h>
* o1 E% u" k6 C7 r1 U5 [- n* f - #include <linux/mm.h>( ]/ {1 y! N1 B9 A* v
- #include <linux/dma-mapping.h>7 d M, p2 d# l7 y5 A8 o+ E w% e
- 8 u# u2 {" ?5 T a
- #include <mach/memory.h>
$ J9 O3 n" F5 P: C& L+ q - #include <mach/hardware.h>5 Z% ?! w) E; b) I. l3 J
- #include <mach/irqs.h>
6 ]' ]7 L% L" o4 k( k) K8 p" A - #include <asm/hardware/edma.h>& o6 N8 H( L$ \9 x* g% q
( Q) ~5 p4 _& J6 @( d6 L6 P- #undef EDMA3_DEBUG0 i, X2 P7 T! ~
- /*#define EDMA3_DEBUG*/, w( r! m+ @: v# n k
- 6 f3 s1 H" N+ L9 b
- #ifdef EDMA3_DEBUG, r: ^9 r+ U& d+ V# U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# o4 N Q. n! `" t. T# c |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( u# v5 v" L0 }$ y) s( } M# N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! b4 e. d; G4 {7 c& @/ E4 i - #else! v, \$ c( X! p
- #define DMA_PRINTK( x... )
L, q0 B. V ~$ B - #define DMA_FN_IN
* Y5 K1 y7 d' F# d/ W - #define DMA_FN_OUT
" Q. Z' x/ ?7 j1 A - #endif
! G( s) L. B) v" n+ s5 m& d - 5 j7 k+ r* b) p7 R) e" i0 |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& O5 X! f7 p% b! l- b; w+ [ - #define STATIC_SHIFT 3
g/ K! ~$ R7 }2 k! X - #define TCINTEN_SHIFT 20
, r" |( g# j6 _/ K ^( ` - #define ITCINTEN_SHIFT 21
7 K, M( w7 |, S) q - #define TCCHEN_SHIFT 22; j# F7 N) y/ H. f- r
- #define ITCCHEN_SHIFT 23/ ~' t, o S3 r- y3 W
/ F* A* \8 o, r! x, H- static volatile int irqraised1 = 0;$ g ~) r( [, r
- static volatile int irqraised2 = 0;
( S3 c. s# ~- n3 C% B4 J$ i+ Y - " z- ~( S; f r" n/ Y6 s' z% v+ P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. N ~" r7 n$ `0 W( T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ s3 k$ E4 o9 a4 A3 ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Y5 v0 W# d: l2 c" ?
" E! G7 i! h3 r. G2 ]7 E- dma_addr_t dmaphyssrc1 = 0;' R! Z! t5 [- ^
- dma_addr_t dmaphyssrc2 = 0;
' X) a. t+ ]: p3 o9 ?! _9 F - dma_addr_t dmaphysdest1 = 0;
% q. I% g# f2 o - dma_addr_t dmaphysdest2 = 0;
( H. b" D: d- j) E. C" W5 W$ m - * y& t9 e% r' U4 R& W+ I
- char *dmabufsrc1 = NULL;9 _, F9 K8 ]: L- h
- char *dmabufsrc2 = NULL;* ?/ U. }, b) R- s' U
- char *dmabufdest1 = NULL;
1 d6 |* M/ ]& n- z* P7 L0 z3 f - char *dmabufdest2 = NULL;; M! p& o8 G- J/ {3 J2 ^" ^
" H3 v- J% w) r M {. t3 p$ P- W5 U4 M- static int acnt = 512;
! y9 `- @# Z: X - static int bcnt = 8;0 T) |% D# n6 I" ~
- static int ccnt = 8;
1 @; y }/ S2 k" r - 8 e7 M* B8 S7 H3 W0 r8 s- x4 v3 n! u
- module_param(acnt, int, S_IRUGO);- o$ @8 q0 k1 S( B( ?
- module_param(bcnt, int, S_IRUGO);) |4 c. h5 t! }5 d# ?: N
- module_param(ccnt, int, S_IRUGO);
复制代码
& M5 ^+ C6 \" `
z3 w4 _/ I0 c% Q7 u* X" f' O9 p5 i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& Z$ ~& b' h: parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- Q! Y4 F' a: M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* E i9 e$ J1 s" q% @$ w( ]6 D% G8 R3 _8 h/ C
) f! ^0 b9 _% y- L& v# S |
|