|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 N$ R$ F9 U' R* U' U8 e- [code]EDMA sample test application4 h. b0 H3 a! J0 P& f
- /*" c, m, I6 E, }- n
- * edma_test.c3 r5 h; y- |9 D3 K% w
- *
% P& f8 Y s- A3 E6 R5 s' b9 a' c - * brief EDMA3 Test Application. A1 t# c8 }8 W" ^3 T/ \
- */ \% N& e" R& G/ k' Q1 h/ l4 L
- * This file contains EDMA3 Test code.
k v5 Q3 o, y8 i - *
, Q! n& q% Y5 s: [* A4 I# }% C& C3 | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 j1 f/ l, F/ Z/ P+ Q- l6 R/ `& g8 N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 }/ O& i1 k" U* z4 M" ]# h' \5 x! H - * TO CHANGE.! V% I U+ z9 ~5 D# a, _0 o" A
- *5 f# x1 s& W: x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ `( g/ ~" p; l7 H. p, c
- *
# Q8 E4 y& n2 ~4 \. |* s6 | - * This program is free software; you can redistribute it and/or
# H+ c- C- H$ n% T% b* f - * modify it under the terms of the GNU General Public License as: U4 U) V) T4 [( T$ _6 z0 i
- * published by the Free Software Foundation version 2.: B! K) k6 O5 [ M
- *+ N5 `& I6 }( l! v& S( N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" } ~, X$ @' w* E) w! J( i
- * kind, whether express or implied; without even the implied warranty
: O) N& [6 e- F+ x | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- `: r* W) r* z - * GNU General Public License for more details.
! s, @3 `$ f' M0 j - */
' k5 s+ v4 n& V; P: G/ ]4 k
D- U! J3 m# j2 |$ d5 W3 R- K- #include <linux/module.h>
" \5 |3 R# S; c0 l9 K - #include <linux/init.h>
0 }3 w V6 Q! i) X- f- F - #include <linux/errno.h>
' ] _4 b8 F) z5 S - #include <linux/types.h>6 n7 F8 ]. [8 _- Z1 \
- #include <linux/interrupt.h>
/ O* E: A, v+ K% l d. n# j' F# W - #include <asm/io.h>. y8 E$ z3 Q9 Y9 [
- #include <linux/moduleparam.h>
$ I* J% B- o5 u4 {$ f; j - #include <linux/sysctl.h>
$ O9 [4 W* Q+ \( e) Z) m# q - #include <linux/mm.h>
/ i9 B3 `1 ?. [ - #include <linux/dma-mapping.h>, ~: ^9 K8 [$ P' f& s. w
; H, V$ q7 Q6 d- #include <mach/memory.h>7 |' T* c1 [/ Y1 m E
- #include <mach/hardware.h>
% Y U3 {6 u6 W1 d2 H$ Q - #include <mach/irqs.h>' t+ t$ [' }6 K' ]# A* l
- #include <asm/hardware/edma.h>! \& G1 T, X; L* k) G
- z1 Q; b6 n5 j9 P: T0 R' ?+ N
- #undef EDMA3_DEBUG$ @) c/ n; M1 M& p* ?8 y
- /*#define EDMA3_DEBUG*/" l. u% I4 c! `7 ~: S
- " s& r/ F, t9 n$ c4 P2 p# Y
- #ifdef EDMA3_DEBUG/ W/ A9 p T8 _3 Y- _2 Z' ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 M: z0 ]. F$ b+ E3 p& a% M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' D( |9 V x: ~* K0 H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 v" r- w1 z5 c
- #else
4 N! p) N m1 [: B% ?6 r; N3 z7 U - #define DMA_PRINTK( x... )0 _3 o4 c& x/ m1 D1 u
- #define DMA_FN_IN
/ {3 u- p" U% T0 u - #define DMA_FN_OUT
+ J5 A2 q, K* T |7 `! d0 Q - #endif% A8 Z. N( F5 }7 ?! J
1 |) f+ _. a) ^, w8 |8 |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" ?$ W: h; O3 k' H2 E4 t! b, u - #define STATIC_SHIFT 3
# n6 k+ K* `, K1 p5 ? - #define TCINTEN_SHIFT 200 ~! L+ Z/ v' w
- #define ITCINTEN_SHIFT 218 x8 S% K) G2 \" L6 }6 h
- #define TCCHEN_SHIFT 226 j# U0 p$ p( X
- #define ITCCHEN_SHIFT 23
% n' ^1 m( ^* w$ W( t5 O
+ B& U* K. ?8 ]6 I: L: i! j- q" P' S- static volatile int irqraised1 = 0;
' _) l" j6 r; I$ j/ f+ c4 `/ T - static volatile int irqraised2 = 0;) R4 w& i7 _1 d
- 1 i' o& a1 u1 o7 t( j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 F) \* I. j6 z1 I+ ?; u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: M: n7 O7 c9 j# Y9 z0 N% m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; V6 |2 }; v( E8 a8 Z! u9 ?7 q
& n. v/ F6 n/ A& j7 N- dma_addr_t dmaphyssrc1 = 0;
0 D. I; W2 x' x0 s - dma_addr_t dmaphyssrc2 = 0;
; @) r W A, w; C# Z- C* @ - dma_addr_t dmaphysdest1 = 0; ]9 J5 X) F3 o3 v7 y, G# D. J
- dma_addr_t dmaphysdest2 = 0;
3 \3 c" W2 E4 o/ [. D- v - 7 e! T+ O" M+ m" E9 ]7 B1 @, }
- char *dmabufsrc1 = NULL;- s. ]$ K; S% g, s' R( F$ O
- char *dmabufsrc2 = NULL;
! k# u. m; l! _' E( ? - char *dmabufdest1 = NULL;1 E$ e- C0 l6 p( b" b
- char *dmabufdest2 = NULL;' _/ h7 @# N6 x( X m- A5 M2 Z
- 2 {! o7 y- ^- a5 \! o- g
- static int acnt = 512;
& H0 h% y$ w. A7 D0 K - static int bcnt = 8;- `+ S0 u0 e% l7 P: V8 }5 f
- static int ccnt = 8;
; V- H6 X4 K, w" y/ J1 e, ` - ; I+ I/ j) v/ n9 i7 ]
- module_param(acnt, int, S_IRUGO); v' E) i1 t! d/ |% s
- module_param(bcnt, int, S_IRUGO);) L/ `( c" U# K2 M# [9 R X
- module_param(ccnt, int, S_IRUGO);
复制代码
: w" D, W. [' a" R- l4 e, K4 b# l% g, S! a6 @6 F* ?8 Q0 h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 G6 ~3 K+ d& I) l, K( @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ Z5 g6 T2 E! {- |# ~' L. _2 P* w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 I0 i* U# t8 m" k9 P% Y
p" {6 m1 t- f/ e- ], n7 y- q9 b2 V8 ~& q( D
|
|