|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! V- i% O; ]2 X, C
- [code]EDMA sample test application
{: k/ U# E: x# i* T - /*: b7 j* \% X7 |. C3 w" {" Z/ B
- * edma_test.c
* O% p* Q! y. v# Q# |( p* d% ? - *1 X1 p- O1 f$ x: A& w. r+ q
- * brief EDMA3 Test Application+ e! F5 w7 v j, J: a% T8 Z
- *! C X) k+ L7 m; w7 W
- * This file contains EDMA3 Test code.
9 J3 ]9 r: C9 Y! \ - *
z6 Z+ d( k" |9 ~, L S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 t l3 x' O8 q' T; O/ w3 l7 x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 h! w' D: |5 N0 `+ W
- * TO CHANGE.+ N3 v( _4 e1 m5 g
- *0 V; [0 f: P, f1 B: ^4 j9 B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 ~4 }7 _! ~/ Y/ \' D5 r - *. X$ C9 m. [, `& w) p5 T' y+ A8 z
- * This program is free software; you can redistribute it and/or: c. E/ c& ^9 F( U* ]$ g
- * modify it under the terms of the GNU General Public License as
8 v( G0 h- P; f/ {$ y; S - * published by the Free Software Foundation version 2.
/ a. d. p3 |; {/ K7 M- N& | - *; E$ |( ?, \* S' U5 @& z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; }/ D, K& v' _" h" N
- * kind, whether express or implied; without even the implied warranty6 l) n$ ~0 f; ~4 d. P* x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' n; G7 g1 N" d$ G# d. i2 ` Q: B/ J: \- v
- * GNU General Public License for more details.
6 [ s) B0 D% a, z - */' m0 q7 H# \7 P/ ]8 o- ^
, ]' o1 v3 h' O9 n* K8 r' y- #include <linux/module.h>
- N/ y6 F1 v" u, {8 i; R - #include <linux/init.h>& _0 o9 S$ A! z* F) G2 `
- #include <linux/errno.h>
7 B8 v7 S( o0 i5 b# ~ - #include <linux/types.h>
1 K; q R; d+ y$ K - #include <linux/interrupt.h>
7 a# \: t9 Y8 s - #include <asm/io.h>- f" s- f; [# O6 R
- #include <linux/moduleparam.h>
. v2 P5 t5 U8 X' K) ^7 A, j - #include <linux/sysctl.h>6 l6 ]; f) B, t5 R7 c
- #include <linux/mm.h>+ W* s$ }3 M4 Q: n
- #include <linux/dma-mapping.h>0 O) f0 u* N/ H! f
- 6 ^ Q ^0 e$ {+ b8 T5 e
- #include <mach/memory.h>
+ j1 T/ j+ F) J; c - #include <mach/hardware.h> g/ ]: k4 k( l& Q2 C% A3 i
- #include <mach/irqs.h>
, P% [+ P. h& p n% G- B - #include <asm/hardware/edma.h>
5 P8 }5 T! X" q. n# B+ [; ~ - / `0 C8 K B0 T# d1 X9 R+ C+ C1 d" Y4 b
- #undef EDMA3_DEBUG
/ I$ i. G3 W0 P# D0 _# j, Z - /*#define EDMA3_DEBUG*/' x6 }$ a0 ~( O+ p8 h1 O8 P
- # U, {! y- c+ ^& D$ B& X& M# c
- #ifdef EDMA3_DEBUG
i9 E% p& B$ L8 W! E6 U8 F3 e) i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! Z; t3 P0 y) H* u0 }) O# u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" U% ^' i$ t( }& y$ Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ o! c. T8 a8 I# n0 p# o - #else
# k6 v8 g5 k2 f7 ^& D1 }# @: [ - #define DMA_PRINTK( x... )
" P* A1 P- ~9 b7 G - #define DMA_FN_IN
" a5 I, P# h) e/ k3 r/ T! D6 v - #define DMA_FN_OUT1 J% K7 k; C1 B8 l7 i) e8 I" y0 ^
- #endif% L7 D3 m- { ~! x5 z G: M: w4 s
1 j$ w3 d, b( z, u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& M, k2 ^, d- E' [! ` - #define STATIC_SHIFT 3* W* @8 D0 M" X* C+ E* f- Y1 [
- #define TCINTEN_SHIFT 20
( G. N9 B9 U- l3 L8 g+ K - #define ITCINTEN_SHIFT 21' l, F9 ?9 t' |: u$ ~
- #define TCCHEN_SHIFT 22$ \- W- w7 D; a- q& { s, w$ Z' S
- #define ITCCHEN_SHIFT 23% X9 ^4 I' O) U Z: y# J
- 9 |9 c3 z( D5 r1 Q
- static volatile int irqraised1 = 0;( M% i( D; b* J7 f- r+ B
- static volatile int irqraised2 = 0;; J! D" p5 V0 _& v
- : x, V- y k9 L. r6 s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( Y. C3 Y+ T) f6 P) e p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 A* ^* B$ }5 `/ `. @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% {4 g1 s5 ?% `7 N$ h
3 e1 j; Q/ O& c$ B0 w- dma_addr_t dmaphyssrc1 = 0;7 n$ I$ y6 A$ i4 w
- dma_addr_t dmaphyssrc2 = 0;
& P( \8 L3 K9 ?" K" Z - dma_addr_t dmaphysdest1 = 0;$ O0 p% }, }7 L } R. X% D5 r
- dma_addr_t dmaphysdest2 = 0;8 g, [2 H& q. ^
- C P4 b- V1 }5 Z/ U# m( o
- char *dmabufsrc1 = NULL;
) h f! h8 d$ w - char *dmabufsrc2 = NULL;/ d7 I. i: a) I R
- char *dmabufdest1 = NULL;; M$ K1 L8 w# [& q5 b
- char *dmabufdest2 = NULL;
# s: e7 B' X3 L4 w - + B3 B! ^# c. b1 |# y/ V
- static int acnt = 512;
# J, W- O# `9 I) _3 M, p0 {. v - static int bcnt = 8;
# t7 z6 Z% j2 z. N. f9 R7 u - static int ccnt = 8;. P2 F# i0 |4 x# ^. m+ b8 n7 E
% L7 L% S# w6 X2 L! d- module_param(acnt, int, S_IRUGO);
: }6 q$ K) K* ^+ }2 {1 y - module_param(bcnt, int, S_IRUGO);
" B) ^: G7 s! N5 c, V R - module_param(ccnt, int, S_IRUGO);
复制代码
- R. F' p; L: e* e8 r% ~9 D4 m3 i9 K) D/ U$ g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! V9 T4 A G/ H% w& ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ _7 _+ ^* e- n! C! N' U& Q( i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: } O- K% V* C4 Y5 O- p( r
0 ^. o2 L) u5 i: e: X4 q/ U3 g3 S0 _, w+ L! k" g/ @
|
|