|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & c3 W" M: V6 I" o( p
- [code]EDMA sample test application3 h* P S$ K" L' B0 \; F0 |. d
- /*4 h: x, L$ H! y Z& b( ^. B* {
- * edma_test.c
' _7 V1 w4 S5 Y0 i7 O* u - *
5 ~2 @, B) A" n7 [ - * brief EDMA3 Test Application
9 y. z& [% h3 b9 W( c - *) V% n" x I. s* a
- * This file contains EDMA3 Test code.
1 C1 d+ m; f) @( C - *
9 z O. ]/ C2 L7 X: r3 P1 e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& i( y/ h t/ \0 C1 K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 L$ Q. b) L6 t& L Y2 E
- * TO CHANGE.* t& \; N* R$ U4 e; ]
- *$ k- n5 R2 j* X- O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 @, n+ C2 {" b3 m5 T
- *, X4 j) Q5 U O6 U3 P* e
- * This program is free software; you can redistribute it and/or
2 m; K# l) |" O; D* ?5 `" b - * modify it under the terms of the GNU General Public License as2 e( H7 F. W- z* Q! \0 k6 u
- * published by the Free Software Foundation version 2.
% B. l* u9 {; _4 E1 @1 V2 ~9 Z - *9 q3 Q6 m! k! a/ I4 S( g, o( Q+ s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" e' W2 F, U1 }9 w - * kind, whether express or implied; without even the implied warranty) \, {2 F: b5 C f0 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( `+ l) x/ l, e( N: d/ q - * GNU General Public License for more details.
3 y4 R/ x7 I! E! Z0 N0 F3 o - */
0 R* z5 `# g& v# Z; H0 e9 f - ; S) m) k3 A n" t! n* w1 w' {
- #include <linux/module.h>( T7 e, Z5 f, V
- #include <linux/init.h>
5 R2 n1 c/ u7 I - #include <linux/errno.h>5 r" w) c3 q3 \2 U/ f, D
- #include <linux/types.h>
$ S# s) {$ I- y# c9 A$ e5 r - #include <linux/interrupt.h>/ F* D0 e: ]3 Z1 x/ ]0 L
- #include <asm/io.h>
0 d2 h9 O L& o) l X - #include <linux/moduleparam.h>
1 W7 E+ L- C/ s" R% R' F - #include <linux/sysctl.h>
3 W/ t6 H9 }9 Z - #include <linux/mm.h>
. K9 s& ~* E- u' ~ - #include <linux/dma-mapping.h>0 o, h) d, h% ^+ V1 Z: C% J
- : n3 H" b( ]6 Q& w' D0 N
- #include <mach/memory.h>8 v P* l& r1 W& [' e- H, ]# H6 J
- #include <mach/hardware.h>1 F- I# h# S1 Y6 J
- #include <mach/irqs.h>9 j: U/ X! N5 g; @4 c; O$ e. G
- #include <asm/hardware/edma.h>
( j3 O F: m# W9 k9 Y
3 R5 l/ _; Z, ?$ |5 O- #undef EDMA3_DEBUG
) ^6 ?3 U( F9 j - /*#define EDMA3_DEBUG*/
9 ~7 @: c$ Q+ D5 F0 u0 ? - ( u0 O7 S7 i9 c8 t+ o! h, G
- #ifdef EDMA3_DEBUG( K& I0 h0 }3 L( T* {, f/ s5 p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( v! t# s2 K, S8 Q. E& ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; t. K) e* H) J8 p t+ O3 | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ G/ z' h5 v$ r+ c - #else* h2 {/ Q4 Q- C* A- o; C5 K9 Q
- #define DMA_PRINTK( x... )% x% O1 |! C5 A; H
- #define DMA_FN_IN
2 i$ \2 I4 v7 O5 S& X" T3 ? - #define DMA_FN_OUT( Q% B$ K+ q7 a Z7 h
- #endif
, P9 L- S1 X' \9 B, m( o
" P# H$ j' N+ z, F& X7 @: t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* b6 b+ y, X5 n% {$ s+ n t - #define STATIC_SHIFT 3
& l, X# G- F: G2 y& V- c3 T$ W - #define TCINTEN_SHIFT 20
3 h* X' u5 P S - #define ITCINTEN_SHIFT 21+ m- M4 _& H( w
- #define TCCHEN_SHIFT 22* b. ?; J, c4 |5 R7 E/ W
- #define ITCCHEN_SHIFT 23; _" K% R0 b: C
+ k0 f8 I9 R5 {4 i/ z- static volatile int irqraised1 = 0;4 [2 s( E. C' x, N$ j6 C
- static volatile int irqraised2 = 0;
0 U( p9 g: d+ _& @1 t - ( J. X4 W8 N% e% u; _! p* A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 `/ A# A5 ]; M. b- R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" n% f, P: e: N6 ]$ K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ j9 x& P7 `8 X# b: V+ m - * I% y6 f# [* Y* k
- dma_addr_t dmaphyssrc1 = 0;' B/ B/ l) D7 V
- dma_addr_t dmaphyssrc2 = 0;
% b# G# O+ e4 N2 V! ^+ l4 d4 D - dma_addr_t dmaphysdest1 = 0;
! A8 j# l+ N8 | - dma_addr_t dmaphysdest2 = 0;: g' J: L: K) U) P3 J
, Q1 G/ l' K5 ?/ C0 X5 v0 v& [- char *dmabufsrc1 = NULL;
5 M9 f( k9 U2 ^% H6 m* Z - char *dmabufsrc2 = NULL;
# Y. v! v/ ?' r' `! C - char *dmabufdest1 = NULL;; N+ Z. r$ o* {/ E7 u8 Q- K' M
- char *dmabufdest2 = NULL;* Y8 O7 Q' j0 a# y- s2 L8 ]7 V$ G
/ H: S% A) A: q' Q( w- static int acnt = 512;
! {& U3 o; Y$ h4 k - static int bcnt = 8;
) }5 ?. g2 T1 _% Z - static int ccnt = 8;
, ^( C, j) l) o
/ d% z5 \3 T' y- J5 ?$ F- module_param(acnt, int, S_IRUGO);7 g+ D, S) x# g
- module_param(bcnt, int, S_IRUGO);4 |" `6 S! C3 g8 i( h
- module_param(ccnt, int, S_IRUGO);
复制代码
$ {1 P4 W9 h$ F4 X
. D5 Z0 S8 {% S5 N6 p; y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* ]% A U& c( A3 u6 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 z1 g3 g. B7 b4 i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* I) E1 l& Z7 F8 Q# o
8 Y3 ^9 J u0 X9 H
* J) z6 Q/ p9 h- n: R% E |
|