|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 U9 w" M+ F! q+ V- a3 z# z- [code]EDMA sample test application
w( K- |" ~; e- \ - /* ?# c& E+ c4 e% ~; \
- * edma_test.c
; t9 S; Z+ t. f0 D1 n; Q6 } - *( z1 Z; I( H g; H' V) h
- * brief EDMA3 Test Application2 i% m( \: e2 `* o% D
- *
9 z+ l$ r0 j1 P+ w - * This file contains EDMA3 Test code.
& x% e+ U/ Q$ V/ U$ p) Z - *
* R* ^. ?' Z X' Q, f8 c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, H* m/ l! o0 I+ F% |+ M+ g3 u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) W( n5 Q; g3 T3 \# Z
- * TO CHANGE., P+ X. d4 d+ }3 B
- *! x' ~8 Q j, a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% h4 g' O" \* f% L5 u/ | - *7 D# l$ _0 I$ L
- * This program is free software; you can redistribute it and/or
! W% I) i2 y, F w; Y9 l9 ? - * modify it under the terms of the GNU General Public License as
$ u9 s7 n1 t1 L) J7 t - * published by the Free Software Foundation version 2.
) [! s" V$ [ }* s - *" D% y7 A4 M. O0 X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) I$ C* j( L) m8 j - * kind, whether express or implied; without even the implied warranty1 U6 p5 u! ~; r' t7 i% ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" n! i3 {7 n: ~6 e' P- x
- * GNU General Public License for more details.$ u7 b/ y) ~; S: K
- */ O4 q L" J& v/ X3 @
- 0 G1 P: S: z4 a- |
- #include <linux/module.h>/ c1 m2 |3 D3 B0 y
- #include <linux/init.h>
7 a2 R& O1 R* O2 b. N - #include <linux/errno.h>% o. h8 A$ X8 m
- #include <linux/types.h>
! P) e8 j2 x' `8 J - #include <linux/interrupt.h>6 e* }6 G( a; b+ Q
- #include <asm/io.h>% D0 L2 M# a. Y
- #include <linux/moduleparam.h>1 V, U( Z: g5 [% u/ c9 x
- #include <linux/sysctl.h>
0 X. T# f" Y& M6 U - #include <linux/mm.h>
) V9 G+ r* u5 ^% G* t/ } - #include <linux/dma-mapping.h>- @8 Y5 u6 _# y2 W/ q# C1 z7 }. Y9 b
- 6 \: k% @" p3 y( ^% [
- #include <mach/memory.h>
- G! g8 e$ a% q0 a& ]5 P+ a. s - #include <mach/hardware.h>
, n1 @: ^' u6 E( y - #include <mach/irqs.h>" w) J5 V; B9 S+ `
- #include <asm/hardware/edma.h>
3 A5 p+ S4 o) Z# M' \) k
, u- [! L% b: t% Z- #undef EDMA3_DEBUG/ z3 o& {$ [# S K/ {0 N" @
- /*#define EDMA3_DEBUG*/
% \9 W6 k! g2 c# p' w
% k; I! k7 c, ]3 p: b- #ifdef EDMA3_DEBUG+ V0 w4 t+ X% s+ t+ F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" a! ~1 |" Y3 Q2 G5 Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* L. e9 A* t% q6 D: R B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): N9 C, {8 ^* @& E+ o% q- t. N
- #else- M$ L! ~3 Z- o% ]( s
- #define DMA_PRINTK( x... )
: m& }5 I& U) y" w: R* R0 B% X0 M - #define DMA_FN_IN
. i% Y" |+ _/ z3 c/ t - #define DMA_FN_OUT3 B& y$ L# T' W# m. d3 J7 D1 I- L
- #endif
& C# c4 Y! `6 s' {* \1 N9 Z# f' O2 d - , H+ ?$ y2 {1 `0 u3 Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' l( U6 Z M7 S. ?5 ]6 F8 G0 K - #define STATIC_SHIFT 3
; q; U& E/ [7 ~' ]; z8 R - #define TCINTEN_SHIFT 20
- O! n9 X/ \! k - #define ITCINTEN_SHIFT 21
* m. |& c$ @% B. O0 f0 Y - #define TCCHEN_SHIFT 220 f& W. T' i( z6 v) P
- #define ITCCHEN_SHIFT 23
% }: V1 ^1 I: R - 2 F2 r' x' H, I
- static volatile int irqraised1 = 0;# _# ]- k, V# E0 f0 F5 E& y$ h1 Z
- static volatile int irqraised2 = 0;6 X: `- o4 \1 |( b* d. g
- $ J3 Z. L" \: W4 U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 k0 v0 A3 c& N# j2 E0 W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* n/ S6 C5 J' p3 H+ _5 v( p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' y9 ]$ @0 `' B+ S8 @: s
2 A4 S, Q/ H) n9 T# P$ G- dma_addr_t dmaphyssrc1 = 0;* k& c0 A. x6 j
- dma_addr_t dmaphyssrc2 = 0;9 f! s8 \- o- v& p$ x) i3 A7 {
- dma_addr_t dmaphysdest1 = 0;2 T% i; b+ x$ v' z- b
- dma_addr_t dmaphysdest2 = 0;7 E' j7 o. @0 h4 k4 K$ J1 `9 @- T
0 l( y5 b+ S, E; y1 P* _5 k- n- char *dmabufsrc1 = NULL;' f9 S: R* f, d4 u X+ U3 B
- char *dmabufsrc2 = NULL;
& h" ]* U. M" W F. y$ T, \6 l - char *dmabufdest1 = NULL;
6 e3 p2 j9 U( D$ R# v/ \ - char *dmabufdest2 = NULL;% W9 d4 x6 Z& I# I. k9 V: \
- 0 Q$ K$ `) x+ X# L
- static int acnt = 512;
) l1 w0 Y3 L# I- g/ |0 m4 n - static int bcnt = 8;
: j$ e; L: U. N& D$ j- u - static int ccnt = 8;
4 k( r5 G0 k2 P - h" f* ~5 n+ H+ m
- module_param(acnt, int, S_IRUGO);
, m/ @1 w& _6 D- V2 m# A - module_param(bcnt, int, S_IRUGO);
" k4 {% B* S7 R1 Q% {6 {- B8 u - module_param(ccnt, int, S_IRUGO);
复制代码
9 g: _& n* n0 T) m1 J/ E) _
& ~2 {+ v5 k0 X$ a2 b b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 V! E" O0 p. _: @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- B2 {. c1 o, C: A& t; z* k7 C/ E4 }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; g1 O7 Y2 C3 ~4 _
& C2 L0 s' m H
1 x5 E+ C1 A9 v! ]+ Z |
|