|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 K% {& o' T& N
- [code]EDMA sample test application
+ e: s3 _6 c6 V U' j, G - /*) ~1 Z/ e) D% i ?+ s, ^
- * edma_test.c
1 V. O0 K: Z+ A; k- l - *: z& ?2 r |2 D: V' f& o8 j* D
- * brief EDMA3 Test Application6 ~: y1 I1 {1 v$ A% E/ `
- *
& k$ L9 F0 @; h - * This file contains EDMA3 Test code.
) L: C' Q2 r6 r+ X$ F) h - *5 ^/ b8 @! O3 X. L% L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* j$ H7 H+ S7 J- d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: V9 B+ m' ^, n+ Y - * TO CHANGE.7 D7 p5 V9 }" z( V
- *
! W5 w" S6 l$ y/ G6 B" k5 T6 \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ Q* G9 P5 Y1 y- ]# n/ {! p1 A+ d
- *
q1 \0 Y8 V& u8 s+ I, G- H - * This program is free software; you can redistribute it and/or
* J; A- E G* P$ w - * modify it under the terms of the GNU General Public License as; w, ]1 E0 m7 g$ \9 y
- * published by the Free Software Foundation version 2.$ s/ G: c0 H$ G" k+ h; k! r
- *8 v/ k+ b4 i. [' s) O# L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 ]1 s& q: ~. r# w7 h - * kind, whether express or implied; without even the implied warranty. x) d) J/ \1 G8 D4 c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 ?( a) R1 o G; H
- * GNU General Public License for more details.
0 d g; h1 X9 r* r4 P/ d& } - */
! v! l+ D) H3 G9 b' _; b" x. s - ' c; p2 V# ~$ i& m
- #include <linux/module.h>
7 w; _. V; I' ~" a - #include <linux/init.h>$ ?7 H2 ?+ f; {% v2 U
- #include <linux/errno.h>
" d, N. Y: c8 {1 }0 b+ |. l - #include <linux/types.h>
9 ?7 R, \+ b: m; d) h) y - #include <linux/interrupt.h>9 K) Z! ^; n# ^$ @& a1 W
- #include <asm/io.h>
9 S9 x$ Z# i1 h: x8 D+ M5 J - #include <linux/moduleparam.h>
9 r4 N0 H* ~1 t1 m0 h1 N O; x - #include <linux/sysctl.h>! I$ {, H" r# N. R
- #include <linux/mm.h>
2 M. U' r" |) z2 {' E - #include <linux/dma-mapping.h>
6 \) Y$ c& G" S" A
. r) z, t# o% _- #include <mach/memory.h>
9 q1 L+ v. Q6 x, A* p7 \% l" U - #include <mach/hardware.h>1 _) r$ n2 F7 G+ W$ \
- #include <mach/irqs.h>
8 Z: `7 f0 b6 m9 p0 g, Z - #include <asm/hardware/edma.h>
8 C: |$ `( J$ x1 X% u, R5 Z1 h - : [3 G4 H2 Z! b1 d6 M
- #undef EDMA3_DEBUG( G4 f, |# i& w( i3 v f- m
- /*#define EDMA3_DEBUG*/
6 r: [- j$ k* w% ^# @, J- E' o
3 P6 m7 h, w5 ^! r+ D7 f# \, ^- #ifdef EDMA3_DEBUG
: n2 l" i' j- T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" b6 W) v9 C9 M, M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 N- ~9 f& X+ J' Y! n, u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# s+ h' v% e# p0 m$ M - #else( J- V i- J. C( `' b+ B/ P2 W7 u9 G) Z
- #define DMA_PRINTK( x... )4 w6 R$ @! Y% ~( M- A7 C
- #define DMA_FN_IN
* Y( R+ Z7 A* i - #define DMA_FN_OUT% g* Q2 l' `$ n, M
- #endif$ p. P$ K: X& W! \
8 u @% j4 W4 D4 M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 C& H4 a5 s. E* y - #define STATIC_SHIFT 3, x& J9 f& N& w$ ^
- #define TCINTEN_SHIFT 20, K, v: W3 c7 T& J( y& N' S
- #define ITCINTEN_SHIFT 21
- }# t: P# e0 l% u! M0 Q - #define TCCHEN_SHIFT 224 x' s+ T+ x* L
- #define ITCCHEN_SHIFT 23
4 {2 v) U7 e9 L6 C8 d$ r, l2 a - 6 G& u& e) J6 G8 e5 K
- static volatile int irqraised1 = 0;& e: z3 Z5 T/ m e9 ^) w
- static volatile int irqraised2 = 0;
$ f# k4 }7 K4 D) V - $ } Z1 K, C% M/ L; i: m+ g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# N8 a _$ J" j X. T+ A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ j5 z4 e9 X. m' C6 n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 L4 z5 f5 ^9 C( u; g8 g& j$ q - / c. }4 T) v- E; }) y. O. I; r
- dma_addr_t dmaphyssrc1 = 0;
9 I4 b. i( S- {% n - dma_addr_t dmaphyssrc2 = 0;8 Y: o5 y: O% R% _
- dma_addr_t dmaphysdest1 = 0;
3 v' i+ o" t$ @ - dma_addr_t dmaphysdest2 = 0;1 K: C1 ~1 c Y& E, v9 m
- 3 J9 q& v4 L G* B( N# ?
- char *dmabufsrc1 = NULL;0 I% X S l- v/ N
- char *dmabufsrc2 = NULL;
$ Q" C3 Q7 ]/ e - char *dmabufdest1 = NULL;0 w8 C7 X6 E" R% a$ e
- char *dmabufdest2 = NULL;
6 e5 H0 c" ]' b" A- ?3 U - ; T, t, j: e" i5 n
- static int acnt = 512;
+ a6 m a9 E: z+ H4 p6 a/ d1 `) o) ~ - static int bcnt = 8;
6 y4 k% _7 f! b' q7 R+ k - static int ccnt = 8;
8 k4 V! U& X9 Z; R, I" t
* Q( c3 E8 G# v" I N# v- `, u- module_param(acnt, int, S_IRUGO);
5 T+ E" j: N* f2 O - module_param(bcnt, int, S_IRUGO);
+ n3 T* f6 A3 C \ - module_param(ccnt, int, S_IRUGO);
复制代码
; b0 C' Q. B# c! v0 O3 B
4 i* B. g1 `* _+ i! n2 s4 w% e2 K7 p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" T" t4 N' Q0 E& ~; E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 K3 V% U# O, i( i/ W7 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 x: \; k- }9 {2 @
) b, e& L1 r ^7 Z5 M- k; t; q* D6 p" P) d5 a7 t) B, \
|
|