|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! Z0 ?0 C5 }6 x. A- [code]EDMA sample test application2 o# U/ s4 u- R: V
- /*
6 e6 F% l: X- U% R3 d1 b - * edma_test.c
- u1 }: \ @; Y$ A- z - *5 Z O* m1 Y3 t0 |" v( F0 S
- * brief EDMA3 Test Application
! L e. Z. [9 o: h* }) X$ q3 j& E - *
4 O" z& L' e" t$ [) k: w - * This file contains EDMA3 Test code.
) g+ C( q7 s7 i2 _# a( ~5 g$ p - *
. ]/ d# E1 }9 _0 v5 m: N S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 `" u% }; P1 _6 ]* o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 ^$ K9 E3 V" T( G/ o4 U! O1 N3 |
- * TO CHANGE.3 K2 T. M2 U; |, o. k
- *4 H% Y5 G* E; h e0 w8 f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 R/ A `+ [, K/ L: T - *7 X" B: t& S0 a+ Z6 u* A
- * This program is free software; you can redistribute it and/or
d' S0 M& {/ d9 X; y$ |+ _ - * modify it under the terms of the GNU General Public License as) v+ [+ H- R# G6 H/ h; z
- * published by the Free Software Foundation version 2.
s* l9 D, G* `4 }2 E; B - * F3 r- z1 W! E' a& O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 [7 ~0 u: S( e, G. m) R6 n& E$ z
- * kind, whether express or implied; without even the implied warranty
2 y, K/ G+ H; F# N: k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 w+ |* `8 l( ]: k/ {
- * GNU General Public License for more details.& m3 M& x" i, @5 r
- */
9 T& F7 a) s/ i- g0 g$ ^& u - ) \4 Y4 S' N" q0 Q" Q
- #include <linux/module.h>. X! k. C/ ~3 A3 V8 E. T- ^4 h
- #include <linux/init.h>
# m& i- S# W. g4 T1 o& v - #include <linux/errno.h>
" {% R( N8 _6 N( O" d7 r: y - #include <linux/types.h>
% H$ V2 d4 V( i7 T& H6 F3 e4 s - #include <linux/interrupt.h>
' q7 E. N: J- B3 ^4 d0 _+ V$ ~ - #include <asm/io.h>
* K8 d2 l, H& M, u- h' T - #include <linux/moduleparam.h>& D/ I# ~3 J5 E3 f3 h( A
- #include <linux/sysctl.h>- M1 W9 l- g2 \% e/ H# k9 W7 f
- #include <linux/mm.h>; p1 q1 [, D1 n& e# H J" @* v7 \6 x
- #include <linux/dma-mapping.h>) A; F4 C, j- N$ ^0 U9 M$ |4 u
- + j4 ^, E2 f* V5 e8 h8 l
- #include <mach/memory.h>
5 C* O, ^4 t) S* ?8 F" U# Y; r - #include <mach/hardware.h>, }8 d) K# D) m6 y' Z
- #include <mach/irqs.h>7 ]: M. `( E$ b" ~1 ]5 z4 X
- #include <asm/hardware/edma.h>/ M8 @8 u% Y' p& z* s
5 M! H; ~( q, h- M- #undef EDMA3_DEBUG
t1 \+ \; u! @+ t$ _3 F - /*#define EDMA3_DEBUG*/
( M' G" X1 ~0 e/ o5 q% l9 @8 z - # W; n! k( v5 d4 A' o8 N
- #ifdef EDMA3_DEBUG8 W. f. x4 ^1 C! Y0 M3 l9 E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 ]0 \9 w5 ]8 P% @- W1 r; J1 ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) K# v9 O/ }0 H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' J, N3 y6 r u
- #else+ U* T/ b3 b. G2 {8 }# F
- #define DMA_PRINTK( x... )
6 o# a7 }8 _ M+ ?7 v/ R% C - #define DMA_FN_IN9 _4 h' M3 {# N1 ^
- #define DMA_FN_OUT
5 o: m5 k$ w) [ W- g - #endif) e3 o1 p/ r4 h) d
2 Q5 c& q5 [" f& c8 n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 U V% C% F; V! f1 y - #define STATIC_SHIFT 31 d7 C$ H2 i2 N6 w+ J' P
- #define TCINTEN_SHIFT 20
# x4 ], h. Q# I: ?: W. e' q9 s5 S - #define ITCINTEN_SHIFT 21( k' x/ W" U5 c+ c4 v* l" `2 m* \1 J
- #define TCCHEN_SHIFT 22. X5 Q, Q) g2 w2 X3 P" k' b) U* Z
- #define ITCCHEN_SHIFT 234 _ v; K- P& t9 v
- & I+ C: T# k6 y# M T
- static volatile int irqraised1 = 0;
" N5 A6 I& i% }! A# y - static volatile int irqraised2 = 0;
$ J( |- [9 U! R; r0 d3 I) Q
}) b5 L. d4 u7 h8 {' D: w X0 f; _* l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# r+ w0 E; k) O5 ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 r; T$ S$ f7 M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" K4 d! v5 U' `) v9 C3 ]' a
% W- _7 a9 G0 `5 \# J- dma_addr_t dmaphyssrc1 = 0;
/ ^! M! U* i$ h* X/ f6 z0 f: `; J - dma_addr_t dmaphyssrc2 = 0;' x. R7 Z; v; |( \; [& i# i
- dma_addr_t dmaphysdest1 = 0;5 B' W6 C* S7 C! R
- dma_addr_t dmaphysdest2 = 0;" u; |9 I1 Y, m# b1 s5 n, f. y
& w0 c8 I+ e6 Z6 @, M$ @- char *dmabufsrc1 = NULL;
# Z' c& N8 C) q, K O3 h2 B - char *dmabufsrc2 = NULL;$ E. h9 K+ J; ~* ^9 N @" _6 |
- char *dmabufdest1 = NULL;1 c0 Q# \8 y8 b* j% ?
- char *dmabufdest2 = NULL;
' ?' j% {4 Y* @5 M1 h, m0 W - : m( A: g" a0 B# ]* d9 H* {
- static int acnt = 512;% @5 S" B8 g, E& s
- static int bcnt = 8;
7 Z/ Y1 y7 V6 B - static int ccnt = 8;* {, ~/ o/ h) t6 H* R
5 M" K" Y9 O' N3 m/ Y+ |- module_param(acnt, int, S_IRUGO);
+ m+ v T: _3 C6 G& P - module_param(bcnt, int, S_IRUGO);4 v F7 [" M" B
- module_param(ccnt, int, S_IRUGO);
复制代码 ( \0 f9 a$ e+ P4 [$ g2 C9 o2 [1 V
8 _7 A# X2 y2 j. m1 j. B# p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- z' P7 ^) ]9 G% {. l9 N, E/ U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 }6 j: w6 X; R, G# @9 f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ m1 R7 e( c' n. g0 p
! |* p* o2 S) @" o
* _4 ^3 X+ M+ h |
|