|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; l* Z5 `& x( H- z5 w
- [code]EDMA sample test application
( m9 _- [1 d& u - /*5 K- ~% M; g+ m% L
- * edma_test.c) X- P& T: r7 ^. p( d( u
- *3 p- d6 m0 [/ d6 H# j" S
- * brief EDMA3 Test Application/ K: a6 v1 U/ i) \5 r
- *
$ V9 q' _* v: m9 o6 j$ ~8 k8 l }$ N - * This file contains EDMA3 Test code.- g( I1 ^% b; T5 o0 O1 S
- *
3 P7 y/ v$ @$ q6 x4 n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% h$ K! l$ U; X& q! s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 ?, W: n: u8 ~ - * TO CHANGE.
+ ^' [( J/ d V: Y - *4 n# c* X% n3 ^0 z0 J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# I. @% h& `% ^5 R$ J
- *% u1 l+ p) N7 ]6 t
- * This program is free software; you can redistribute it and/or; v5 U7 E2 n* Y# B/ Y
- * modify it under the terms of the GNU General Public License as* s% B b# r& H3 |9 e9 V( q7 E
- * published by the Free Software Foundation version 2.
& q p, ~! a& O! V6 {" I - *, \2 l5 Y$ D# [% p3 g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 f$ `& ?& W. k3 _( H - * kind, whether express or implied; without even the implied warranty; ~' n. A6 q4 k$ S5 c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 `$ U+ I, V7 J' p+ E+ ~ - * GNU General Public License for more details./ e( L9 v3 H, k8 ^5 W0 m
- */' x7 f, d/ H/ i
- 0 Y3 i' Q1 j9 Z! C! Y& ~0 m
- #include <linux/module.h>8 X. x% ?" E2 t( \+ R+ E5 s- i8 M
- #include <linux/init.h>
6 D) {( y, q5 G - #include <linux/errno.h>
4 ]$ g2 k8 P0 R4 i. x - #include <linux/types.h>" c5 x8 A1 H7 c* [7 J9 S
- #include <linux/interrupt.h>) S- m! [- H P6 g. g
- #include <asm/io.h>! C! | D: N7 s) q( Y
- #include <linux/moduleparam.h>
% `) X; B; v- v; u! d - #include <linux/sysctl.h>3 c4 U9 X( K! t8 Q" l& @7 X, v4 _
- #include <linux/mm.h>+ K7 y" S+ h3 K/ g
- #include <linux/dma-mapping.h>
9 r" |$ o" }( X1 }
' s. X; |! J" V" u- [- #include <mach/memory.h>; ]6 c! u1 G. y
- #include <mach/hardware.h>
2 D; e$ I# l. c0 z - #include <mach/irqs.h>! ^( j% h9 j; T( n9 E
- #include <asm/hardware/edma.h>& y2 p, o, T) y9 @1 V
- 2 ^' _1 Z) i7 D2 i- r( N5 h$ \+ ]
- #undef EDMA3_DEBUG
/ m9 ~9 X! |5 u: S; t& C - /*#define EDMA3_DEBUG*/
! j i% s3 h' n0 ]& X
* l9 H* r6 Z% _& W5 {- #ifdef EDMA3_DEBUG$ f& A# ?: K- b$ B; h6 i9 r! Y7 F! E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 p- P4 v1 X' Q9 \5 @5 |& b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* \1 X' I8 |% \0 g7 d5 C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* J( o+ L- v' U, z j( h- w# A - #else
# g k& ?# w9 P( W - #define DMA_PRINTK( x... )
$ x& |' j& f% ^& P1 X - #define DMA_FN_IN7 f7 H, c* M! F V2 B3 V' J
- #define DMA_FN_OUT4 F2 E1 [" T2 E( J0 i- ? N
- #endif% ~; g1 g& D5 [. [5 A0 Z
# }$ r0 d4 `' q- g4 C4 l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% N. J8 p R) k$ Z/ d' Y - #define STATIC_SHIFT 3
0 g0 P0 R/ \7 K" D - #define TCINTEN_SHIFT 20$ |0 D8 a8 N- v/ F4 `
- #define ITCINTEN_SHIFT 21$ f' G; g7 G6 y2 ]
- #define TCCHEN_SHIFT 221 E9 s7 l# O* J# H! O
- #define ITCCHEN_SHIFT 23, E0 p+ M4 Y5 w$ M7 S& y; u
) m, `' M* c5 D: U5 @* M4 o- static volatile int irqraised1 = 0;+ ^; G* R$ d: p2 M6 T
- static volatile int irqraised2 = 0;' c; Q# M2 i9 n7 i/ x) [( ]8 x! j
- * {1 o3 ~# |2 x7 k2 \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ t( L$ @/ T% I+ z) j7 ]) s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) P1 O/ q& {( P. ]1 v* V) g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( r- P* C1 t! e! }
! @* s' s7 W, A; G# y( w: }4 M- dma_addr_t dmaphyssrc1 = 0;
/ K) i Z- h1 J+ y' l. u7 F8 @6 D - dma_addr_t dmaphyssrc2 = 0;
5 E& a& ~' w. v, s3 N S - dma_addr_t dmaphysdest1 = 0;
$ ^8 H4 O2 ~& k6 l$ d0 D - dma_addr_t dmaphysdest2 = 0;
/ m& K M9 x5 R0 Q! Y$ X% j - ' K8 }) H, E# N
- char *dmabufsrc1 = NULL;) E3 s6 V2 z! ~" M0 H
- char *dmabufsrc2 = NULL;
+ x- U2 I9 W6 U( r5 H3 j# N) k - char *dmabufdest1 = NULL;# m% {9 W1 B* J' r2 a0 H `
- char *dmabufdest2 = NULL;; J x# f5 l% H O* Q3 ]' Y f9 o* Z2 y# `; {
- . Y+ [" v. c2 I% W3 S
- static int acnt = 512;9 d8 u4 ^# W! J$ d4 S1 e8 E
- static int bcnt = 8;
! e" U5 {% q' z1 U L! J" v - static int ccnt = 8;
0 B, S# P) y, }3 w; h8 v
+ ^- d2 J( m. X" |- module_param(acnt, int, S_IRUGO);
8 X# |2 U( Z; I9 f" A" ?# Z - module_param(bcnt, int, S_IRUGO);
3 _# d: n& r" v2 U. Y. }/ p - module_param(ccnt, int, S_IRUGO);
复制代码
# G5 a: o& b2 |0 s% j+ O; K* o y7 F$ K5 N, J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' q3 _" Y/ d5 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ d2 w8 d$ L O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; R/ A: r, _( \6 T: i
0 Z5 Z1 B" A$ f) w% {# M0 S
5 E; Z/ J* c" M |
|