|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : q" n+ k- @0 e! S
- [code]EDMA sample test application
' O" }6 P3 x! S4 z& L" c - /*
% I6 L* O1 W/ @5 H t6 G) C* c - * edma_test.c# s S( s4 A1 M8 s; c& y1 D
- *; [, `/ x- j2 D) B! ~
- * brief EDMA3 Test Application
% f& c2 D/ B( {$ v1 R4 y# S, D$ s - *
; I( I3 b8 T0 M - * This file contains EDMA3 Test code.
% \1 u/ R3 U: @- O- m - *9 P Y$ ^6 X+ t9 n- q9 c7 j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. H* E& C5 Y0 O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( u8 J& G8 G4 a; I" Q: z/ o - * TO CHANGE.8 p0 c5 D4 _0 a" I: z
- *
8 {9 J% t5 P8 X+ m \/ l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ d% ~% e ]: C* G3 o+ U j
- *
7 ^0 R: f$ ~, I5 r. P, c - * This program is free software; you can redistribute it and/or
: `: k/ i' M" `: H) ?/ a - * modify it under the terms of the GNU General Public License as
+ f- s! O6 K, O# b6 b* l, ~ - * published by the Free Software Foundation version 2.
" s/ R% r6 K8 f - *+ v' q( T) Z# O6 W7 G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ [( H( R3 t1 z7 Z# _* Y" { - * kind, whether express or implied; without even the implied warranty
" ~ a0 v$ a# R6 y2 Q( w4 N' X - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ o2 m$ W4 z- R/ h4 ~4 R - * GNU General Public License for more details.
0 p/ F' g& Z5 Y Y/ r- B - */3 l2 }" e6 @4 j; f! b4 ^; y" R7 E
- 1 r) a0 v' `: E, G8 P
- #include <linux/module.h>
( G* N0 m" ~( r \+ B - #include <linux/init.h>
! t! ^% N( E: C1 t% R1 J - #include <linux/errno.h>+ R# h8 i* W% K) U0 V, i
- #include <linux/types.h>
3 u0 D8 Q0 U) e6 |, Q - #include <linux/interrupt.h>" [' ~7 r" {0 B* n0 M
- #include <asm/io.h># y H ^% W, ~! I5 Z. E
- #include <linux/moduleparam.h>
6 \8 \8 a( [# k4 J# i - #include <linux/sysctl.h>
) h E/ b5 P5 P- t0 H( H - #include <linux/mm.h>
7 X# b2 D, F5 t) u6 h2 t, N/ F- D - #include <linux/dma-mapping.h> h% r9 ]9 S. W
- ' K" u' o8 w7 | m% U% d, Z
- #include <mach/memory.h>
0 N6 ?3 T; m! h" H e9 e - #include <mach/hardware.h>
X$ p G( Q/ C' M$ ? - #include <mach/irqs.h>
% h6 ~' @( K( P: A+ w - #include <asm/hardware/edma.h>
5 O5 u! z, K) r" Y y2 _ a" c. l - : V. ~! k8 a( _; N; t! B$ F2 s' s1 s" c
- #undef EDMA3_DEBUG
4 u+ I2 \) d D' [/ L1 } - /*#define EDMA3_DEBUG*/' f+ ^$ G) { L s
- 1 I; K+ c6 B' Y
- #ifdef EDMA3_DEBUG3 J; w; D. |5 }5 o# b# c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). P1 m6 [: o' P+ r8 h: m' i$ T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
p: P: R c( N4 }% g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 j- m ]+ D9 q9 V( ? p$ b3 n i* i- `
- #else* j% u# A6 L% n5 o
- #define DMA_PRINTK( x... )
" g9 n3 Q% u# R8 \ - #define DMA_FN_IN
9 m+ [" H! H" W) C5 [ - #define DMA_FN_OUT) t5 I# c* ^, T3 ~( e; `
- #endif
& k- O# J9 N e$ m
& i( T7 g6 F3 b8 T, ]$ R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' e) b' m) V3 f) u - #define STATIC_SHIFT 3
- s9 r1 Y$ D) G6 X7 p - #define TCINTEN_SHIFT 20
3 r! z3 f5 }4 k8 ` - #define ITCINTEN_SHIFT 21
/ Q' q8 H2 z( {3 N) s0 u7 x) e - #define TCCHEN_SHIFT 228 @) Y9 ]6 {$ a* @
- #define ITCCHEN_SHIFT 23
# Z2 ~9 {5 d# p' b) T$ m3 X2 |
1 l- Y) K" t. U/ B- @9 z+ A- static volatile int irqraised1 = 0;; n! J9 b. v c6 m
- static volatile int irqraised2 = 0;
7 G# t# @1 l6 P4 ?0 n' v7 o/ i7 O - - a5 ~$ V' D) u& A5 e# l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 `( T3 w( k' M. [3 q% |& p' g/ u# T$ V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ o4 i1 f/ O" X5 F- s* E; N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, T8 {# E, ?1 L% c
; o9 r9 S/ G2 Y) G( L3 |- dma_addr_t dmaphyssrc1 = 0;0 r' u: P5 S$ S9 m6 w: y
- dma_addr_t dmaphyssrc2 = 0;0 ^& ]* n' A8 [; m' H* K
- dma_addr_t dmaphysdest1 = 0;$ E7 p. p3 q9 P% o
- dma_addr_t dmaphysdest2 = 0;
. j+ o& u0 F$ o) t
' u2 a- b& A7 A$ l/ s' m- char *dmabufsrc1 = NULL;, U$ }, w: j! o0 K8 X5 f# N+ e! m
- char *dmabufsrc2 = NULL;
( b" H; w! Y# V U3 Z - char *dmabufdest1 = NULL;9 h! x$ E" m( X( e$ q) S
- char *dmabufdest2 = NULL; Z& ] z4 q5 |9 X1 ]# \4 l
- $ b7 L+ A( ^, G, P8 H0 z1 @* {8 X
- static int acnt = 512;
6 h) F. Q: m, h8 S( I - static int bcnt = 8;" e+ I( `- V& K& Y( o5 {
- static int ccnt = 8;
; Q7 g% o$ p3 E - 4 x3 I8 x3 h# r! m2 O r/ s9 }& W# z
- module_param(acnt, int, S_IRUGO);3 Q. l( \0 ^: z
- module_param(bcnt, int, S_IRUGO);4 ]& D& U4 M$ x
- module_param(ccnt, int, S_IRUGO);
复制代码 1 j6 C2 w8 l- q' V/ [4 I
2 U( F! j! B; _: H g5 l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; i, o( e" W1 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ }( a: { U$ e3 A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& a9 e1 a3 \; b
% X6 ?2 i5 o2 j6 [, K% i" b# C4 I& V. j7 B
|
|