|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! j( K9 c3 w" l, ^: M1 K" o- [code]EDMA sample test application
+ X. _6 E& o% z D - /*5 S( M7 V$ {# l4 ^" z
- * edma_test.c
. g& ^* \7 a" ~! h( G T/ d' m - */ ~: `$ L1 ?+ x
- * brief EDMA3 Test Application) @- Y- B3 ?) z1 Q* x
- *
( i/ C' n/ U! T$ X; Y; D0 }* ^6 j - * This file contains EDMA3 Test code.9 [. ]$ y. l, l. C# J& P
- *1 ^& j& |; C8 [7 P# J: s' n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& B( n8 X& ^1 f$ {5 X y8 f# P4 p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 A' `/ R- ?8 f; m) o - * TO CHANGE.$ a! a6 s! e3 Q% G" v8 z
- *$ y p! q- S* G" l! }" m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! u( T5 g# @. J$ ~8 m% ~ - *
3 f0 H" y% h# N: e6 u$ y, ] - * This program is free software; you can redistribute it and/or/ e5 a; B6 P- j8 _% Q0 q, z4 {
- * modify it under the terms of the GNU General Public License as6 }) w6 P* z% m3 r3 n" O
- * published by the Free Software Foundation version 2.
8 @7 @0 g+ I+ H! ?+ w - *
+ c1 }2 ^. P- s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) o- D( W3 V6 }4 I - * kind, whether express or implied; without even the implied warranty
6 G5 }. k- n, U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& q# ?0 \. _' N, X4 T& q, W
- * GNU General Public License for more details., v* `6 \ W9 Y, p; Z& A, m! n+ m
- */$ m+ @ ^3 I; w5 ]* i: f! c
2 g4 p1 a" u. B" X/ p7 ?- #include <linux/module.h>
# P2 x3 H9 V! u( d4 O - #include <linux/init.h>% b" ]$ h& h/ v o2 T; B
- #include <linux/errno.h>
3 ]8 C9 o1 F$ g - #include <linux/types.h>/ l/ {5 }" c2 |) K
- #include <linux/interrupt.h>
. s- S1 @) u: B - #include <asm/io.h>
/ E6 a' l8 L% C- n - #include <linux/moduleparam.h>
; ^5 q8 c/ ~" W% ^ - #include <linux/sysctl.h>6 }7 j; y: T& q- M: P" H; z1 [. G
- #include <linux/mm.h>1 v( S& x+ M0 z* z' n+ J0 w
- #include <linux/dma-mapping.h>
: E0 K1 e' B) E2 U' _+ u6 R! C( \7 g
- ^ a# Z9 V, f- #include <mach/memory.h>% {# R5 T* J- u( L& ~8 u8 A
- #include <mach/hardware.h>
0 i/ m7 v6 J1 l5 V# Q" i1 c, G - #include <mach/irqs.h>
& j3 V) g( B5 P - #include <asm/hardware/edma.h>
0 y) i8 r8 ~; ~0 b9 y. w/ B7 _' T8 N; B
0 @. \, u% G& i6 Y7 q, V; U3 c4 @- #undef EDMA3_DEBUG
/ L+ y/ b( P/ j9 z - /*#define EDMA3_DEBUG*/! g3 \0 P7 q" n" b: b9 t
2 G" O' \( X# R C( q- m4 I2 N6 F0 _- #ifdef EDMA3_DEBUG8 Z, O% f) z% I5 \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 q- Y4 g5 I# S7 Y6 t8 y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
^5 f+ ^' R( Y! D/ Z$ B" T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 w+ b$ x8 M8 E2 e# k# ~6 ~
- #else
) Z6 w6 }+ T9 \* p% F7 K - #define DMA_PRINTK( x... )) h; d" O2 W5 T- @6 N5 ?
- #define DMA_FN_IN4 Z9 E3 U$ h$ f3 V, X- n) p0 H8 c" e
- #define DMA_FN_OUT' @) D. m! d9 T' R+ Z
- #endif
0 @* K' w8 N. `9 b' l+ e) G$ r
5 |- d$ z# U9 y/ L" ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ w$ C1 M. j( @& v5 r/ W - #define STATIC_SHIFT 38 B3 w- f8 @% e* ^
- #define TCINTEN_SHIFT 20
" V5 a* V/ M9 H6 j9 H! V - #define ITCINTEN_SHIFT 21
1 C/ X2 ~8 i! x, K; Y9 c+ K - #define TCCHEN_SHIFT 22
5 G. v$ x* L! @0 c7 V5 y5 f - #define ITCCHEN_SHIFT 230 m5 F- q% a% j9 N- N) x
! @: z/ ?& V- F! V- static volatile int irqraised1 = 0;
/ q2 c6 Z8 X$ S' R/ Q7 [( \2 e - static volatile int irqraised2 = 0;
9 }+ r1 k3 j& ^9 V! m7 l1 [* `
* t$ {: u M) f9 u. l8 t- e4 N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 n, Q6 G1 x1 C' Q: L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' {0 Q7 u7 U$ Z1 `, B( ^( i( Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 k5 o7 ^: X. |, U2 y- Z
- . {6 O3 o6 p1 F5 L
- dma_addr_t dmaphyssrc1 = 0;
7 `! P) W0 \# W$ p7 B - dma_addr_t dmaphyssrc2 = 0;+ N; A% q4 ?' V4 ]# ]4 W% N
- dma_addr_t dmaphysdest1 = 0;
1 }* e3 w; s" E& `9 l3 | - dma_addr_t dmaphysdest2 = 0;
- v+ N; v0 P1 A+ Q& n9 Y$ v( n, u
/ A# `; V8 @9 x; M2 T- char *dmabufsrc1 = NULL;! Q d9 T7 [* X0 z. T5 D
- char *dmabufsrc2 = NULL;$ P+ F1 U# y: n7 ?( p
- char *dmabufdest1 = NULL;0 o, s9 T, m0 f- ]% T
- char *dmabufdest2 = NULL;
P7 w5 a. p# E" R/ Q$ e T
: ~% \$ H2 z( _, n7 i4 k5 v% d0 b- static int acnt = 512;% s/ x0 n' e" T. G V) L" }
- static int bcnt = 8;
+ J. Q g3 ~1 F6 L0 e1 R0 J: b - static int ccnt = 8;
/ ?$ v6 R m5 O) B
( x' D- U. ]5 s3 T: k4 j6 M- module_param(acnt, int, S_IRUGO);/ ~' E0 o' Z- P) r
- module_param(bcnt, int, S_IRUGO);
( ?) I7 @. y$ V* h9 q! v j - module_param(ccnt, int, S_IRUGO);
复制代码 ! s' v9 a" b1 S L$ y
* k; M- a/ c& @/ E/ j5 K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 J3 ?7 ?2 c* G3 a8 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" u+ a* x8 o7 Z3 ^! T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 P# T) J F! b7 R. [
0 A2 p. E' v/ H
) @5 s- X2 n6 M) e4 @ |
|