|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - a, {% [2 n$ f! [2 j
- [code]EDMA sample test application
, T! j! r! ?) t+ l" K& | - /*6 O ~8 A+ B, Z# n0 r7 S
- * edma_test.c( \+ H$ |, f+ K$ C3 c
- *
% m# m0 u% H; J9 ]4 O' r - * brief EDMA3 Test Application
' O6 \. d- {2 ?. e3 ]/ u, j( {2 f+ r - *
7 g% q5 y6 B a - * This file contains EDMA3 Test code.
! a5 u- ]& @1 G - *
, M W5 }# b* [/ Q% j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 H- P; F8 @# o% Q1 K. s3 F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( i4 l4 S* O# T9 T) Y0 `
- * TO CHANGE.
) F: [2 I H8 y3 D - *& D. a- G" a! D9 C" V' g% X( q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 C% ^) w M* L4 |( s
- *
+ k# l% _+ {5 q7 Q. x. F3 O - * This program is free software; you can redistribute it and/or
& J) m8 e& ~; c8 Z4 e: L - * modify it under the terms of the GNU General Public License as7 ^# \3 _3 f! B. F+ w1 ~
- * published by the Free Software Foundation version 2.
5 [. `. V0 ]' ]) H) {1 Z6 R- g( p - *$ z5 Q K' x0 s- f$ W y) y4 o) J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ W. L g& l7 O f- Z4 |
- * kind, whether express or implied; without even the implied warranty- t4 D @7 X3 z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d/ x, _0 E4 A - * GNU General Public License for more details.: G( D1 S6 r; {' j* s4 r) A
- */
9 Q" w- f0 T/ [, K( D( S
) e7 y3 u6 ?2 u% f- #include <linux/module.h>
9 `7 m* A; z& w7 G5 X - #include <linux/init.h>
% u7 C0 W. |( @( i, i - #include <linux/errno.h>
% R% U0 ^" G4 ^$ H0 f - #include <linux/types.h>
& R" p0 h: h) O6 e, [% m) ?2 Z - #include <linux/interrupt.h>
& l) R( w/ `! O: U d, s3 g - #include <asm/io.h>
0 ^$ q" J, P8 f; L* S1 p. ^3 [, R - #include <linux/moduleparam.h>6 ^+ O8 p! T" H$ g( A; P
- #include <linux/sysctl.h>2 m" U8 J m9 `, [" {& H
- #include <linux/mm.h>1 j% L0 S9 G8 K& M
- #include <linux/dma-mapping.h>
6 U. ~8 [& H2 k3 x, |* E4 f' V4 v! l
J9 h3 l0 R) E/ u- #include <mach/memory.h>
% v5 d* X* U/ P7 t: c - #include <mach/hardware.h>
; p5 w, n3 i7 |7 i% H - #include <mach/irqs.h>$ q& ?! X/ z. q
- #include <asm/hardware/edma.h>
; ^6 U [/ t7 O& |# d4 A( S0 Y/ @0 i
8 J+ R7 k ^# a& s: Q) K- #undef EDMA3_DEBUG
$ F; N: W% q8 H1 m - /*#define EDMA3_DEBUG*/
( l9 } `. g3 X& u3 P9 Q. l# c - * K. o! A3 E; [2 q( h7 F
- #ifdef EDMA3_DEBUG
* z/ E, a. F7 Q% X+ y5 a& D - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" r8 J L+ l; q7 H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( [6 }+ S! S6 t$ E# I6 e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 N5 j4 c. i& {: L8 @9 k7 y
- #else
6 t1 I0 G+ Y5 {2 b- q - #define DMA_PRINTK( x... )
3 C# G3 i j2 H/ E, m - #define DMA_FN_IN
. q0 g" {" k3 r' m' E6 F - #define DMA_FN_OUT' f8 E b4 I1 t. j& f* s) x
- #endif4 {7 f% D3 g, p) M. @ S- w X" N
. I1 x, c; O1 w; n/ m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 u! c8 c. o* |& ~
- #define STATIC_SHIFT 3: u* w/ {% \; U/ _# F2 ^: d
- #define TCINTEN_SHIFT 20" i# Y1 ^2 @ J& u
- #define ITCINTEN_SHIFT 21
8 ?& O0 o" y1 c; @2 G) F2 f( h# t. ~ - #define TCCHEN_SHIFT 22
+ {5 k; N1 Z; T2 y2 X9 a - #define ITCCHEN_SHIFT 23: J3 |& O+ S" j* e- c9 n' y
6 l+ v$ ^; Q& P3 s; m8 |- static volatile int irqraised1 = 0;/ Y- F9 z" _8 m+ w
- static volatile int irqraised2 = 0;
( F% a" ~- g' n/ |/ r1 n/ d - " o. r5 w5 v; i$ Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# P2 v/ @' L' q3 [2 i6 k$ W8 v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! t, V" U% Y+ l8 N( ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 h1 V9 D1 @% u; G5 u' r; m
- + _3 ^+ l( [* A. k4 Y5 Z+ l
- dma_addr_t dmaphyssrc1 = 0;
, C. A$ Y$ Q* J( P, d% e6 T - dma_addr_t dmaphyssrc2 = 0;7 l& O! P) u3 ?9 P. `/ x4 K
- dma_addr_t dmaphysdest1 = 0;
% e/ d( I5 T4 ~0 T7 R2 }% j$ D( I - dma_addr_t dmaphysdest2 = 0;
+ V* g. B( R' m$ x) C$ S, l - ' y, v' X" g b/ v9 R, L+ b
- char *dmabufsrc1 = NULL;8 N& R" ^2 G" ~$ h/ X& N
- char *dmabufsrc2 = NULL;1 }2 D x4 `8 x" I* f, X( g A
- char *dmabufdest1 = NULL;
# W$ D' ~, _" D1 v( b6 ? E - char *dmabufdest2 = NULL;
. ^* u- d2 I- a3 k - ) Q" ?5 q/ q. K5 N" x* o& ?
- static int acnt = 512;. h% z0 q5 u q; l
- static int bcnt = 8;
! f" `$ `) d J9 d# [# g6 N |+ F - static int ccnt = 8;( w8 Q) [4 P# ]/ L+ r
- / p" t0 M3 j# R8 d# y7 r! Q2 Y
- module_param(acnt, int, S_IRUGO);& `# @/ s+ x- v6 [: @
- module_param(bcnt, int, S_IRUGO);
/ m2 b3 H% D! P7 I$ b; n! r/ z - module_param(ccnt, int, S_IRUGO);
复制代码
- K P% R. |* F# D9 B' J* j
. C. a/ h/ u( t5 f! M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" Y! s7 e! ]2 A& u& L: darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ v+ e) B: R$ o% m0 S _4 L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# V6 R( A; P2 d" o
1 t! n- w( F' i
9 R* Q. N' a7 D% L9 W, y( R9 @1 t" w/ r |
|