|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 I f; @1 ~4 D, J) u
- [code]EDMA sample test application
" w6 A' D) U9 S0 V) K! M( N4 h - /*
: M% I4 \4 N& g+ b+ O$ d - * edma_test.c9 i( Y1 c: u0 @+ y7 K5 ]' g
- *
2 M' M p* M& F9 o6 Q, m - * brief EDMA3 Test Application* T+ J$ g9 B6 w6 d% d: R
- *
5 j" v! u+ [- t - * This file contains EDMA3 Test code.
9 ^# ?2 \7 D* a- X: ~ - *. Y) X0 v- U" W9 F w" Q8 _# W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" Y, ?; O+ ~1 w$ G# [! w3 Q- Z* O0 L$ V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 h$ e- y# G2 }* c$ b - * TO CHANGE.! K5 n2 m8 @9 e6 o6 _9 Q7 t5 F5 h
- *
; i$ F/ B% ^( G( D. g7 U$ M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# M2 H/ n5 q8 @! |+ U - *6 V& Q& K" g3 Z9 y1 \6 R
- * This program is free software; you can redistribute it and/or6 e: y9 J$ A" z& N' p6 A. ]
- * modify it under the terms of the GNU General Public License as- t; ~6 B6 T3 [- T7 B
- * published by the Free Software Foundation version 2.
- c. d, ^5 F. s5 ` - *
1 o" y+ k2 W6 o$ A v* N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# }0 S# U% r8 ^) }" t+ B; G# _
- * kind, whether express or implied; without even the implied warranty
# ]2 k7 `5 v$ ?' I: \- B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" I& h P, u' j1 A# I" E1 R$ Y - * GNU General Public License for more details.
6 s/ N- e f) H/ {" q - */+ z- ^& P) i! {! J3 s
- * u2 Y! B+ ?7 p" N
- #include <linux/module.h>* x& C* H8 I& J" A6 l
- #include <linux/init.h>
* |1 p! z- l) {" U# k - #include <linux/errno.h>
. M- j( p2 ~6 ?/ Y* G - #include <linux/types.h>
9 E* F! K" l9 a - #include <linux/interrupt.h>
. G; g1 e+ s- F6 l- H - #include <asm/io.h>
% p# \: t/ a: x: }& O, Q. W7 k - #include <linux/moduleparam.h>
, V( `, {9 p' a: d5 C7 F3 ~ - #include <linux/sysctl.h>- {$ T( p4 n1 ?5 r
- #include <linux/mm.h>& z+ {% D% K, I! K! _3 Q! J4 L
- #include <linux/dma-mapping.h>
, D+ L+ X1 w4 V4 K* n- d! h
8 O: t- b" a5 |. Y/ e2 ]$ k) ~5 p! `. k- #include <mach/memory.h>' Z/ }. i: }6 R6 P% l) D. y- u
- #include <mach/hardware.h>
1 w: _& G; ?# ?+ s9 |6 ^: V - #include <mach/irqs.h>
* u5 C$ ]* U3 g0 Z - #include <asm/hardware/edma.h>( X+ ~' @ a" U% c" p, _
- 4 z, C1 Z8 V" M1 T8 S5 D
- #undef EDMA3_DEBUG5 s7 ~2 R$ e; i/ Y) t G
- /*#define EDMA3_DEBUG*/
- n3 G o3 @( `$ G/ Q
" @/ d5 D K( Y4 p |- #ifdef EDMA3_DEBUG
* b9 {; q7 ]) n8 a5 ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 l. m5 n; v, z% s& U m" M" {6 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
v& f! a0 t% m# A. p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 Y) e! v% k- n0 m9 k
- #else; I- p% Y+ ]5 P5 K/ \' t5 B' j
- #define DMA_PRINTK( x... )
# i/ `9 @3 t- b: ^& v* P - #define DMA_FN_IN
8 c) O3 D0 S4 U6 c6 `: K - #define DMA_FN_OUT
: _& n1 d% u; ]/ `6 ]4 j) e b - #endif1 t: R ]# `0 }* h6 J3 E! D! e+ y: ~
4 u& _, r1 K% p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 O) E' P4 m% ^ - #define STATIC_SHIFT 3" V* O8 P |) a* D6 Q
- #define TCINTEN_SHIFT 20
0 i7 I$ I) `' ]2 g# {2 ~ - #define ITCINTEN_SHIFT 21
) g/ B( c/ G, D9 A' M( k - #define TCCHEN_SHIFT 22% [" d. L, D! Z I0 W" Y
- #define ITCCHEN_SHIFT 23 a8 H7 K+ [; D- c' M
- / `5 g, q/ x$ t9 s/ A) A4 q' q/ k5 z
- static volatile int irqraised1 = 0;
, X2 n* \+ o6 ~3 h9 N# C% M/ i - static volatile int irqraised2 = 0;, l1 E; E, Q1 h. d3 w: T( ]
& z S. m* l, Q( m w9 ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- T: v# I7 F! w1 T8 m |6 @* \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 [% J! B% _4 x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 |: U" [* p8 [
% k8 v) k0 |/ }- dma_addr_t dmaphyssrc1 = 0;
. `6 x" A3 X u - dma_addr_t dmaphyssrc2 = 0;! e2 i0 H* c, a, M3 a
- dma_addr_t dmaphysdest1 = 0;
% v' v4 o+ H7 ? - dma_addr_t dmaphysdest2 = 0;* Z4 q5 e7 \$ Q1 O9 \
- % F4 a6 k/ N2 [# S+ x" T
- char *dmabufsrc1 = NULL;! e4 d6 N! {. A& w; n
- char *dmabufsrc2 = NULL;
6 g5 Q0 Y; s0 N" P e - char *dmabufdest1 = NULL;! h, w# Z& \' g/ g. w7 N
- char *dmabufdest2 = NULL;
0 T1 W% S$ E# J, q- r7 y3 o0 t - - F4 V; b! ?% { A( ^+ t
- static int acnt = 512;
, U5 `/ [ c1 U" m8 N/ c - static int bcnt = 8;& I' K" {& l" x
- static int ccnt = 8;2 X6 z y% Y. K# |
- I+ b* i+ R! x+ z& j e5 J% ]- module_param(acnt, int, S_IRUGO);
( V. m: @; r: H$ m+ X4 h - module_param(bcnt, int, S_IRUGO);) C8 j" ?8 r) p, m7 _+ G
- module_param(ccnt, int, S_IRUGO);
复制代码 $ L3 o5 {; k" a B8 o
& q5 ~- E& U5 m+ J$ V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 N" n, @( @+ L1 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 D. |% F' u! |( k$ q- d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; O& B, d$ ?5 `3 a" z
. O3 b( G* D& ]1 b$ B7 u! [' }0 |- ]. }" h6 m/ s) D2 [2 d. Q/ Z
|
|