|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " E( X2 w9 l8 u
- [code]EDMA sample test application
" {+ R; q0 Q) t; l' m5 g4 N) m) j - /*
; S% }) y1 j& w, K; E' x7 N - * edma_test.c) W! e( u% e. N% Z% Q% B" N
- *
9 ?# w9 B- Q* S5 O# ` c2 J - * brief EDMA3 Test Application
T2 \; O4 ~- z, `) q! `- S - *
1 K+ J! K, t7 h: x! s* E - * This file contains EDMA3 Test code.
' R7 E2 q1 {% ^ - *
, d H9 C' p7 o( p9 `, t& h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 ^& ~ W0 b: h8 O( {- F0 t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 Q: Y) ?9 J9 y9 e% Q# Q( R& p - * TO CHANGE.
" L7 e8 G' b6 }8 s - *7 l+ J4 y, X5 J r& ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ C+ I9 p, n/ o# Y, Q
- *
2 }6 V% R5 f l: }2 h/ I - * This program is free software; you can redistribute it and/or
+ S" }! w1 b" ]; ]0 }" F7 O - * modify it under the terms of the GNU General Public License as
0 E4 z6 B k# }4 N - * published by the Free Software Foundation version 2.
& n: r/ l- u3 _! y( I# N - *2 L7 W1 ~+ S9 N% w* p3 a' S; N1 _" n1 U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 ?2 u; P9 _% G9 L1 y - * kind, whether express or implied; without even the implied warranty
4 T0 f/ Y% S; A1 B4 G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, K; f' i! N- A% E2 g \ - * GNU General Public License for more details.
, U& P9 ^0 l8 c8 B - */
3 x3 E, |+ x& ?' @
! o# n' w: T% g) _: _$ Z- B- #include <linux/module.h>
. e) U. ]0 ~' k2 g/ k - #include <linux/init.h>
5 u) c `) ]# n# s+ D1 p* ? - #include <linux/errno.h>
1 R8 w' k8 V9 _, u! o' J# C - #include <linux/types.h>
4 K7 ?5 ], k) S# B/ _ - #include <linux/interrupt.h>& H, x; q1 N! Z' e. o) w, O
- #include <asm/io.h>
6 _3 a# V7 k* j1 \+ d - #include <linux/moduleparam.h>8 V' H4 \9 c" E j+ [1 x8 w6 X
- #include <linux/sysctl.h>
x; x2 O" Z, R( H* L( | - #include <linux/mm.h>
; l- Z' E$ I7 @ - #include <linux/dma-mapping.h>6 G. E2 g8 }4 b/ z0 y
- 2 }( v ~9 G4 z9 y
- #include <mach/memory.h>
2 _9 @ X7 J8 T( a) _% H' O3 c - #include <mach/hardware.h>
0 {- q h" J2 y4 B" l; ] - #include <mach/irqs.h>; x2 ~% t( @. M3 ]: p+ j8 h6 S
- #include <asm/hardware/edma.h>
; v+ f U0 |4 `" j7 s# _
) R" C( E, C, g! C* X- #undef EDMA3_DEBUG t" T. [2 w, ^$ d5 ^2 b. b
- /*#define EDMA3_DEBUG*/
8 w3 X- U+ {" d$ J) n/ b% T9 S - & p2 ^6 r l4 V) J$ ?
- #ifdef EDMA3_DEBUG b# ?% ~5 t1 i H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); j, F8 L2 u; P( t a& t" O0 L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. |2 H9 c8 U0 l) F; ^6 r9 F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ G2 V$ v+ G5 y" t - #else
! G1 S% z+ A" M4 S$ P) h- v - #define DMA_PRINTK( x... )+ v6 J5 f/ F- }' a9 G# _8 Z
- #define DMA_FN_IN' b+ N4 Q% i! L6 {
- #define DMA_FN_OUT
5 d5 O" X8 b X% M3 X - #endif
1 |2 \- \ V, k5 z J; c) i5 O - 6 Z9 L/ j/ c; F0 ~: O! R7 b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& {" w6 H! O; y7 ~7 \: ` - #define STATIC_SHIFT 3
, d W0 b+ e( q8 b" b. o - #define TCINTEN_SHIFT 20! P* g* f0 N Q# I! k
- #define ITCINTEN_SHIFT 21
5 Y8 b9 B; v7 F! v' b+ b - #define TCCHEN_SHIFT 22; A8 u) }$ a7 M! r: ^' H" y- n
- #define ITCCHEN_SHIFT 23
8 X, E' u+ l1 Z7 C4 m+ x7 ^- B. V6 ?
2 G5 Z1 s: M6 n5 m- static volatile int irqraised1 = 0;
9 {6 C4 P+ Q x3 E- |& ~* _6 | - static volatile int irqraised2 = 0;
e4 O m) x* D+ Z, Z - , L; \6 M8 c5 k+ d' n, a3 ?3 C$ E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* S/ _& e. A+ b: G5 o) O& k0 N: G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 V* i5 \; C) Q2 {9 {5 ? ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 i" d8 C) U x! ~' p - 8 d+ q/ ^5 _9 f+ e7 M
- dma_addr_t dmaphyssrc1 = 0;" q2 I0 l! f% V- \
- dma_addr_t dmaphyssrc2 = 0;9 Z3 z" m, J9 S) f z2 R1 H
- dma_addr_t dmaphysdest1 = 0;6 C8 l9 O/ |1 H1 @4 F+ Q
- dma_addr_t dmaphysdest2 = 0;
' }; q* F3 _! Z$ X, ^ - 5 C# Q7 w4 [ W9 r3 m- D
- char *dmabufsrc1 = NULL;" r# ?8 s$ i. M
- char *dmabufsrc2 = NULL;: r! \7 m! B/ o8 M) q- {
- char *dmabufdest1 = NULL;, o6 ` |* q' _: F$ `
- char *dmabufdest2 = NULL;3 G& c2 b" @: B' T6 L4 \: x$ T4 e6 V
- 8 s/ y2 a5 V( _5 [ Q
- static int acnt = 512;- z& @; N/ k0 V8 Z8 \
- static int bcnt = 8;
: J' {- B7 z/ j/ Z3 [ - static int ccnt = 8;4 o* e# e5 y* w- j; B. U2 B
; n% b$ x7 [0 o6 `: J! w- module_param(acnt, int, S_IRUGO);/ d& e0 x7 A0 q# G, s/ H" V
- module_param(bcnt, int, S_IRUGO);
% e' G% v, I ]4 G4 I - module_param(ccnt, int, S_IRUGO);
复制代码
F% I0 I5 {& Q" Q5 O0 t
8 \, B# Y) J# |; d" N& N0 r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& `& w2 U# k* K% O7 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 t4 u( Y6 z$ n" b2 h. p5 K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 P$ y5 u0 c) o. h3 i# G
1 A) M: U% X- _
( ^) p4 B# w. z" Y; x3 k" D |
|