|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 Y; j# U3 X; e( Q/ T5 V
- [code]EDMA sample test application+ E, o# ?* @ ~% F
- /*
9 R( @7 c" w/ u3 Y/ Y0 B; i+ G" ] - * edma_test.c
- O8 B) n3 l$ B1 h% j X! a - *
) ^: |% U* ^7 `& x8 ]1 D# x4 a - * brief EDMA3 Test Application* p5 y2 ]* U N' C# Z" y
- *
* a0 c, I: `5 q J - * This file contains EDMA3 Test code.
1 W) U0 z! u! a( c3 G. k - *+ n9 D9 V; U% g) N! W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 }8 z; j- A9 V6 z9 F& i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 g* _2 M+ ], w- ~8 @9 P( P6 b - * TO CHANGE.
! U- f8 ?6 Q# K' h0 k4 |0 S - *
6 x6 V, W) N* e# o4 ]* \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# M% U* m( ~% z - *& S$ P* |2 }' w& F
- * This program is free software; you can redistribute it and/or! v1 ~; ~) T0 o& `+ t3 e- J
- * modify it under the terms of the GNU General Public License as
8 o: u6 c# W$ g$ _" k: E) ? x. v$ E! T9 o - * published by the Free Software Foundation version 2.
) Z4 K6 K8 C. G* | - ** v* o, L6 ~# I' x+ T, ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 w4 a0 Y8 W5 ^1 l+ M P
- * kind, whether express or implied; without even the implied warranty( |! c \: d G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& y" `$ E; u+ l: r* i) I" B* i - * GNU General Public License for more details.
7 ]6 V1 }) H" [ - */7 A, L& h$ [* E6 O
/ c, b7 c2 s1 G* ^% B+ Q/ u' {8 Q i- #include <linux/module.h>$ d9 y. @1 ?( Z1 X+ k$ a& v0 O' I8 J5 T
- #include <linux/init.h>" B/ ]) _2 s: G! g0 S9 B
- #include <linux/errno.h>
! t4 f7 m8 i3 U - #include <linux/types.h>8 y6 i) T5 s$ U6 f. ^8 |$ o
- #include <linux/interrupt.h>9 M9 t2 @8 p" ?: f3 W4 |: I
- #include <asm/io.h>9 B( t+ J1 [6 V2 {) g1 m
- #include <linux/moduleparam.h>+ G# x$ w2 G/ a3 J4 G( L
- #include <linux/sysctl.h>; K! `+ n4 y- @7 _. A- _
- #include <linux/mm.h>
7 O, Y2 d6 E% e5 ?, m - #include <linux/dma-mapping.h>$ I8 f8 F7 M( v* a& V) k% u5 b
- + K# |/ {# `4 @7 F: H) Y+ w
- #include <mach/memory.h>( y! c* y) I5 n' I/ b* s- S
- #include <mach/hardware.h>$ d- E3 Z# G( e' V
- #include <mach/irqs.h>+ M& o1 g# V- j4 |" ~) I+ q6 H
- #include <asm/hardware/edma.h>% O2 g' E: f7 O5 Z) G4 `
6 _3 ? C7 }8 M5 d: k4 g- #undef EDMA3_DEBUG4 m- E! J% H( E# ~7 O B* ?0 |
- /*#define EDMA3_DEBUG*/- o* r3 f: T" {/ Z- b5 Q" R
- ! K$ ?( d4 a# C+ N$ W9 Q) o+ w
- #ifdef EDMA3_DEBUG
, i: n6 l0 q, `5 ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& `2 t% c# R! o% e& g; x0 P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 O5 H* C, i& t* b1 g: d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& \# E/ J$ r- o3 C - #else% Z5 b# B9 ?3 t$ ^5 J
- #define DMA_PRINTK( x... )
+ b/ z$ Y" B; G- R - #define DMA_FN_IN+ i+ g4 S n# ~
- #define DMA_FN_OUT
+ |! @' k: w) x! w - #endif
6 Q/ ]( @: I/ M0 H# [ - ! Z/ \, O7 B6 X4 m7 t' _* W7 s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 N2 m6 N/ H G- o, D" x" m% F/ o
- #define STATIC_SHIFT 3
/ `( |0 R: D2 w0 O - #define TCINTEN_SHIFT 20* t- N3 u6 a9 E$ n+ v7 V0 p0 s
- #define ITCINTEN_SHIFT 215 F0 j/ B: p2 k, {5 I
- #define TCCHEN_SHIFT 22- M* Q7 f/ l1 ~
- #define ITCCHEN_SHIFT 234 P) v8 Y9 ` p L$ B
- : ~2 U! f' u0 f; L/ g& T- ?4 R
- static volatile int irqraised1 = 0;5 }3 f; `) y. q% l+ j* B! R
- static volatile int irqraised2 = 0;% n4 v% {# s' t! y! C# | F% }
# ?& F$ s$ i1 k$ s) d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( W% z" y+ }1 \8 q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( b7 m5 {# z& h& {$ K2 T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) w \7 w, o$ ]
- # r% L# D% [6 y* |
- dma_addr_t dmaphyssrc1 = 0;; O& _- [( z: ?0 d# n
- dma_addr_t dmaphyssrc2 = 0;
* K! |2 V2 E, j! ?5 _ - dma_addr_t dmaphysdest1 = 0;
- P, \# s3 y+ y2 i- w' U - dma_addr_t dmaphysdest2 = 0;
8 k0 v o, V$ ?! \" B! l
5 W$ h' V4 M, a9 ^- char *dmabufsrc1 = NULL;
5 @; [" G& P3 c8 `$ K6 M - char *dmabufsrc2 = NULL;4 V) t) T$ e. f: o) a. i
- char *dmabufdest1 = NULL;
$ Y6 g! Q# ^# ]+ N' L - char *dmabufdest2 = NULL;
5 O4 z. ?2 Q5 ? - 1 G! v" m: q( B0 ?1 H
- static int acnt = 512;
9 _: n: S6 P! k+ j V4 h - static int bcnt = 8;
4 D7 ]4 b, j7 b @0 q+ r K - static int ccnt = 8;
: _& Z4 ]/ t9 j$ f1 K: P% ]2 r' t$ H. _ - ) M: s! Q/ O3 c+ Y5 n* @3 Z) F0 y
- module_param(acnt, int, S_IRUGO);# v: x/ O* f5 W' j8 t# I
- module_param(bcnt, int, S_IRUGO);
8 l& t3 Y/ n8 U8 n# ~% x& S7 S - module_param(ccnt, int, S_IRUGO);
复制代码 * M! U3 o8 P3 {5 y* X; x
9 d. Z$ T% p7 O( Y; \* Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* X0 `8 B5 l( b x& ]3 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* ~, m7 l$ h+ x9 Q0 w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 q% U% L R. }3 p+ n- t
2 I D* ~$ X( k- O- H: p7 i
7 p1 m# ]7 L8 W t) b& i |
|