|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ ]5 E6 w% p2 U
- [code]EDMA sample test application
: `( t/ o( y! n/ Y" B( G - /*
% S3 [& U6 o% c0 h& O, \2 X - * edma_test.c
* [9 J9 m( t$ G) ? - *. b: n; d6 E( ]' n% d4 Q4 T
- * brief EDMA3 Test Application) C, ]0 l! Q$ H
- *, o% k9 X$ O* }4 _! W8 i2 P+ U. y. q
- * This file contains EDMA3 Test code.. z2 ?' V2 h8 \* j2 v
- *
+ n! v r' B! `5 C# X) _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ m9 l6 J8 \1 J6 h; V9 W; C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" E/ C- z. p D0 Q3 O - * TO CHANGE.- I/ w9 A9 f8 q* x; r
- *
+ ~/ t! O v& p; ?' `7 J0 r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! c/ s" M* I0 Y- |* |* k - *
$ e2 \9 |% J4 I - * This program is free software; you can redistribute it and/or6 a$ e" V$ M4 X( d" { ?4 I' a
- * modify it under the terms of the GNU General Public License as
! [$ G) [5 X& K7 b - * published by the Free Software Foundation version 2.
; O5 k- k0 ?4 |, _" x' T' e$ g/ P. e - *: m9 o' H! M/ X* q' Y1 \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 z" z" g- n" b4 E& X
- * kind, whether express or implied; without even the implied warranty( [7 t+ K2 Y; J0 g/ `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 d" t3 Y0 J( B' c8 R' C$ K1 V2 H1 | - * GNU General Public License for more details.
- U, e6 l, L' \0 z$ y% j - */
- @& }/ s# D# T - 1 u0 \. d! D/ F! a& ]
- #include <linux/module.h>
: {. F( h( l7 R" _ - #include <linux/init.h>% E7 Q; N4 ~! h4 c; J( i" E
- #include <linux/errno.h>. V; O- b* T) Z7 h% I% Y
- #include <linux/types.h>
% U3 L; Y2 u2 v0 [. w - #include <linux/interrupt.h>
k# ]. z0 _0 k/ j( o4 s - #include <asm/io.h>
4 U9 L3 t7 d$ k2 g% k) O6 ?+ R - #include <linux/moduleparam.h>! m- @$ P \$ V- n& {# F2 X+ n0 A. |
- #include <linux/sysctl.h>) i# ^" [# G D7 T9 s8 L0 A
- #include <linux/mm.h>" B3 S/ w" G- f) _3 d
- #include <linux/dma-mapping.h># w: P' K: Y* X
- ) b1 W: k6 B9 D4 f, h
- #include <mach/memory.h>
: B9 f7 ]8 k( N1 `& X6 f - #include <mach/hardware.h>
r& M* h, X: Y/ }$ n M* s - #include <mach/irqs.h>5 V1 f ?' T3 ]# w6 O* U
- #include <asm/hardware/edma.h>
, J. Y3 V2 l1 u, C+ \
. n( {7 \2 z! O) d- #undef EDMA3_DEBUG8 _: r. E$ c$ G8 I4 u/ J; q
- /*#define EDMA3_DEBUG*/$ O2 ~9 \% x% i9 P& g! n1 O
- & ~! z3 u4 x* X9 T, @
- #ifdef EDMA3_DEBUG i; T% N6 B0 q1 i# U% p' W2 Q& l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. O' h; k u O0 G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; N. A' g; |5 k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 K9 M9 D, p0 J/ j6 s& V# D. ?" Y - #else+ U3 N( P( q! n
- #define DMA_PRINTK( x... )# @! l( {! r$ ?. f- c: A
- #define DMA_FN_IN. d) ~, ]' \7 H9 [' V9 E
- #define DMA_FN_OUT
* y$ O! I) b2 b - #endif
5 n& i& G g* `) T$ n5 Z# }: e - 3 q' n6 B2 F, g2 U1 u' U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ M; f# I' i9 n/ x - #define STATIC_SHIFT 3
, z" t5 `$ ?! d$ P7 l4 v - #define TCINTEN_SHIFT 20+ Z* d w. u8 g' h* d
- #define ITCINTEN_SHIFT 21
" S" G: h6 s. b+ Y& @! y( `0 y - #define TCCHEN_SHIFT 229 b# ?, v4 r6 v$ C6 L) j3 t
- #define ITCCHEN_SHIFT 23
: @% Y9 b& J3 u) M - $ @5 K, }% O; C6 j3 h
- static volatile int irqraised1 = 0;
) H9 o* e. E* e. D, G- V4 C - static volatile int irqraised2 = 0;
8 o% c% y$ z& s$ ] - ; w3 @ r: t: ?' v/ \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) l5 _8 o% Y$ W1 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" ?5 X* o M- _+ I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' T0 P: |/ W$ x0 W8 R: d - 3 H7 a% Z7 K# \( h6 Z6 ~! K1 ^
- dma_addr_t dmaphyssrc1 = 0;
4 \. e. O" ]4 v1 t# Z B9 m M - dma_addr_t dmaphyssrc2 = 0;
: I1 P1 S, I g1 j0 i - dma_addr_t dmaphysdest1 = 0;7 `. O* Z% s4 ]" s5 W5 M. `7 ]
- dma_addr_t dmaphysdest2 = 0;
1 ^! j3 k1 q( e4 U" ^1 J* O* ~# U
0 J) W6 B% B7 X. ]- char *dmabufsrc1 = NULL;5 y2 x0 M+ G! ^/ s8 @5 g& L6 t& |
- char *dmabufsrc2 = NULL;5 X, U# m/ m' {4 N. H
- char *dmabufdest1 = NULL;+ B7 ~" n" J8 }' e2 J# {1 h
- char *dmabufdest2 = NULL;5 z5 L! G) P8 j( g+ C: N0 Q
$ a a& a/ Y" M- static int acnt = 512;' U2 Q. k. b- U; U& \
- static int bcnt = 8;7 A+ [8 j+ e7 o
- static int ccnt = 8;* Q& y( a: Y! G
0 N a2 I2 Y& \- N- module_param(acnt, int, S_IRUGO);
9 w2 `/ S1 `1 y/ N5 K9 _/ n" D - module_param(bcnt, int, S_IRUGO);
9 J! r) k9 Z7 R - module_param(ccnt, int, S_IRUGO);
复制代码 % [* \+ p- p5 ]! e, e& V. `( ~
3 m- ?4 c6 a* ]& D1 { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; T8 Z* J2 G2 l# Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 Y; C! O" U r( |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) w8 z" n3 n1 ]3 U3 y: p
; o% d+ V: P2 ~0 S* \) i3 p* K
7 t1 ]8 ], L k |
|