|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% s- g7 f8 a1 u; [. n8 Y7 t8 j- [code]EDMA sample test application5 L! A$ }( |' s! b w
- /*
3 ~1 O3 o+ d/ s7 d1 o _" ` - * edma_test.c- u; U2 C+ }8 T) W; ]8 Y& r9 n
- *
5 Z; R0 i4 L; p3 X/ a4 e - * brief EDMA3 Test Application0 M7 o1 l7 @* s0 F& e8 Q" ^( m- y7 H
- *
) j$ J2 w1 L) I8 f7 ?3 @ - * This file contains EDMA3 Test code.: z- {) i. g0 Z2 o
- *6 N& b" \" k A" G: p ^! @2 t, P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ Z5 ?7 _' j0 G( E s+ X0 c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# r- j: g) _5 ^
- * TO CHANGE." V' }3 B _$ A+ x
- *. P8 {+ d7 Y: @2 f. d9 g5 T) f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, Y$ [$ o/ j! Y4 R% `4 T - *
# H7 P0 C2 Y" ^; X - * This program is free software; you can redistribute it and/or
7 R, w) b& J" L! f* t - * modify it under the terms of the GNU General Public License as8 ]! t& b) I- h0 Y
- * published by the Free Software Foundation version 2.9 i+ z. w# U. H6 v m. {: i
- *
/ R+ T6 c; K1 B9 i+ L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 u8 m" g3 Z' f& S - * kind, whether express or implied; without even the implied warranty( Q" W2 }9 ~0 J- C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: a: c$ V" ~# H; t4 K) `1 k - * GNU General Public License for more details.# k' a6 V/ V3 E$ R; ^ H
- */0 [, D, _/ p9 G' H: Y0 O8 C
- 3 Y' P2 I5 ~$ t
- #include <linux/module.h>- t" z0 z2 h2 ?/ b
- #include <linux/init.h># H: F$ M- K# ], T5 }
- #include <linux/errno.h>
7 e7 @! W, q" u( ?1 c- o: h, X1 g - #include <linux/types.h>
, L4 s+ }% l- w) F8 O# c0 Q3 S" u' _ - #include <linux/interrupt.h>
3 I- k3 q( w* v$ i: f2 Y8 ^& S1 | - #include <asm/io.h>
2 R0 v/ n3 m6 N9 N/ _( D- p - #include <linux/moduleparam.h>0 p; g# S: D! h' x+ Y
- #include <linux/sysctl.h>
8 @$ K5 ]7 z* j' C$ y' |& T; Y - #include <linux/mm.h>
4 ?$ G p5 G4 v% ~+ Y0 S# f - #include <linux/dma-mapping.h>0 _% `$ }- Y8 d5 `! r: R6 h3 n0 q z
- 5 ?1 l) s0 U0 [" ~ `
- #include <mach/memory.h>
- y* ~. T) X, z - #include <mach/hardware.h>. u' [/ O# u7 ~) @: @" K# j
- #include <mach/irqs.h>
3 i& g7 }- b, r5 o9 V* h8 i - #include <asm/hardware/edma.h>
4 x0 j4 U8 o. U/ Y+ e0 o
$ Q8 t7 }" P: Q9 N! ?* k8 t/ Q0 ]- #undef EDMA3_DEBUG
7 i" O+ C+ }. ?! b9 O7 ?; r - /*#define EDMA3_DEBUG*/
4 I/ T3 C* Q& d
# h) M# r1 C1 A! f/ N- #ifdef EDMA3_DEBUG5 y+ L9 w7 c6 O( Q$ I& `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ h B! i% X( A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 }2 H* K3 G5 \: w. p" `4 y& X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). W. B9 L8 |; `4 t! X" t9 V# X" M
- #else/ E9 M5 }2 N( V# A V2 _ t
- #define DMA_PRINTK( x... ). l0 `% F6 D. F
- #define DMA_FN_IN
- S' D) g" W* E1 \3 [% U; _9 a! W - #define DMA_FN_OUT! Y( p% _" V) J e7 f& Y6 _
- #endif
, }; U2 {; s* f( h" H. ]! |; D
6 k& r* m5 H& n. x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 e7 c; o: y( G: X$ o+ y1 s9 Y4 ? - #define STATIC_SHIFT 3: a* ?% c6 u& V7 h7 f( r' v
- #define TCINTEN_SHIFT 201 G- B& u4 w4 M- J2 `! J/ N
- #define ITCINTEN_SHIFT 21- s# y7 f! W! ?* J
- #define TCCHEN_SHIFT 22
$ [% Q' G# M" L! h - #define ITCCHEN_SHIFT 23
4 R0 d( c$ j, v: I) m - " f. K$ ]8 v0 |- F+ E o
- static volatile int irqraised1 = 0;
* s# v! X7 J, t. M( q& j' e; a - static volatile int irqraised2 = 0;
8 Y9 O9 w) U3 _# R+ A - 1 p' Q$ B0 J0 `- k( _# |9 c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 e# `0 I6 e* X% E4 Q1 f% I1 L- O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 z1 U# U$ v# }7 O) @- } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% d& Q6 x- I9 P* D
- 6 }( H1 P8 p2 y* b5 `( B9 c- H
- dma_addr_t dmaphyssrc1 = 0;
( x8 I% L1 @! d" |+ i: l8 o9 X - dma_addr_t dmaphyssrc2 = 0;; d) P: }0 a* U$ s" U
- dma_addr_t dmaphysdest1 = 0;
: s/ k( B) m# m( R' ?9 l - dma_addr_t dmaphysdest2 = 0;
" L/ d- j% C: I6 v, G. k - # J; F5 M& l$ u; }! S# ` E4 G# @! n
- char *dmabufsrc1 = NULL;: r" n& H) |8 \# J B
- char *dmabufsrc2 = NULL;, |* m2 T' o* S/ Z e. m+ w- B
- char *dmabufdest1 = NULL;
! [0 ~0 Q+ K" b; @+ H% b - char *dmabufdest2 = NULL;5 t" ^& h9 |- C$ H6 f: a( `. o0 K
- 9 A4 p% M8 G( l5 T' z$ ?
- static int acnt = 512;
* l# P4 N/ ~; p6 H* l ~1 W - static int bcnt = 8;
7 w( ]0 N4 u3 N# t+ F, [ - static int ccnt = 8;) Z, Q$ t w* |; b9 _
4 J( I5 I: S3 e; i/ x- module_param(acnt, int, S_IRUGO);
, h. m/ z6 F, E \! \9 n' a$ ^ - module_param(bcnt, int, S_IRUGO);
8 Z9 N" D8 H' {3 A5 a4 [* O - module_param(ccnt, int, S_IRUGO);
复制代码 % V! K. }6 A" O$ c* K& y0 {
2 Y2 J" Y5 P F: v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. W) {' d' s: w) j' Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ L$ q4 R" S w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 L% Q* p5 R! k3 {2 e5 C0 |( A, l
4 [, \' m; o) V" d, b% S/ |% ]8 a
) N, }% q- m+ F8 `, |/ ^2 a& P% Z |
|