|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 I H% Q/ h2 E' K5 I
- [code]EDMA sample test application: Q# l6 r) U/ ^; d* y! @' N2 X
- /*" B. ~' w/ f; o8 Q; S1 l; U% S, K
- * edma_test.c. h6 n' t7 Q3 L. V+ b, G
- *" e1 A! I! u" C# N3 C/ \
- * brief EDMA3 Test Application
7 Y( M, k& R' [$ K& y2 K - * `2 q, C0 `0 d9 k4 I* t
- * This file contains EDMA3 Test code.
) E( W% ]7 a( v! R- V9 S - *6 p5 A1 G6 o. q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 ]; C' B. ?6 Y: V) u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) m3 a! L1 @' q9 x: b" t* `: r# N
- * TO CHANGE.
; D& G% L' V6 ^" [ p5 @# `! T - *
: Z* w# x. ~) S, t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' C: j+ e" q9 f$ \$ X# \
- *0 ~3 W9 U" p$ d8 p$ t
- * This program is free software; you can redistribute it and/or4 t; [3 @( j( {! ^+ I5 q2 e
- * modify it under the terms of the GNU General Public License as, g" k6 ~6 G6 [4 Y N3 `, t _
- * published by the Free Software Foundation version 2.! F! E9 ^7 E+ N8 i. c
- *5 K$ J, q) i% c3 v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ p" l8 y; @. C2 m* h0 f0 ?! O - * kind, whether express or implied; without even the implied warranty
, J7 }% d7 p, b3 o% f! v8 V# B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* S# Z/ O6 j8 s# d7 G. O3 q - * GNU General Public License for more details.
/ B: {0 q) K/ O' L - */% ?' ]1 j% ^9 e7 k. h, M+ E# R
- 6 l5 f: y7 b" {' t$ c' U
- #include <linux/module.h>1 ?7 v6 P% \- x1 [, F( @2 z
- #include <linux/init.h>! F( x; ]+ l8 R/ x0 C) s& ?
- #include <linux/errno.h>. v: I1 r; D9 N6 x
- #include <linux/types.h>6 B& \* \ a2 @& Y" `1 @. s- z# M
- #include <linux/interrupt.h>
# ^+ y% P: M4 ^& c1 f3 i - #include <asm/io.h>
0 L6 I1 b1 H4 P! ?- Q6 E - #include <linux/moduleparam.h>
. V; W; ?+ l( R - #include <linux/sysctl.h>. f. e2 V7 |' c7 l& l3 K/ T
- #include <linux/mm.h>2 s. h6 M- o0 W- C2 P$ }& S
- #include <linux/dma-mapping.h>
5 B1 D* t2 B' ?" w) K9 ~- U1 o
. z! H$ [1 `( _3 s u- #include <mach/memory.h>' r( K6 k' r* P9 i- k
- #include <mach/hardware.h>
0 b+ \% K" G1 M( ~: K1 b, B$ a! D - #include <mach/irqs.h>, Z) w3 [& w" h9 Y
- #include <asm/hardware/edma.h>
; w* R' y; A7 ~# a
6 y' g$ s& M( }' r5 Z- #undef EDMA3_DEBUG$ Y }0 z8 E* B2 Y5 {0 c; p
- /*#define EDMA3_DEBUG*/9 D) K/ C/ a: H* |/ k8 Y0 _$ _: y
$ _3 E: I! o0 E" G- #ifdef EDMA3_DEBUG
2 A* m5 q( B c, F7 I- @3 |, h7 M5 u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; v, v3 L/ \4 k+ V( C. B3 U. m R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) r" n! ~% R! E' J. d: X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 @# o! o6 D; ?! d4 O4 { - #else& M. o3 Q6 \$ q7 Q5 v/ I
- #define DMA_PRINTK( x... )
$ v2 X- z( _6 e" l8 ^. N1 I2 ]# N - #define DMA_FN_IN" `, B$ n9 V, m$ x
- #define DMA_FN_OUT
/ j( G( s& L# o - #endif
: P! k" L3 t3 }0 P3 _, V
" i7 i; I# a6 S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( V, J4 P# H% L0 Y% m - #define STATIC_SHIFT 3
9 i `0 P& w0 a2 \+ e3 z# L0 d - #define TCINTEN_SHIFT 20* O) D" n5 T6 b# Y' ~
- #define ITCINTEN_SHIFT 21) [& z6 y6 X' V; u9 y7 j, g
- #define TCCHEN_SHIFT 221 m% m# I2 u# D% z8 V& @# l
- #define ITCCHEN_SHIFT 23
. I, y8 e. l5 r( e - 0 _$ h3 d( d0 L3 Q E0 ]1 K& u- I5 y
- static volatile int irqraised1 = 0;
0 O6 u' x' M( e5 b7 \ - static volatile int irqraised2 = 0;
( C; x" Q" _+ ]0 }% t% F* t - / V! P% S" i" y" A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 ?: |. t% b) w" }* f5 J1 E" N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 Y$ [) O' U+ L/ W" l2 q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 t* i- ^6 p$ ^: Q! R7 m
- 6 U' X# c, X' [
- dma_addr_t dmaphyssrc1 = 0;
' [' { d* t8 u7 H' ` - dma_addr_t dmaphyssrc2 = 0;( _, I% H% Q! Y; \5 k
- dma_addr_t dmaphysdest1 = 0;8 a+ s0 E4 F( H3 X4 V. r$ @) W) M
- dma_addr_t dmaphysdest2 = 0;
. k* n6 J3 R B5 q7 t
, \8 D4 d) q2 o6 D$ ^0 k+ c- char *dmabufsrc1 = NULL;
! b0 _6 b* L! }- L - char *dmabufsrc2 = NULL;1 U; @9 C. O& N* r+ i# ]: d& e
- char *dmabufdest1 = NULL;
a: h3 t$ k' q - char *dmabufdest2 = NULL;
5 b" A3 x# Q' U
6 j. T& ^/ v& _7 F- static int acnt = 512; h: g1 E. B7 T' c+ Y" l
- static int bcnt = 8;
9 d, x" c+ v& R* e7 o - static int ccnt = 8;
: i ?3 l- O2 A& A - % z6 V0 I& `3 L! \! U& e$ p
- module_param(acnt, int, S_IRUGO);! J' K* I; T% B: F- |6 L
- module_param(bcnt, int, S_IRUGO);" U0 z: r7 f- Z$ G/ D2 t5 }* Z
- module_param(ccnt, int, S_IRUGO);
复制代码
8 z1 ?& Q2 E' U; i6 O% F7 h3 r5 n$ }6 ~& ^! O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" e0 J6 s7 O$ B: A
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 J8 ^; T4 p, f$ Q" r& _: O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& c- N$ v" r c; ]6 i$ Q: `! D" d' D# m
, f$ a4 ~$ M3 V+ D
|
|