|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( ?& a! h V' n" K- F/ u! I
- [code]EDMA sample test application$ W7 F8 f" [- m' Z c
- /*
% S0 B' W' ]; c( O - * edma_test.c* {% |% a( K5 r: {
- *
) U8 V8 P3 Y' S; }8 A - * brief EDMA3 Test Application
3 |5 p# W' ^8 X2 f* e& Q - *
, |$ ]; L# M1 y2 U1 N4 `, E! S - * This file contains EDMA3 Test code.
& {4 j& p U( t* ~ - *: y7 L$ B: }& n% V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
c5 I. h: u5 l& Q: G- K! C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 C/ w# {5 L: { - * TO CHANGE.2 r( R2 f% R) r. S6 J/ w& f3 {# j
- * V) @1 G: G9 Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( p' d! F7 S. Y) P
- *
* }; K& |' h. J+ ~% _$ K - * This program is free software; you can redistribute it and/or9 e) w" K( E* Q
- * modify it under the terms of the GNU General Public License as
, r5 t( k* W3 u7 m t - * published by the Free Software Foundation version 2.
0 O; u" j4 A* ?& M - *
- M4 p! `: F0 h# r1 p3 r0 I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 W3 c: b3 A8 L- o
- * kind, whether express or implied; without even the implied warranty
& P" S* g" ]- F. W8 r9 {: Z5 P0 j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' q3 l. {# g8 v O
- * GNU General Public License for more details.
, e; z; l5 r( g* ?/ h: d - */
+ }) {% U; p$ h( }
2 x/ s7 v& S9 O3 v9 H4 c1 x) a- #include <linux/module.h>$ ~1 s: c; _" R& ^2 r& t
- #include <linux/init.h>8 ~3 J7 d1 D/ I4 Q, n/ h
- #include <linux/errno.h>
6 v& x3 d, F% O0 j6 X6 q3 t6 N j - #include <linux/types.h>
H/ G( h/ k$ o9 R- z2 B) C - #include <linux/interrupt.h>
# O$ \. S) a5 x& M% U7 w5 J - #include <asm/io.h>
R2 c2 y4 p5 M' F - #include <linux/moduleparam.h>
: f$ |+ w& Y' j3 [1 u7 Q - #include <linux/sysctl.h>$ W, Y& F3 P+ p
- #include <linux/mm.h>: }, q q' W2 q' n# c( K+ N) c
- #include <linux/dma-mapping.h>
# V' u) ^( F4 r7 ?8 Y6 V2 I - # y7 Z4 ~) K: _0 s. |* x
- #include <mach/memory.h>4 s& M/ c' P% p
- #include <mach/hardware.h>
' e$ R& b0 a1 ]& h1 Q( w - #include <mach/irqs.h>
$ H1 A# S0 w* G: b$ L4 N - #include <asm/hardware/edma.h>7 E: X4 C; h& K
- - K8 a( R" h( R: ~' j1 z8 ^& |
- #undef EDMA3_DEBUG/ w; l1 E( H- h1 v9 t6 @: i
- /*#define EDMA3_DEBUG*/
& y6 H' D4 T9 E- H) l - & ?& p6 x! D. n% ^
- #ifdef EDMA3_DEBUG7 o0 \: \2 t5 C- m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ i, m" j! D+ V% F; x( y5 x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" K- t1 `+ k% u8 F, O6 Z, A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, z ^5 G$ [* x4 B - #else
?# g/ ^2 O; y5 o6 q J( v% T - #define DMA_PRINTK( x... )4 d/ r+ M* H5 O" m4 _
- #define DMA_FN_IN
; J5 }/ a$ i% B* w- c% |* k+ H* | - #define DMA_FN_OUT# \1 Y4 i: X6 ?6 @ E
- #endif6 ? Z! y/ ^% i! U
3 }" X) z4 y$ }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ G+ M3 u6 B9 Y - #define STATIC_SHIFT 3
/ k# }) {' Z s2 ^' b- p5 k' F - #define TCINTEN_SHIFT 20
2 T1 s" \' g" b - #define ITCINTEN_SHIFT 21
& r E4 \7 s" d5 ]( e - #define TCCHEN_SHIFT 22
& C( W( g, a0 ^ @ - #define ITCCHEN_SHIFT 23
" t1 y, v. N0 n; p - ! f* [; \8 O( E ?9 g% R. D: e$ E& N
- static volatile int irqraised1 = 0;
5 j" ]! _7 R0 Y- P. ? - static volatile int irqraised2 = 0;2 t7 [/ {* I0 A# m- G
- 1 f2 }( H) \3 F5 k; y" C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Q( F8 o/ v) A" Z" i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 `) O% i! T7 b3 \+ @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ M# C. L, b' a7 y! K
, B n5 S% v8 @! a- dma_addr_t dmaphyssrc1 = 0;
; _3 v- W8 j0 L q6 R5 z+ Z% r, C1 c - dma_addr_t dmaphyssrc2 = 0;
. C' U' y: @( _/ D3 ^) a: j - dma_addr_t dmaphysdest1 = 0;
& y- E D) k9 l4 r4 R - dma_addr_t dmaphysdest2 = 0;
3 |6 S/ {& s3 J5 x+ I9 j% d" r - 6 V1 ]: x( E$ m2 s, A! C, m
- char *dmabufsrc1 = NULL;# P9 q4 X9 F+ m) c
- char *dmabufsrc2 = NULL;0 Q3 @7 ]! H( D+ b& K9 J
- char *dmabufdest1 = NULL;
# O9 n- i& a/ Q) j: F7 r, [ - char *dmabufdest2 = NULL;
D# s( J, ^9 P# k
/ w* [6 Q/ R3 d4 a8 i! Z G. F- static int acnt = 512;4 o* V; l0 t6 A9 o) W& O
- static int bcnt = 8;
* ]8 j: v: N" S# M+ @' G7 u. N - static int ccnt = 8;) |6 G. k' c' ~
- 7 @0 b& X" M; @5 J
- module_param(acnt, int, S_IRUGO);
. V6 g" _$ R6 N1 k9 p! d - module_param(bcnt, int, S_IRUGO);: c* L/ q& N! }* K5 T3 E
- module_param(ccnt, int, S_IRUGO);
复制代码
) z2 [: G2 I: X) Q4 Z/ S1 N' N+ N% i' ?4 y4 `$ a7 | o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 V4 ?0 G9 [. t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 ]- ^* m" D! { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ q: U: k0 A" }& o7 _; x7 F
- t7 b3 g0 I8 E( N" V$ d9 a* Q- H4 ^( M! x, I8 o- P& j
|
|