|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + ^( k0 ]7 _, [0 o6 f
- [code]EDMA sample test application
' P' }8 s) H/ @& N ^ - /*
5 ` F' R% y" U5 ] - * edma_test.c
9 `# a/ L4 d& M3 [ - *2 `7 X9 m& @6 n0 ^
- * brief EDMA3 Test Application! ]8 t/ E3 S4 {* @: W/ s9 u, F* ?
- *
+ H3 e0 r3 o% N& D+ n. R/ f4 q - * This file contains EDMA3 Test code.0 v$ b$ x* H" q+ s9 }2 r
- *3 X; V6 l. E; q+ o" [5 u0 k7 o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 \4 A8 v( J5 Z7 c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 W+ M8 g5 C4 O
- * TO CHANGE.
& L& P' b. ^% B6 C9 N( {( Y - *. o- c1 V [, o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# N/ N/ V" O/ j V5 W - *
8 q0 w: b! O) n- S+ w! y1 ^ - * This program is free software; you can redistribute it and/or" d' h. ]. n7 b" N
- * modify it under the terms of the GNU General Public License as: r7 d7 |' c+ S5 f* N- K% a
- * published by the Free Software Foundation version 2.& B$ S; u) ^7 r) N" S3 n2 m
- *
; `7 j& s( @9 ~# D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 u h2 a* d) R0 C - * kind, whether express or implied; without even the implied warranty, u; T; Y! L" t- h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, ?2 C* M! C0 p! n* |, d; { S7 R
- * GNU General Public License for more details.; Z' i' G$ ~% r8 l# y
- */
! v% A) a. j/ F - / H+ F# ~; E. L. U3 \
- #include <linux/module.h>
* i1 I. J: B! \% z7 _8 a8 N - #include <linux/init.h>
* T9 @3 ]0 i8 d4 b - #include <linux/errno.h>% P9 z7 G* D3 J% o" e
- #include <linux/types.h>
( ]! u5 {) l: ^. x0 A- Q" B0 G" C - #include <linux/interrupt.h>
/ W5 [1 y0 N$ f4 g - #include <asm/io.h>
) m$ e8 m: a* }3 v - #include <linux/moduleparam.h>
0 ?% [* d: o/ Q% q6 }+ m( C, n - #include <linux/sysctl.h>: Q! _$ B" s% _* r' E4 f; o- F
- #include <linux/mm.h>$ L" ?2 y# P: X* o
- #include <linux/dma-mapping.h>; z' u. ?# N0 M: @* O
3 M' u' z/ F p6 ?9 h- #include <mach/memory.h>
* c" L9 v% i6 S. O - #include <mach/hardware.h>
" B0 G2 U, f" i - #include <mach/irqs.h>$ C6 v j* D# G2 T
- #include <asm/hardware/edma.h>% G B" l. W. C1 |/ e' B( S
- 4 o6 d& `9 I3 h$ T: \$ m
- #undef EDMA3_DEBUG
2 r# J+ e2 t; X - /*#define EDMA3_DEBUG*/
" }+ j9 z* {/ s g
2 L1 n( _2 m6 @. n. o4 @1 H- #ifdef EDMA3_DEBUG$ a' z, g# Z% h7 a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 E! F$ Y1 l3 S7 U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 P' K8 w9 v; F' S9 |( ]- o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 ~& D8 z; d% |+ s9 A - #else* j6 y( J; J# h
- #define DMA_PRINTK( x... )
8 O( @8 \* u/ G1 g$ D - #define DMA_FN_IN) c/ f* i+ c B6 l( I0 ^2 _% J
- #define DMA_FN_OUT
. [+ w1 U* r: d s' y; w - #endif
% V2 D$ _: H3 t* L5 ]
6 T. L6 K2 `% K9 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 x( \5 A) u% u7 e' s e1 v2 p' I% w7 \
- #define STATIC_SHIFT 3
0 k0 }: ]2 o! E) V- |" _ - #define TCINTEN_SHIFT 20
- k8 f U. j2 O# q: `3 d - #define ITCINTEN_SHIFT 21
$ k F3 F) ~ ~1 r% E- d9 i8 d - #define TCCHEN_SHIFT 228 P) L, {3 l0 C* C M& R* {
- #define ITCCHEN_SHIFT 23( I% s/ T2 f: m) P2 s
2 F* q1 S; Y, }- static volatile int irqraised1 = 0;7 z) r. K0 C& y
- static volatile int irqraised2 = 0;
$ k; |+ a4 m! O7 ^9 g
% H# C# V+ |7 g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 x1 ]: d. y; | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 W* K, \7 R( K% i6 D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* t/ X: V& p q5 K1 e
( X' c1 r2 C) h/ \7 b0 \- dma_addr_t dmaphyssrc1 = 0;
3 u! |, Z# n: U - dma_addr_t dmaphyssrc2 = 0;
3 M) X z" j! z9 }) \' D - dma_addr_t dmaphysdest1 = 0;: {: E4 R! ]) L0 Y! D
- dma_addr_t dmaphysdest2 = 0;
, e1 t; W# S, N1 s) a/ }
; l7 M9 h9 X( H1 E2 ]! o4 ^- char *dmabufsrc1 = NULL;
' f2 V3 j: D$ [4 z0 f8 L - char *dmabufsrc2 = NULL;9 Y% }! a; j) K9 q. D$ @
- char *dmabufdest1 = NULL;
0 R$ i% w- u X2 ^; G! W - char *dmabufdest2 = NULL;6 o" y; D4 p0 c }5 c
$ a$ X: |0 z# g. B6 m1 L/ {- static int acnt = 512;
% a+ S/ j8 D: ^ - static int bcnt = 8;
% _! U) Y1 S6 V0 a3 { - static int ccnt = 8;4 t4 J% ?" n; |0 f" b
$ W$ x; g$ n/ Y" z! y7 w- module_param(acnt, int, S_IRUGO);( Y# |. v! P3 q* c, {
- module_param(bcnt, int, S_IRUGO);% P9 ^3 y3 S7 }5 `5 b
- module_param(ccnt, int, S_IRUGO);
复制代码 & { }7 B( D! B+ {8 \* j
, ?/ U0 u% B6 X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. `5 Q' |* R' l X( J! B) {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 U5 K7 f* `0 g& f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; \0 `! ]5 d2 ~6 U
\, \, L. l) w3 F" \2 M
" v2 i6 O: {4 }8 y7 [/ a3 {/ g4 e |
|