|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 m) V; D- ? H% N3 _2 y% k) }& j2 A- [code]EDMA sample test application
; h r, V' S! N* n1 q9 e - /*
! a3 a1 Q, T. I' h3 y1 b6 J1 _! i - * edma_test.c
G0 B2 @5 r5 G* K* Y, v6 I - *
( H6 _) _# n# M - * brief EDMA3 Test Application
2 g) t8 A& o$ J* \9 h# t( t - *
! K& l- |. R \5 X% [ - * This file contains EDMA3 Test code.+ q2 M& q% s# \5 e. k
- *
: ]9 ^ ]. S* z& ?! h7 I4 _1 |3 p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; Y2 s' E% H6 d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! D& }& ^. b5 x
- * TO CHANGE.
& [4 U s" @* X, ^/ i - *) ~% n7 a, f6 o. O5 z3 E0 |9 _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; o+ _& v! \3 ] ]; d$ I8 ]8 q - *
8 z8 G( J4 a1 _ - * This program is free software; you can redistribute it and/or
( J2 F. p6 j! P) y- K - * modify it under the terms of the GNU General Public License as
/ F; F" {% M! n7 o - * published by the Free Software Foundation version 2.
+ H, B9 o% u" I5 U( h/ @$ o6 X. V" P* _ - *4 d: }# R& }) ?1 o0 {* l+ Q+ c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! N) [ J a6 `" M
- * kind, whether express or implied; without even the implied warranty
6 X, I" |! h, e6 v: ] a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( A: j! b. a( X1 f- [* N2 Z( ~ - * GNU General Public License for more details.
) W3 k! @6 K# G; h! A/ w - */
5 |& {# Y' `5 M/ b/ J0 t - P/ i# R; `( k1 p) k$ O! @" P
- #include <linux/module.h>; }6 v: z/ U5 u; J' N$ `
- #include <linux/init.h>$ _0 d! M' }/ k. ^& E3 j: ~1 ^0 ~
- #include <linux/errno.h>1 W6 K& O: I, {$ z f- I2 v
- #include <linux/types.h>+ g3 M9 q! r, L$ @- _' F/ E/ g7 S
- #include <linux/interrupt.h>" e5 q7 r6 T7 C9 Z3 |; I
- #include <asm/io.h>
2 X4 D/ ]" p9 |1 C - #include <linux/moduleparam.h>& [; J$ r. a4 z. [# b$ ]
- #include <linux/sysctl.h># v) ~! n; a/ Z( i9 U& j' {& D2 {$ H( S
- #include <linux/mm.h>& p/ j" C3 o" I9 o
- #include <linux/dma-mapping.h>
. ? r+ H; p i" n4 {; e2 Z
# d$ Y' \+ u1 e; @- #include <mach/memory.h>5 J# }( Y5 @( N* l- Y4 b) l
- #include <mach/hardware.h>
7 z* Q8 O7 X' ]! g' h2 q7 Q - #include <mach/irqs.h>
. M& D/ U6 h7 n# {7 L7 ^5 b - #include <asm/hardware/edma.h>
9 E$ X9 b" c" S' T/ {2 L - 8 m- J* \( g6 \6 X
- #undef EDMA3_DEBUG
8 z1 ~# T* Z2 S7 B7 ?( ?% }. s - /*#define EDMA3_DEBUG*/- J7 h3 I/ l) B- C( N
6 U4 V9 K% A5 N; _6 V3 A, U- #ifdef EDMA3_DEBUG- y4 m1 t& t/ D" t) R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ w0 P! {7 ]( |0 Q: f. [* d7 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; f( E; J4 l9 ~/ C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 V7 p2 G, D4 G" h: a6 G, R, I - #else
% E2 S$ y% q, \5 J+ T6 y% l- z% F - #define DMA_PRINTK( x... )
' |- {9 w' r+ A0 M9 l. L" D& y6 E - #define DMA_FN_IN
% T* \( q% T% q - #define DMA_FN_OUT* E5 q- j8 L6 i5 J
- #endif
4 s4 i1 f' V) R6 @
8 t3 }7 Y, C& Y' b2 a$ g0 Q# i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 d3 V; \- ~' s8 i - #define STATIC_SHIFT 3
4 U2 B( S0 V, d% t2 b- _& o( R1 c/ O - #define TCINTEN_SHIFT 20
: R# ?: J3 `6 G$ O4 t - #define ITCINTEN_SHIFT 21( V. C7 u' a4 G0 r, m
- #define TCCHEN_SHIFT 22
+ N' }5 V4 y8 [9 h- _3 R) m* B - #define ITCCHEN_SHIFT 23 ^3 p- s+ S+ K2 E0 t
- 1 a: a# }# u6 B+ l; \5 |
- static volatile int irqraised1 = 0;) i5 P0 w; ^, |' r( i$ ]
- static volatile int irqraised2 = 0;
! i, v0 N N1 m
9 T( T. C+ T# E) W; a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. _1 L, V& K$ k ` i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 x' X4 V. D {1 j2 a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% |3 H2 E2 l9 Y) y. L
- _/ T7 y* M' V: M" ]0 a6 |$ h/ \- dma_addr_t dmaphyssrc1 = 0;
9 X8 r3 w: S- O/ @ - dma_addr_t dmaphyssrc2 = 0;
8 t6 G% L x2 R$ E# d4 M; t - dma_addr_t dmaphysdest1 = 0;
+ L; Z$ z" A& M- l- E - dma_addr_t dmaphysdest2 = 0;' q9 @, Z# E K( i$ G5 [ d& T
- ; N s; G1 `( _. f- a9 }" V: |
- char *dmabufsrc1 = NULL;" K) a6 ?# u8 l% h. U: f" R
- char *dmabufsrc2 = NULL;
& d( O) b p% n - char *dmabufdest1 = NULL;
1 \5 r% j0 }# F9 F7 ~8 Z6 V - char *dmabufdest2 = NULL;) c1 E+ R7 o4 j: F/ A1 x" ?+ }: g* P
- ^0 D0 W, q" R' h
- static int acnt = 512;
8 B! ]6 h, R/ q; X2 R - static int bcnt = 8;7 x1 Y& t! p7 K+ N/ x; m3 [
- static int ccnt = 8;
3 D3 d5 ^7 v+ i" d2 f2 n5 S - 9 e: F2 A6 ?1 l3 J- H- \6 l
- module_param(acnt, int, S_IRUGO);
1 X3 [# L$ e: P& w! p" b - module_param(bcnt, int, S_IRUGO);
) M. n1 Y; T7 M; X! ~ - module_param(ccnt, int, S_IRUGO);
复制代码 + Q2 k t& u1 E7 t
5 s' [8 j6 c z' H/ D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ q/ P/ {3 j; L9 o5 ?5 U: _# t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% T6 O8 k* u- z1 ^! s: X3 e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 Y' A% I+ k- Q1 v: O. l
" Q1 m8 D% N7 b0 P/ l, e; H% U/ f; Y/ k, p. y9 a
|
|