|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 Z1 Z! e. }; d8 v8 H) b
- [code]EDMA sample test application
# N7 S, S4 G8 D f7 [. D8 z - /*
* q O1 B+ S! k. T( a7 F - * edma_test.c
' S. U. ^ }. Y# ^3 Y5 K: i; Z - ** b7 _6 M2 _5 P8 E5 d; ]# f
- * brief EDMA3 Test Application8 A) k( b& {6 v2 R$ x( f2 B
- *$ M: E: y. h+ T; U; u
- * This file contains EDMA3 Test code.
0 a5 g5 V2 y y, z/ F3 e V - */ f3 p, G9 U; J4 c! { z! `% C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; i/ Q0 l# z0 @+ v- {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* c2 D" \4 P) M8 z - * TO CHANGE.! I& |4 U) ?6 S
- *
& J0 v* V) w, u- e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. Q- d) i3 _ i$ K. E( y' h8 U. P
- *6 [& q) U2 c4 p1 W* d" B
- * This program is free software; you can redistribute it and/or) h2 j6 j5 d+ c0 p
- * modify it under the terms of the GNU General Public License as
8 _) H( h# A u4 t+ _ - * published by the Free Software Foundation version 2.
5 P3 K$ E3 e0 N, U+ y3 V: E - *3 `" E, x" l; q* R& F+ I! Z9 }/ K! A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. U0 C% E0 o9 _8 Q5 c% h: X
- * kind, whether express or implied; without even the implied warranty
% l* I1 _' j# c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the L' _: ?8 C" w! I o
- * GNU General Public License for more details.4 Z: ]7 L2 U0 a
- */
* g) q/ H$ ]9 Z0 V7 A4 I( j% I3 { - 5 @" O/ f/ A& }: i/ s: }$ M; g
- #include <linux/module.h>
2 ~5 P5 j5 H9 m3 d& j - #include <linux/init.h>
' ?! M$ ~+ h( v/ o - #include <linux/errno.h>
3 H1 s1 T: N7 {, q - #include <linux/types.h>
3 m+ s7 q4 j0 u8 L+ \1 p3 ? - #include <linux/interrupt.h>. J% v5 h( t; r6 t1 L
- #include <asm/io.h>, b x' _ u) A7 n& ^
- #include <linux/moduleparam.h>
; e. i" j2 P9 ^4 \ - #include <linux/sysctl.h>
. B+ e9 p, @4 T9 R4 p! f3 z - #include <linux/mm.h>
4 E9 n( R3 o2 r - #include <linux/dma-mapping.h>
3 s$ E5 |! S, V$ }/ n - + P" B& E$ m3 D3 [* H' u1 B/ \3 B
- #include <mach/memory.h>
- \! }3 e* w; x1 k9 q' ?& I - #include <mach/hardware.h>" e5 G8 Q T( Y6 g
- #include <mach/irqs.h> R! W' y; H6 y: c: C# `( x1 n$ J
- #include <asm/hardware/edma.h>
4 C! ]( ?5 f- V1 d& ^ - : Q: P- @# E( I2 \( h( ?2 y
- #undef EDMA3_DEBUG
( }& `' `$ ~6 L s" W+ ~( Q - /*#define EDMA3_DEBUG*/) o9 b* S4 [- `% X- @' B
- % M; ^# k4 q; g) [6 @/ q( [ V( g
- #ifdef EDMA3_DEBUG9 c! x, B; w+ G( C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# o5 m! i! A* \7 ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; [0 L! c6 S7 D' B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 l* P3 S' I3 T8 z& k
- #else" j# O; D1 A W- v: A
- #define DMA_PRINTK( x... )) d" x# Z9 J7 t+ {. q2 K
- #define DMA_FN_IN% y8 ?0 p o7 G3 |9 @1 h9 K7 j
- #define DMA_FN_OUT
8 l0 V4 L! f3 v! L% w, a - #endif! e+ U* z& O6 e ]( b
- # ~! B' p4 n. U* e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); _ F' y0 N; {/ O) a5 ~
- #define STATIC_SHIFT 30 u, Q& S2 m! U0 L% [; b
- #define TCINTEN_SHIFT 20) t* ^' Y- |6 C" `
- #define ITCINTEN_SHIFT 21
' z: \3 a6 o A/ W) r; ` - #define TCCHEN_SHIFT 22; }4 Y+ h% m, |; ^- C$ f) }
- #define ITCCHEN_SHIFT 23
; |, U+ b5 P. {* ?' U! t
$ r' l$ e9 h9 b- u- static volatile int irqraised1 = 0;
5 S9 M7 J5 ^' I" R* X4 M1 \ - static volatile int irqraised2 = 0;
; d9 |4 C8 R- i8 N - ' G, N# b" Y0 e2 T9 K+ L, z1 r, n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' c0 p, c5 f. ^% v5 D& V1 \7 ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& {( G$ ^+ X* u& [3 k e' a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ j2 ~+ t! ?6 P$ T) i2 Z2 N+ M
5 u7 M- ?- _, w" q- k! g- dma_addr_t dmaphyssrc1 = 0;+ g8 G& G$ K4 X; g: B
- dma_addr_t dmaphyssrc2 = 0;
; Y Q% U# ` M, H% e6 m5 ?! B9 d5 s - dma_addr_t dmaphysdest1 = 0;. c/ T5 O2 ~( B! \& |
- dma_addr_t dmaphysdest2 = 0;1 A, s2 H7 ?0 S3 m$ e
- H) N& P4 P% @- char *dmabufsrc1 = NULL;; K4 {8 B' |* @2 V) S0 j; ^" v
- char *dmabufsrc2 = NULL;5 E1 \+ f. g& g/ e" [: G
- char *dmabufdest1 = NULL;
% B$ c0 ~0 J9 \; V! C# I4 h - char *dmabufdest2 = NULL;
& Y. D2 T- n' `0 q- w& a - ; J0 S& D( ^& o @
- static int acnt = 512;
) D! t2 F n& H: g1 \$ V - static int bcnt = 8;7 |% F6 g0 i$ _% n. U4 t R% A
- static int ccnt = 8;" T$ {* u5 b& e# P* H- R
% Z5 W; A- }3 n6 B4 ]9 n- h: }- module_param(acnt, int, S_IRUGO);
O# E# Z0 ?" }8 z/ L - module_param(bcnt, int, S_IRUGO);5 z) ~" d& J t" i& x
- module_param(ccnt, int, S_IRUGO);
复制代码 ! r' m2 z: h! Q) i
5 D4 [+ h( B* f8 G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. |( c% e: S: I$ O. L7 p1 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; C- m1 g g3 }- t/ q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ v5 x$ B7 E. C0 P/ a {7 F) ^# t8 ~. v: {
: V6 L% Y- Y5 a. f! m
|
|