|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. u- W7 f `' n- [code]EDMA sample test application% z! {2 V& C) N, ?* c3 }
- /*
( s% \, e" w1 Q( M- z( N - * edma_test.c
3 h: } E5 J, P2 V. K {' f - *# p2 ^( a0 U# r
- * brief EDMA3 Test Application
- l! t( Q A& n- T6 Q - *# b& L" t# T; t; j% L' x. _3 T" I' U" a
- * This file contains EDMA3 Test code. n. s1 \9 t* X4 A8 ?0 [
- *
' F4 U: w( u, m3 f; @ I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( M" n( V4 }/ Q7 [0 w0 q- s/ B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& Q& X' ~6 s# [; F
- * TO CHANGE.+ x. K9 p O" d7 e; C: X
- *
/ B) \; O9 o4 M5 Y X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 g. n, V- x2 C/ f& Y z- ] - *
9 [! H# S' z4 ^$ m! I$ A - * This program is free software; you can redistribute it and/or3 t- N0 B# o3 f* E1 r' n# w, C. ^1 r
- * modify it under the terms of the GNU General Public License as! n2 E& b& ^1 m# V
- * published by the Free Software Foundation version 2.+ S# u; R5 O; H9 I: K4 j# `
- */ X3 X$ r. U, a6 C/ Z+ z& w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ ?, p" N0 {; X0 e/ l$ v - * kind, whether express or implied; without even the implied warranty' e- \; K9 H& o7 R. q$ f% r8 j/ ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# X2 C2 N! ]" \" F7 {
- * GNU General Public License for more details.
# L8 F: ~" C. @' f/ ^/ e$ K - */
! \; W0 \: Y x$ j- H1 k' t7 l2 i
% D9 C( y* z7 o! e, b5 j; ]/ Y- #include <linux/module.h>; B+ z8 a X9 p/ V# Y
- #include <linux/init.h>1 r4 n0 O- j$ p8 v
- #include <linux/errno.h>! C2 w2 U2 M) u
- #include <linux/types.h>
9 X% k; m: c9 k6 W7 a( ^ - #include <linux/interrupt.h>
o# l- P) y5 _; y4 i- {) U - #include <asm/io.h>4 a* X! ]6 _) H8 |8 i6 f
- #include <linux/moduleparam.h>
$ @7 ]1 O* Y4 k - #include <linux/sysctl.h>
( Y* B9 X D& Q( d2 h - #include <linux/mm.h>/ z7 Z6 Q- [; [4 a/ f' z% N l
- #include <linux/dma-mapping.h>) i; K' Z7 {. {6 L$ Q9 u
- 0 y' H8 H! [2 ?* ~
- #include <mach/memory.h>* M7 [- y) P9 c) d' P/ V6 N
- #include <mach/hardware.h>" Y0 a S/ G; R
- #include <mach/irqs.h>
9 i, m' |( F3 B9 R8 h8 p - #include <asm/hardware/edma.h>
" v) b2 [9 v1 g7 K. V- |
3 d, U! y, i" ?* J( `- #undef EDMA3_DEBUG. X3 h* I6 Y: d$ R P# h
- /*#define EDMA3_DEBUG*/
; S# s5 v4 u) K" h) j - $ B' j/ K1 q0 A3 U3 I
- #ifdef EDMA3_DEBUG# n; d; t1 h i7 A9 x5 X1 J- P1 W) C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. }5 o; V8 W1 m" w. D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ T) ~9 l; Z2 T% l, A3 u$ ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% V" S' q9 v1 c0 }" ?2 E2 { - #else% m' r+ z5 t8 h3 m
- #define DMA_PRINTK( x... )8 X; k! [8 y& x
- #define DMA_FN_IN6 @0 w$ ~- q* V, R% `5 }- r
- #define DMA_FN_OUT6 j0 S: h, s/ J( V
- #endif
: K; }( d# I/ j% y; D4 |
, C7 f2 [6 H5 Q8 S2 _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, B/ F2 B0 {: f, c, ?/ L - #define STATIC_SHIFT 3$ P! O$ U- x6 W$ Y: o5 v) K
- #define TCINTEN_SHIFT 20
8 R+ B Q) l! t; s - #define ITCINTEN_SHIFT 21
' c" Q) H, {1 H- e: ` - #define TCCHEN_SHIFT 22
* \/ z# {" H! [; E8 u3 ` - #define ITCCHEN_SHIFT 23 v# t3 L2 D, A1 V$ C8 D) Q
1 G2 | F$ e7 d! i/ u- static volatile int irqraised1 = 0;: v8 m! W/ W5 y% A+ Z+ a. z' V
- static volatile int irqraised2 = 0;/ E; q z, E" W
- # n* n4 m% y+ N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 m1 J T3 d( k, g( O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Y# ~+ z# W" @/ l; S% B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; h$ t' c6 s' h! {& K/ i q: Y" B
$ `) A" n1 R/ t a4 h! A9 d5 e5 J- dma_addr_t dmaphyssrc1 = 0;
0 @/ t1 U9 z" B/ e- O - dma_addr_t dmaphyssrc2 = 0;" I) |$ }; t. t3 `' B
- dma_addr_t dmaphysdest1 = 0;
: P2 R; R2 x, t% `6 ` - dma_addr_t dmaphysdest2 = 0;
4 F5 L( X# u/ Q: b% u0 Y H - . x3 M( H* _, j7 q5 O7 i- K
- char *dmabufsrc1 = NULL;
! s2 e ~# J% h" M9 A2 P - char *dmabufsrc2 = NULL;" d2 ^2 g, D/ y( ^- |
- char *dmabufdest1 = NULL;& @3 w% w2 ?9 i. L5 H
- char *dmabufdest2 = NULL;
# l, F& a9 e f - , `! U" c# e7 E/ m
- static int acnt = 512;
1 w. c4 A" Y! e) ~4 q - static int bcnt = 8;
5 \: {; `3 x( J r - static int ccnt = 8;4 k K- ?6 W0 |. H
- $ |% I- ^7 s* e/ g# O
- module_param(acnt, int, S_IRUGO);
9 P6 p" S! c0 ~# }/ `0 R* f5 X$ v - module_param(bcnt, int, S_IRUGO);
q/ y7 Z9 l, K. W5 x - module_param(ccnt, int, S_IRUGO);
复制代码
! ~% z8 q; a2 Q2 n$ m+ N7 t- _; ~6 a _' n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 x2 L( b F6 L& xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) R! o* z7 A3 H) L$ M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ c4 I6 c6 P# t: r3 o# i% O- @. Z$ n- D- G
' G; y; e) a. x1 X% W8 o
|
|