|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 \, N. z$ n0 e6 F$ C: G& ]1 w5 S1 w
- [code]EDMA sample test application
) \) k8 _# ]! j - /*
+ x/ z2 j/ u R5 j" U& o6 H" R - * edma_test.c8 I# y% s+ }# X% }' O4 z; e; E/ b
- *
1 i. e) g1 y, \# O - * brief EDMA3 Test Application
! s# l& e: q C: ]. G/ y' U8 M - *$ o! f0 ]: Q. C
- * This file contains EDMA3 Test code.
% S) Q( w: B" |0 Q1 n# S - *
1 K" H" j8 q2 M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 m3 a: ^1 v; t( `1 P4 f% w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 X/ \* t$ w: m3 t - * TO CHANGE.
7 j5 X& m4 J2 h7 p. ^/ f/ Z - *
' k+ K& \3 v4 z& y: e+ I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" |# \0 @9 }& z1 G7 Z% J1 m
- *
3 a$ k2 Q3 n z" }$ t - * This program is free software; you can redistribute it and/or& m6 m- U6 R- W- {- Z' u, S+ B0 n
- * modify it under the terms of the GNU General Public License as
$ u/ p* |: z6 E - * published by the Free Software Foundation version 2.# z: ^+ B8 X( ^+ V6 Y5 }, y; e8 w Y
- *
5 t9 J+ Y8 X, i! c. h3 e$ [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- A( C* X: n4 j4 T8 {$ {& s: A - * kind, whether express or implied; without even the implied warranty- C n, f& @2 m; ?( F3 t( V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 h: W& [( ^8 B/ M, v; p! a - * GNU General Public License for more details.5 G2 b- a/ V# Y8 w8 t; z
- */! \' E. t" W5 ]3 u& r! w
T+ I2 `) x# |5 A3 C- #include <linux/module.h>
$ f! B$ L7 |+ P5 e( P% z - #include <linux/init.h>% y5 _# P5 _- V2 Z5 m5 R& a1 B0 v L
- #include <linux/errno.h>. o/ u, H- s: b8 a t9 }
- #include <linux/types.h>
4 j' g# f3 U6 P, g% P) A- t - #include <linux/interrupt.h>
& V1 R8 v) u& L% O8 ^% p8 g - #include <asm/io.h>
8 q3 e( {7 n3 q" v3 g - #include <linux/moduleparam.h>) b( g% S3 O6 b b3 m
- #include <linux/sysctl.h>( [& n8 u# h0 Z( h4 I0 Y/ e
- #include <linux/mm.h>, N9 T+ H- T/ Y& Y0 c
- #include <linux/dma-mapping.h>
' Q( d4 w; z# L% U$ O5 J8 ]
8 T& a7 S; C* ?/ S3 r* g- #include <mach/memory.h>8 N1 P, y' X" `! s* X
- #include <mach/hardware.h>. L# w K4 H5 J, Z; A
- #include <mach/irqs.h>$ O- n& U+ {- L) P- R
- #include <asm/hardware/edma.h>
0 D$ I! Y0 U6 h' E4 n
9 T `- a& d% `9 b% Y2 k! {- #undef EDMA3_DEBUG
. C% {: o5 l6 G% ` - /*#define EDMA3_DEBUG*/! l- f9 Y5 i* A- O0 q
$ { I8 d0 u$ `3 d* q, e2 o- #ifdef EDMA3_DEBUG
- k6 ? Z9 @- i! Q. V& a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" p ^/ @6 F1 A% |+ M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' ?# n" m# x1 D2 g& ]" V7 A! v" Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 k- W: K% q b - #else
* \% j, I: {! B8 Z& t8 c+ @7 j - #define DMA_PRINTK( x... )/ s1 [6 a1 i& F# H% `' Y
- #define DMA_FN_IN
; j& p' ?; k0 X0 y" h - #define DMA_FN_OUT
' k9 _# @: u# q" j7 k( G - #endif
& M5 C( |1 c: v - , b* ~8 V: `/ J4 S( I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- u: j( `( E4 ^
- #define STATIC_SHIFT 3; D. [& M5 v1 y6 b) s% b
- #define TCINTEN_SHIFT 20% v' ?. N! S, q3 ^+ e
- #define ITCINTEN_SHIFT 21
% s, y! {* a- r" ^ - #define TCCHEN_SHIFT 221 `+ z. e& K$ g' m6 B5 J
- #define ITCCHEN_SHIFT 23
' a1 W6 I/ \' {$ S1 ^; f8 \4 `4 j8 \ - % o" w9 D6 C6 W. a9 |3 R6 ^; M4 I. |
- static volatile int irqraised1 = 0;& {, Q0 M k; A. Y( @
- static volatile int irqraised2 = 0;
8 z6 P+ i9 E+ J
0 Q5 |5 O: [0 P+ Q5 `" F1 B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& j5 e$ e0 H: z8 x8 R' O' O+ | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; u. _! C: q5 e, w# Q: u/ m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' O4 z5 L" p* B+ O
- }6 b0 N% a1 H4 n5 f0 ]1 q- dma_addr_t dmaphyssrc1 = 0;0 ?$ ?, O$ v1 L0 ]
- dma_addr_t dmaphyssrc2 = 0;! B8 x& Y/ r2 o: h, |
- dma_addr_t dmaphysdest1 = 0;7 ]1 C7 L& U+ O
- dma_addr_t dmaphysdest2 = 0;
2 e x( V4 ^+ g - 1 z- T! b; @+ k1 y& K: \0 ]
- char *dmabufsrc1 = NULL;2 Z. k( Q2 l3 v E2 E- L8 I
- char *dmabufsrc2 = NULL;% k) [: k; V$ E0 @" O
- char *dmabufdest1 = NULL;- B+ s; ]# U3 \' R- ]
- char *dmabufdest2 = NULL;* x* |- V9 \7 u5 }3 q4 |
- o- L8 Z3 V0 `3 S- static int acnt = 512;
* g' D2 F# J% d/ L( C - static int bcnt = 8;
! k0 A+ X1 N* o, w1 n2 ]# x% } - static int ccnt = 8;' l' W% l( N5 v; I! b
8 u7 t6 H7 v. L7 ~- module_param(acnt, int, S_IRUGO);- u# a1 ^* o. t4 Y5 N
- module_param(bcnt, int, S_IRUGO);. ` e( _6 i: Y9 L6 V. C* y
- module_param(ccnt, int, S_IRUGO);
复制代码
9 \0 X! Q/ W% R
8 U7 H" h7 A6 c+ J1 X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' C4 R8 c4 s& t& v0 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% e7 }& _+ {+ L9 r3 W& t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
~6 @% M4 y4 [& K* v! t& ]4 E3 M3 B8 ?! V1 h6 g9 B$ W A
0 f2 S0 H3 q6 O
|
|