|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ B" y+ E0 i7 \% n O% r8 R, s) O. j- [code]EDMA sample test application8 ?* J1 ?. v% C5 F3 E+ ?0 E. W
- /*
7 ?4 M+ s; C V* F - * edma_test.c
, _ u% O1 p! [" ^. Y - *
& |- q) s2 H7 ?8 ?; {( ]9 W2 g - * brief EDMA3 Test Application
5 ~- s' l. c$ L) U. p - *: p9 E' j! _4 N. r1 o" O
- * This file contains EDMA3 Test code.
7 i- i. ] ?9 A) q" r, F* m - *; F: \& J' k u6 C0 H6 A5 b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 {: `6 t1 z9 h; a$ z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 ^, h% O3 Q0 G; g( R$ _% B) b$ o - * TO CHANGE.4 n' R! s, d( s
- *
0 u- V, T5 J$ C& p9 W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
U1 p/ v, ]2 P$ I6 n# B9 g - *( K1 B1 @& v. @, Y6 ~
- * This program is free software; you can redistribute it and/or4 d1 X4 w: l# [
- * modify it under the terms of the GNU General Public License as
0 l' S1 r3 d# s3 I+ m; O* P7 c - * published by the Free Software Foundation version 2.4 X3 `- ?5 g8 ~% M. y& Z# e
- *
7 M2 K( k$ ~* N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' k* H. w- B; m# @
- * kind, whether express or implied; without even the implied warranty
9 F3 Q w Y! ^7 L/ J% A& v$ G Z6 s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* S7 h+ O+ G5 M0 W% c/ i: \ I - * GNU General Public License for more details.1 V( r3 K3 v t: l4 Z
- */) A0 h5 ]$ ?9 C5 D5 P0 j9 s
7 H/ A9 i S/ X9 W$ g7 _% K9 S- #include <linux/module.h>* j# J* U$ S9 ^1 \4 M6 o
- #include <linux/init.h>; w7 ^6 J. @; G
- #include <linux/errno.h>& Y* V, R1 Q# E$ m1 ~
- #include <linux/types.h>
4 u" R8 S& u, Y2 B5 r - #include <linux/interrupt.h>* ?/ J( P) E8 o. B8 Z. o; [
- #include <asm/io.h>
+ a5 d* I) @" ?1 x9 D$ S - #include <linux/moduleparam.h>9 {4 z3 V6 t7 @( l5 h) r
- #include <linux/sysctl.h>( T) w2 s! ~* m$ Z
- #include <linux/mm.h>
, S0 Z! E7 U1 m& D. B - #include <linux/dma-mapping.h>
1 B( Q- T: `0 J \% L5 A8 A9 e `
4 ?; y* q1 k! S/ B1 C' `0 l- #include <mach/memory.h>& s! L9 s! F& D% I' {# k* @
- #include <mach/hardware.h>0 w. a1 P% K" U: R, X$ ?
- #include <mach/irqs.h>& J, \7 ]1 C5 B% C# V, P6 F8 n
- #include <asm/hardware/edma.h>: [# a! p4 _ b; t" z
* Q. ~# Q$ b1 p7 i3 B- #undef EDMA3_DEBUG
' `3 b8 y' z, N - /*#define EDMA3_DEBUG*/
4 K# w3 B8 Q6 c3 r! r- k- P7 x - 0 z; ]% a5 }5 F( j" B8 O) w
- #ifdef EDMA3_DEBUG
- ]5 S: [9 Q! j' I- ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 |( x+ b: t% E0 C( U8 B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& {5 I& v3 g0 b8 n. a- m2 C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 C) C/ M% e6 g |) i1 @' E9 u
- #else
. u8 C$ s* C+ i - #define DMA_PRINTK( x... )
0 } z# |. r/ P9 ^& G7 _ - #define DMA_FN_IN
9 |* r, T; x* {; C/ G. G - #define DMA_FN_OUT
- G, `- W; Y: w, @0 U# W1 z - #endif/ {6 m+ f. M' v7 j; f
. c7 d0 N, k+ Y3 n* L! x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 v. ?( A# b/ \ K - #define STATIC_SHIFT 33 a" J3 J' c8 Q3 y, B4 w, u
- #define TCINTEN_SHIFT 20; A; G' c9 }1 g! L; |/ g3 `
- #define ITCINTEN_SHIFT 21
! e, M, f" Z5 g - #define TCCHEN_SHIFT 22
4 t! F8 Z+ E6 H2 _0 e H - #define ITCCHEN_SHIFT 23
4 W* r# v# x& N; }' ~* k j0 p - 3 k! ~5 ~) o5 F1 ?7 M
- static volatile int irqraised1 = 0;
1 k9 T$ m+ s* | - static volatile int irqraised2 = 0;
6 H. ~) e& c1 @! c) s - $ Y# ~. x" D) k* |+ L% w; W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 @7 v) u3 `. ~% B: `; H8 U( k2 F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. t# d& k) k/ e- v! @1 @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) ^7 B: y" I4 n4 z
% p0 G8 r* B$ b; b- dma_addr_t dmaphyssrc1 = 0;* E3 L, \( `9 U/ T5 v" j# p! x$ z
- dma_addr_t dmaphyssrc2 = 0;8 y/ q; O: C# \, O
- dma_addr_t dmaphysdest1 = 0;
: m: V6 q: F# ^3 ~; w& [: s - dma_addr_t dmaphysdest2 = 0;2 V7 W( U4 U" w/ U7 k4 E
0 D ~! K7 c3 _6 p- char *dmabufsrc1 = NULL;, [% M% Z" ?( x6 D6 n
- char *dmabufsrc2 = NULL;
1 X4 d$ b. a$ X, _) ^0 _" K0 k - char *dmabufdest1 = NULL;
, u& X, }0 @/ K - char *dmabufdest2 = NULL;( o/ _9 @$ s; [9 r- l2 k, ^, t
( _, E& U( V1 ^# E' t" D$ p& m- static int acnt = 512;$ v, {) v: n: M2 N7 S
- static int bcnt = 8;/ m; e# N( k0 B
- static int ccnt = 8;- ^: o5 S% \( p, P% r2 N* D. n
/ E& h9 K% c/ u3 F6 k9 W( i3 f- C- module_param(acnt, int, S_IRUGO);% \9 I# o& ~! V) l: r) d! R% L: s
- module_param(bcnt, int, S_IRUGO);/ L1 H6 u: |. j! E9 P
- module_param(ccnt, int, S_IRUGO);
复制代码
2 n' \( V( e" P# A. c4 P: }2 }/ L4 D! H4 f- ?5 P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 v8 `2 k" X4 I2 B
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 `0 I* f8 w; `3 a& b1 @( @) m, o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 w- H) t8 W0 n; |" K9 S9 F$ o" L3 q& I8 F9 N
+ L- h6 r9 z+ N0 P) N |
|