|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ }# @; T3 }3 E' m) a& J) L$ v- [code]EDMA sample test application
2 e/ D- g: k- c) i0 E% P* t+ ~) o+ F/ | - /*
* T, l/ J) V& o* Z$ S- e - * edma_test.c& X; d% g9 o, a+ I! p
- *
* a8 ^1 ~* j" l; n8 w: i - * brief EDMA3 Test Application# O; P, m) F; t$ O6 u O
- *$ M. y% z/ l# G
- * This file contains EDMA3 Test code.2 `8 h9 f; u8 G# z& Q
- *
0 n. ~, i% z( z( C5 N* \2 n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% L. i$ H6 a$ _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# M9 u0 c+ G% _- }1 ? - * TO CHANGE.
. r5 N( A# H3 R1 P7 R% _0 ? - *
( ?( `" H- J" c) G( b& e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 k# X2 H1 Z3 j' f: U
- *
0 C9 X" N4 K, W: A: C- V) e5 ` - * This program is free software; you can redistribute it and/or
, z4 D' N x9 B# E, p# P - * modify it under the terms of the GNU General Public License as
3 A% _2 u) Z% X7 L - * published by the Free Software Foundation version 2.
. ^ i4 e" i# q" @2 w! U' p - *2 o! Q/ a" k$ W+ x3 v3 X* c4 X' s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ t+ N/ y( L8 R' _7 V5 K
- * kind, whether express or implied; without even the implied warranty
' S8 E B9 k# i7 C5 m5 F6 ]* @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) x8 M+ l+ N9 z2 S - * GNU General Public License for more details.
0 b# O% G. I; G - */) X+ \& C" @( W4 Q
- ( x/ Q l- t% d# b8 @/ S, d' W5 g& a: x
- #include <linux/module.h># \! x$ s0 C' d# [7 a; a
- #include <linux/init.h>
6 `; `7 J2 c( j- P - #include <linux/errno.h>
8 g4 i; a: V2 |, n) c - #include <linux/types.h>
9 ]) z$ }" _9 g: @ - #include <linux/interrupt.h> d( M4 p, \0 e
- #include <asm/io.h>
5 l) r8 V6 M; p+ P2 G - #include <linux/moduleparam.h>
5 Q2 Q- F% O8 K - #include <linux/sysctl.h>( M* ^$ i9 R. J0 F2 f
- #include <linux/mm.h>
4 r8 |" H) ?) p% g. } - #include <linux/dma-mapping.h>
2 W( F3 o6 Z) U2 q - / Q' O2 x2 ^: s2 x& v
- #include <mach/memory.h>
$ Z+ S2 l* A7 S+ @2 D$ X - #include <mach/hardware.h>
& E' X2 H d. X' A! | - #include <mach/irqs.h>( S$ O7 U5 d" Z: |# k
- #include <asm/hardware/edma.h>$ N. l8 w+ v8 O0 b- j, X
- & Z! q1 d' P8 f1 O
- #undef EDMA3_DEBUG
9 b4 z* B4 H% S( }2 c4 [ - /*#define EDMA3_DEBUG*/3 o! V- |! K3 I5 k4 {
- k+ E$ R H$ v- v, f, o3 v X: w J+ |- #ifdef EDMA3_DEBUG$ E% Y' z: d9 z, r( b$ d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! ~9 m ^+ V" i' N# x9 U4 {( s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# B2 l7 A) o2 W8 h+ a. q6 _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 l! l8 n7 V/ r7 S% @4 {' K: c - #else, I, o, [8 O. }/ j2 J4 v
- #define DMA_PRINTK( x... )% r# p- X2 |# q# ?- i+ r
- #define DMA_FN_IN
5 n4 k- W3 y0 L6 @' Q3 Q - #define DMA_FN_OUT" c8 n# E0 Q. ?: T, R
- #endif: C* o' b& P! Q
- 4 `; e8 ^4 j6 ]0 o$ ]" K8 u0 t% C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' I* K. H2 P0 [+ D! f7 S
- #define STATIC_SHIFT 3
# t) |+ f7 T$ `- i1 _( N - #define TCINTEN_SHIFT 209 h8 K( v, X' E& y1 m8 B; E, L8 i1 e
- #define ITCINTEN_SHIFT 21
6 {$ m1 J1 j: U, [) A* ^1 H - #define TCCHEN_SHIFT 22
h: r+ j$ {' P - #define ITCCHEN_SHIFT 23
5 \% ~3 U$ e) _
% d" `- K- x# i) X6 ^1 }/ D u* [- static volatile int irqraised1 = 0;
( q( E* l6 F: E U- E - static volatile int irqraised2 = 0;
- O1 O0 C r9 O' H5 t - - \* I" j" H! K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 a l @+ [8 D8 w$ d9 Z! [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ W+ A4 T# x1 F+ i- D% S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ^+ J2 J9 n3 z' r {
- . p3 q) }! _1 H+ s( U
- dma_addr_t dmaphyssrc1 = 0;
C6 `( C0 N' k- y7 o$ {2 L. D4 ] - dma_addr_t dmaphyssrc2 = 0;
2 B1 X+ {/ e) a& f: @ - dma_addr_t dmaphysdest1 = 0;& J' \. I4 y# h
- dma_addr_t dmaphysdest2 = 0;5 }7 t# [0 F. ]
- $ P: {' ^. }6 t: [% U- u
- char *dmabufsrc1 = NULL; ]) p9 Q8 ^ `* H, {/ @: n
- char *dmabufsrc2 = NULL;
, t( r. `. e! r4 c% ^8 o) K - char *dmabufdest1 = NULL;: o2 o0 b b1 l( D1 {1 Q
- char *dmabufdest2 = NULL;" T2 k, P4 F; n- t" N
# K9 a" v9 u6 g% x4 k. i- static int acnt = 512;; }/ `* x& [0 f l
- static int bcnt = 8;
9 ^& H' [& k; Y2 E: Y - static int ccnt = 8;7 G- _2 J6 M/ H8 k& z; A4 n
- $ w: Y* J- Z" x" l( W& c
- module_param(acnt, int, S_IRUGO);
+ q8 x- u+ V# ?/ ] - module_param(bcnt, int, S_IRUGO);
3 R* I& L/ P+ f C( b% Q - module_param(ccnt, int, S_IRUGO);
复制代码
1 m* v! h* G, A, Z! a9 s6 b
5 M+ r4 q) ?' g& v0 C* T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 D3 i2 D" U' D2 M; D3 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 z" q2 r0 w3 F2 e, Q: m: \: C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 a* A1 l( B- G T# S
6 @/ H( M) x6 X
& z$ z+ |) v3 ` R: X |
|