|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' F9 o/ T$ ~! l! I* x# n& w: n8 I
- [code]EDMA sample test application
. l) S, a. b3 V3 k4 V - /*/ W: `9 I0 Y# B( ]! }" m1 [; i
- * edma_test.c) `* v7 G/ z6 O: I2 v
- *# n! f% ?$ h4 V4 J; i' @
- * brief EDMA3 Test Application1 M! A. O2 S Q% \9 P* N
- *
% Q5 |& ~+ J5 f! L4 b7 _. ] - * This file contains EDMA3 Test code.$ ]" e. w9 [$ y3 D- `; r
- *, Y# e4 K# U2 d9 o1 S0 `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 G3 A, x: e2 [( X3 O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 E( y; U+ n7 l" E& z - * TO CHANGE.$ `: ]4 i* l7 j
- *
0 o7 G+ {8 i7 K; d. S9 Z+ @$ m, M0 o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. Y _+ D8 `7 h" L: G - *8 Q% ^( B7 o% g
- * This program is free software; you can redistribute it and/or
. {( f e( d+ P - * modify it under the terms of the GNU General Public License as! V. `' F- a; h" l
- * published by the Free Software Foundation version 2." u3 D( `2 W4 t" `- k* {
- *
3 E1 w2 v0 S0 r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& E! D: q* \$ t) z
- * kind, whether express or implied; without even the implied warranty- }, ^& r3 x# {# M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# o/ c/ C* D! Y$ ~' e% [4 z3 { - * GNU General Public License for more details.) R: Y/ g" U& h# ?7 S, O
- */
1 B% [; Y+ F$ S0 V$ _ - 4 @6 H; B- b8 _% [; s, l
- #include <linux/module.h>
4 t3 D# l! O5 Q - #include <linux/init.h>
+ O: m! |' ~' s; m s - #include <linux/errno.h>
t: [! ?4 m; G( U! `4 c - #include <linux/types.h>
/ |; r% f- \! u. h) W - #include <linux/interrupt.h>5 V# Z( c( I* K: a Q! @( e
- #include <asm/io.h>$ J/ d& v, [5 c7 ^7 \' ~
- #include <linux/moduleparam.h>6 c* I- X: Q9 K# r3 H. [# c& ]3 h
- #include <linux/sysctl.h>
# ~0 @" H7 t8 ]7 E1 } - #include <linux/mm.h>/ y4 ], T" U" }; Y5 K# `
- #include <linux/dma-mapping.h>' s' Y" N" A6 c
% d, ?# G. q- c9 I- #include <mach/memory.h>" a) Z$ G# e2 f3 `6 ^, O0 M: Y
- #include <mach/hardware.h>3 V. v% ?0 f9 P; {7 N, E3 B4 U
- #include <mach/irqs.h>
4 U; T( I4 b/ @4 C0 {( h - #include <asm/hardware/edma.h>/ w; `/ D2 A( H" @+ W {7 E
- 5 W8 q4 d C0 G- H
- #undef EDMA3_DEBUG, j( ~7 j E" v( g6 v& a1 Q$ |
- /*#define EDMA3_DEBUG*/
( ? e( p: I# M+ M* q4 U6 y% b - ' `3 {0 P$ t' G5 f8 ^0 G
- #ifdef EDMA3_DEBUG s% Z# |5 H# i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 E, C! \* O( K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- P9 N3 _0 \2 C, s" b1 m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* q# S1 B+ ^# W* T5 }& ` - #else
& x% M9 U& J1 d8 t9 j$ P8 H - #define DMA_PRINTK( x... )
9 Q/ `: y, _, o8 S! p - #define DMA_FN_IN m+ h0 V( a; K
- #define DMA_FN_OUT' L5 q0 @5 x1 \( q4 r# n% K
- #endif; I n! ]6 p, V9 W: L( y
- ) N$ ?; ]' [* v. H/ x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) a _6 u2 f+ @3 Q( } - #define STATIC_SHIFT 3
7 U( K# t* u/ J, D+ m - #define TCINTEN_SHIFT 20
0 b1 e; m5 k3 J9 B5 ^; B - #define ITCINTEN_SHIFT 21
# A9 w/ Y! K: x3 o0 w - #define TCCHEN_SHIFT 220 Z) z1 h/ d: \% c2 g
- #define ITCCHEN_SHIFT 23
0 H O: J6 Y5 [$ J: o; ]) w - 3 E( _, u. Q$ `2 S& n0 Y+ y
- static volatile int irqraised1 = 0;/ z0 ^: ~5 `* I$ | u! p
- static volatile int irqraised2 = 0;
d. v F" P$ X* o0 l! q4 a - 7 o" ^& u$ F5 k$ p) j" z- W8 F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 z. N( Q7 \$ H$ N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 q. l, h) D) q4 U& t0 w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 `3 m* ]. P; ]" h/ W4 X& b9 x - . j% r) o2 @* w; H B e
- dma_addr_t dmaphyssrc1 = 0;/ y" }& V% i8 [4 }
- dma_addr_t dmaphyssrc2 = 0;
% b! f% E; z4 a4 p - dma_addr_t dmaphysdest1 = 0;# }3 W0 K& B% r: |1 u% }- `
- dma_addr_t dmaphysdest2 = 0;* l. n9 {+ p1 q! i
" ]/ e8 x' B8 N" m/ w- char *dmabufsrc1 = NULL;+ e9 ?# k# |7 ^8 f$ h1 c
- char *dmabufsrc2 = NULL;; O- J. M7 ^; [9 }3 P
- char *dmabufdest1 = NULL;5 N3 c: I) l$ P/ e, q
- char *dmabufdest2 = NULL;/ d q! I% l9 _! T, h
1 |: m/ {$ ^! A! T- static int acnt = 512;
$ f- S! V/ O+ q$ I! k2 a& ? - static int bcnt = 8;" m- i8 V3 H; x5 Z8 c, W9 \
- static int ccnt = 8;; i% g$ _% y& l5 Z5 O
- 9 X1 S) n5 Q) r6 \3 m1 N7 f
- module_param(acnt, int, S_IRUGO);
" Z+ O1 D3 i5 y2 Y - module_param(bcnt, int, S_IRUGO);& v( |. k4 O9 ]3 V" e% b$ {5 g
- module_param(ccnt, int, S_IRUGO);
复制代码
1 f% m/ d; K: [& K* G
, d, a+ D8 S+ w) u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 {6 s8 N: m; u t k% U4 [! iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 w6 F; \: h$ D+ Q, k q' z4 b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 e3 U3 ~8 h) y4 a! N2 J) ^9 W/ w/ J: L- Q
4 A2 s) |5 Z9 C7 _3 y |
|