|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! x1 g) h0 l0 R8 s( G
- [code]EDMA sample test application
3 i3 O# }4 r c% ]/ i - /*
9 w: w/ X& S$ K$ m6 B* J- b6 e - * edma_test.c# Y2 E4 Q; G- ?6 X. S. T3 d q4 d
- *
0 }" f; K$ z( g+ n, i5 I - * brief EDMA3 Test Application
; L9 z/ W" j3 l, h' v - *2 g( O% g& s% {3 F. h
- * This file contains EDMA3 Test code.3 M, g& X8 B1 i$ S
- *
: E, w" i1 ]1 X- R. l6 z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE h1 w% M7 B: \5 a' w* C+ s T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 ^2 n j% H& d) s3 z8 I
- * TO CHANGE.
( D% N2 i/ D. s - *
& X, r2 ], v7 f1 {) H+ j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ g/ q5 z2 X* T$ U) L! I3 c
- *. F# }7 b( G2 y6 ~
- * This program is free software; you can redistribute it and/or
+ \4 W. l+ V/ D4 R" d' Q - * modify it under the terms of the GNU General Public License as
" F7 b0 y8 x( @9 B M, m - * published by the Free Software Foundation version 2.
/ n8 |% m8 ^ v! k9 ? - */ [ q1 x# b/ I* I4 @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 n0 o& K6 c" M0 W' q - * kind, whether express or implied; without even the implied warranty1 `* d5 } q! R( d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 n. ?* P M4 x6 t& n - * GNU General Public License for more details.' _! E% v$ D+ I
- */
# O% `# x# [! G, ^# ^6 d - * M# `3 x8 q% r% X' r D
- #include <linux/module.h>
* i4 G+ m& d: X - #include <linux/init.h>
) l Q; ~: `, G5 b, I4 |6 x; K- t - #include <linux/errno.h>! l/ Z/ z! a. |/ f* ^( G) }
- #include <linux/types.h>
& N, i3 [/ x y: | - #include <linux/interrupt.h>
$ U; h2 r9 x3 ~) M% W" k- F+ W/ N - #include <asm/io.h>; A1 m' B0 r# n' `% Y9 G
- #include <linux/moduleparam.h>. C2 {4 D! G3 L/ m) X
- #include <linux/sysctl.h>* r3 S' f0 _' p/ H# T5 U
- #include <linux/mm.h>
" E% B$ b0 O, C, A, j' T2 p! S - #include <linux/dma-mapping.h>0 z$ ^1 r d* E' Q( Q! m, p- ~! @
# m- r5 \$ U" p9 |# }- #include <mach/memory.h>
5 Y) n& Z+ K! k! {( M - #include <mach/hardware.h>
! k- i' {4 E4 a3 @2 D - #include <mach/irqs.h>! F" H# g( K7 ?: e$ }
- #include <asm/hardware/edma.h>
+ F2 H3 @* i+ `' c9 _ W
9 v" J$ D# m) I- #undef EDMA3_DEBUG/ L/ p+ ]8 N3 r* Z) w M/ X- j
- /*#define EDMA3_DEBUG*// S) Y4 ?+ i* \
0 g) Y& I0 l3 F2 o) [9 [- #ifdef EDMA3_DEBUG, J" u6 t. _* F. [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
E/ T) e) X4 Y; N$ {5 c" @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* s6 b& p2 b/ U% c5 ^2 n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): s) p1 P9 a+ r, a
- #else
5 j9 d3 T8 A) ~. C% v6 E - #define DMA_PRINTK( x... )
+ X+ i0 \$ C$ e R - #define DMA_FN_IN
' ~; C. O- _& C- p7 {! n) H0 @ - #define DMA_FN_OUT9 Y4 q* G0 l: n$ C5 [6 Y5 j2 W
- #endif6 y8 H7 X; b q5 V
- 8 K0 R- c- j4 X8 \) u4 e0 v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) b4 J0 H( f4 I; O6 O
- #define STATIC_SHIFT 3
: P- F6 o9 S/ C# j$ t# b) J5 i - #define TCINTEN_SHIFT 200 W& q/ c0 V5 D2 A" r
- #define ITCINTEN_SHIFT 21+ x5 [' {& i3 e: z r6 j
- #define TCCHEN_SHIFT 22
# f8 n5 Q+ a: F' O) Q - #define ITCCHEN_SHIFT 239 [- ?% E2 N- T5 g; H, F
- * j' ^" V( s! c. e( D/ i
- static volatile int irqraised1 = 0;2 v+ j+ q) n" i% Z- ~
- static volatile int irqraised2 = 0;9 I8 o; q& m2 ?( U
- * p: Z/ s- p! Z3 H. d$ A k2 v6 [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 r, i# ?, o) r. v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 D& i* Z9 H# u1 F& W$ k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& z( \5 Q/ d: Z
- / ~2 }3 [* Z1 g" Q2 ~, I3 K5 S
- dma_addr_t dmaphyssrc1 = 0;
/ r, W/ h8 a O0 U4 u - dma_addr_t dmaphyssrc2 = 0;8 J2 t+ H9 j* U
- dma_addr_t dmaphysdest1 = 0; j) i+ R/ @, C/ s4 S' e; p
- dma_addr_t dmaphysdest2 = 0;( n; j+ z" K# s# q
7 n+ O7 L8 u% |" H& G6 X# h+ r- char *dmabufsrc1 = NULL;
' m! o/ f; ?9 }! a - char *dmabufsrc2 = NULL;
% Y4 A; o! V) P/ A& ~8 _ - char *dmabufdest1 = NULL;3 P1 t7 T [; r0 b
- char *dmabufdest2 = NULL;. f5 B& B4 h7 `* |
- / V" }0 ]5 X0 F2 ]0 B5 t, z
- static int acnt = 512;
3 |* J: i5 a! \/ D7 z. K& `* H - static int bcnt = 8;
+ ~/ B$ L1 M# o" n2 _; D- ~, U: S - static int ccnt = 8;
5 \0 c- ^1 ~" f8 @% H, r1 [ - $ i. ~7 s# A/ G% g+ e
- module_param(acnt, int, S_IRUGO);
; k( x: v% X5 z& E0 k) K - module_param(bcnt, int, S_IRUGO);
( @1 D* I0 |/ c1 {' o - module_param(ccnt, int, S_IRUGO);
复制代码
( ^" }3 F# Q: {% n6 a0 s1 I" d7 s% |. E8 N# b; a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 \; U+ y9 _' q8 f6 u) H6 W7 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 R9 @. e) }0 W0 E, {! i) S, _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# @0 ?; ]( b' ]! X$ t( U, v: Z4 `8 q; O. M' i+ K! P" I; }# i
3 P; S; t1 U! X: I& T
|
|