|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 D* S! |$ f# M5 i3 m9 `
- [code]EDMA sample test application1 H) y2 j8 {4 \. Y, v+ P
- /*
! F7 v6 S, [9 l7 ~ - * edma_test.c
3 v/ k; ?/ y# {7 F( O0 x {' h @ - *6 t" B D, m4 k+ f* n0 \
- * brief EDMA3 Test Application. F8 f* q$ P; ~
- *
+ e1 C, \! Y5 Q+ b2 g - * This file contains EDMA3 Test code.
+ r/ U! B4 b2 Y4 s, b; Y - *; X3 m0 a" W) F4 X: r% f' `; m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 s6 j( Q- Z9 r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 F4 _& n: |# l+ n: n
- * TO CHANGE.$ q( l+ Z. A2 V' s
- *$ D4 o' U& w+ Y! x7 l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' W- y d6 k+ z2 S7 V
- *
! }4 L( @$ Y7 p( q8 B - * This program is free software; you can redistribute it and/or+ l) C, O& W v$ N- f) a0 y
- * modify it under the terms of the GNU General Public License as
, `4 R9 p5 A. s! v9 x6 T- X6 y& S - * published by the Free Software Foundation version 2.
# p) O; v2 m. D9 Q. Q - ** _. D# \# t, C* T0 F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. f5 ?3 O) ? E; d - * kind, whether express or implied; without even the implied warranty0 F3 s% t; \* g& t1 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 i$ W9 n$ s1 A! T8 ]
- * GNU General Public License for more details.; y9 l" E: f9 a0 c+ X0 R
- */
^; w1 c. F& I3 |. e% I4 O - & A" m; F" _( h$ S& o
- #include <linux/module.h>* _+ ]! O( }2 ^& f$ R7 }
- #include <linux/init.h>
4 U4 L" h8 ^; D" `, x7 ^ - #include <linux/errno.h>. k5 l0 a' p# ?3 y( B2 k1 }' ?
- #include <linux/types.h>7 O9 ]4 b+ f5 o- w* V5 s
- #include <linux/interrupt.h>$ q5 n( ^& D }7 w2 e3 B5 P
- #include <asm/io.h>
% D K# R; M- f% |/ P2 f" m, U - #include <linux/moduleparam.h>
3 Z- B6 K9 b. \3 x- H* h - #include <linux/sysctl.h>
/ s9 r; o& b" E/ J9 G6 s& h - #include <linux/mm.h>) {" g6 m X! S1 X- u8 ?
- #include <linux/dma-mapping.h>( R2 W# B: x" {6 j+ r0 ^! U* g
9 M" U0 D- V" b: R7 W# G% D( I# R- #include <mach/memory.h>; c, \) k: k# B" o4 M& [
- #include <mach/hardware.h>, y i6 o2 v: P n [4 E0 h
- #include <mach/irqs.h>
1 k5 r, s! G1 _# r. h$ @4 K' G - #include <asm/hardware/edma.h>1 ^ X: Q" H2 ^8 ]* r
9 A1 _ M/ G+ `- #undef EDMA3_DEBUG2 @! k+ p8 d* K/ _2 i, m' \% N7 v) R
- /*#define EDMA3_DEBUG*/
) I+ W, {/ }# Y" j# ^+ f5 t; \
6 B$ g" R& j# b# H4 X$ H) M+ ]- #ifdef EDMA3_DEBUG% c, i" A/ W8 s" n9 F* t9 J* F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 {$ S4 B# Z! a; j0 T; G' d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* C6 {8 u0 v" _& J1 z) w; m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' I. S$ E6 C+ Q. D, Y
- #else
5 ]- F0 U" I \, B- m - #define DMA_PRINTK( x... )$ H/ k( X- W3 j0 ]
- #define DMA_FN_IN
/ s. ?6 X/ R; X! C8 T5 B - #define DMA_FN_OUT
! H; _- @& A; Z' G& \ o! i7 a - #endif0 f% c- Q% Z% ]: Y
- * o+ I( ~; J' g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) c, v8 f) Q( |
- #define STATIC_SHIFT 33 N. _% r# y8 S s9 @0 }; {
- #define TCINTEN_SHIFT 209 J5 ]& l& Z2 L2 n
- #define ITCINTEN_SHIFT 21$ Y; a9 V0 e1 x/ ^" ~
- #define TCCHEN_SHIFT 22
, [1 ~* r/ B/ v2 u: @# s& R - #define ITCCHEN_SHIFT 23
5 K/ i& i# s& |% { - , P/ H6 U+ B ]4 f E& g5 n- x
- static volatile int irqraised1 = 0;8 A! A. l2 }! z" B7 S5 l6 S
- static volatile int irqraised2 = 0;8 p& X1 S; E: F% X; u- x) ? X
# P' V0 J3 ^4 K$ f! a" O& m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 I! }9 O+ Q6 I4 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ A; v% p0 ?/ Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ?$ t! {8 a7 F/ h2 @ - 0 B& S5 R5 N8 `4 ^3 ^' m/ m
- dma_addr_t dmaphyssrc1 = 0;
: ?3 l: ^5 B5 c! K! O( E/ m - dma_addr_t dmaphyssrc2 = 0;2 |8 k+ C; Y7 R- q- a- @
- dma_addr_t dmaphysdest1 = 0;6 \; V( A0 _6 W8 b' |' X3 A6 z
- dma_addr_t dmaphysdest2 = 0;, r. L, H8 G7 w" G2 w! y( B! m. |
- & J0 e; a2 U4 L3 l0 W
- char *dmabufsrc1 = NULL;
3 U2 y9 I' K& V9 C; } - char *dmabufsrc2 = NULL;
3 Q4 L6 Y9 C4 b% i1 D& g - char *dmabufdest1 = NULL;+ v5 j8 f/ T1 j+ E! u/ s* m' w
- char *dmabufdest2 = NULL;7 `$ f, Q4 |3 `8 U
- ; o6 }$ Z- B( K; T
- static int acnt = 512;
0 O g0 w4 y) l# c - static int bcnt = 8;$ _4 ~; ^$ N3 t N, D
- static int ccnt = 8;
$ n# Z* d6 K- H2 S! v! I
( u5 G0 e2 Q$ }) M% Z( h( l- module_param(acnt, int, S_IRUGO);4 [$ C- l/ m+ _) n
- module_param(bcnt, int, S_IRUGO);
" S' ` t: q7 O& s+ N/ d6 a - module_param(ccnt, int, S_IRUGO);
复制代码
0 m8 `6 ~) M) u% O) G5 l4 k
3 }3 [8 c+ u& G4 q g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. b8 f5 e, D! H8 U$ j. W2 ]" \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ i% a+ ^2 [3 y( J9 B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 Q2 I8 o; W: F3 f x' N" ^* a5 y' L% N9 Q7 Q4 U7 o" J5 l
z! H' z% T: `. y% K
|
|