|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : {/ n$ I1 C* v6 [3 ~6 C5 W
- [code]EDMA sample test application
) g0 v) |0 v; V - /*
) K+ }" p5 b- |9 @( V - * edma_test.c. V8 A+ X+ F9 R$ l" w
- *
2 i8 b z) f! m) j" E F - * brief EDMA3 Test Application; n# i+ K) S! H% A4 A
- *% B* y" _7 i0 F( @/ E' Q: F2 i
- * This file contains EDMA3 Test code.- U1 W+ w+ f1 L* }8 V- M
- *& O7 d' @- ~/ m( D* I; b( O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* `! }/ C1 i5 ~/ }: r: S: W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 Y K* B1 o C) ~" } - * TO CHANGE.
$ M' \9 F1 @# J) s( K _2 g; _ - *
3 ~# O' y* F" ?; x4 V" Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# F4 O' I- v8 _5 q
- *
$ L+ i% U# M Q0 ~* j - * This program is free software; you can redistribute it and/or
9 ]) u# O' f1 L8 c4 L# V - * modify it under the terms of the GNU General Public License as
: z0 W/ l- \( k; J4 n6 p+ m - * published by the Free Software Foundation version 2.+ N, R6 H9 y0 C8 l
- *
& L7 i/ o9 l7 F, V0 z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" p* o* u) J5 ?5 ?5 X1 }' ^+ M - * kind, whether express or implied; without even the implied warranty$ Y6 n! p8 y Z! ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, W; Q5 k5 n1 E9 ~. i9 x - * GNU General Public License for more details.3 Z! x& h/ U9 q! u
- */: f4 _. x# i1 o( Q( Z3 K8 z! ]
- " _" d0 l$ @- b* p
- #include <linux/module.h>1 K! b" F* d' p/ ~) t7 o5 U
- #include <linux/init.h>& @ q* ?' I) Y+ A8 @8 S
- #include <linux/errno.h>
) h1 |2 M9 J! }1 S" W - #include <linux/types.h>- l# ~" b' s. }
- #include <linux/interrupt.h>8 x. f+ _ m, ~$ `0 }( l3 L
- #include <asm/io.h>
# N: r$ k8 o5 D% w8 d5 ] O+ A1 r( |# O - #include <linux/moduleparam.h>
2 t7 T* n6 p3 `( y; c9 r# k - #include <linux/sysctl.h>1 v5 u) }; w2 m6 a
- #include <linux/mm.h>
1 i: s Z2 x4 |: I$ f W7 l* { - #include <linux/dma-mapping.h>
/ [; n$ Q4 R3 e" O& m& F9 t6 a, g0 C
: p3 ~* E- [9 j& ~4 \- #include <mach/memory.h>. `$ \: ~/ Y( V/ {' p6 ~# u
- #include <mach/hardware.h>
' S/ T6 i! m# s& R2 z5 R- O' B - #include <mach/irqs.h>
" j9 A" ~, n8 r, p- t% e' K; i - #include <asm/hardware/edma.h>, M( s0 ]. ~. M: A
* A) a2 [* n% w( k ?. K5 M- #undef EDMA3_DEBUG5 M% [+ t9 W' n: m j3 c
- /*#define EDMA3_DEBUG*/
$ a4 k" v/ J5 Q% T) R
# I. B9 J$ q; J8 V2 c9 Y- #ifdef EDMA3_DEBUG. D* g4 L! A, G- d9 T) {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 ^$ f: |, b( N7 U! M5 q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ v b; Q6 ?) y$ k8 B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 {/ H5 `: r5 b* Q( F0 u1 H - #else
# X3 J- T- H+ z4 |4 Y. c) d3 B - #define DMA_PRINTK( x... )
) [5 L. k! G$ W \7 x" W - #define DMA_FN_IN
" O8 ]! ~, o- V# ?! m6 a1 ~ - #define DMA_FN_OUT \) Y2 E. G, l
- #endif
9 B5 z' K" L, T/ _+ H2 g' L, g
' [$ W% `( V& g6 ?3 w+ F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- W. `' w, f9 H! _* I+ L0 a - #define STATIC_SHIFT 3
" }/ k% [* j. W' o8 T - #define TCINTEN_SHIFT 20& @* a' t3 _% q0 J$ K- `8 d. U( ~/ ~
- #define ITCINTEN_SHIFT 21
# l4 @0 Y$ ^; N3 s7 P3 h/ @ - #define TCCHEN_SHIFT 22
0 o4 q/ ]" U y# D5 M - #define ITCCHEN_SHIFT 23. V6 z9 g0 Q* O6 h$ K; [
3 @; _/ y; ?. B, E; [1 v; o- static volatile int irqraised1 = 0;9 z& f6 q6 {1 H) Y3 o2 s/ B- q4 ^
- static volatile int irqraised2 = 0;
3 v% {% s4 ^5 t% z! a, z
) K' M8 x7 o$ H x0 W6 _: f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. r: G! T: }4 [. D: L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) m1 d0 c! ^- S# x0 R1 w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ i8 s2 j! n7 H( ?" I
3 }7 I) Z7 V2 L) V* D/ D3 A& a- dma_addr_t dmaphyssrc1 = 0;1 B; i9 ~3 Q( @6 L
- dma_addr_t dmaphyssrc2 = 0;' _9 ?( T/ d3 v7 W4 J+ h* S2 k
- dma_addr_t dmaphysdest1 = 0;
; b5 b& n/ p1 O+ E - dma_addr_t dmaphysdest2 = 0;
3 ~( m. O# o& ]# N) A
) K9 D0 |& F. e( _1 O- char *dmabufsrc1 = NULL;6 ^8 S* ~) L7 Y# Q' q. k! ~/ W
- char *dmabufsrc2 = NULL;. z) v" m" {1 H( u. b0 ~
- char *dmabufdest1 = NULL;. [9 m8 k9 q, ~- B/ L9 {) V
- char *dmabufdest2 = NULL;
+ h' D1 f) f# X- Z. Z
/ {- ^5 F+ q) k8 `, W0 r- static int acnt = 512;1 y9 h. x1 U; k9 k
- static int bcnt = 8;3 P- q4 b' Q# B4 D2 a1 Z* a
- static int ccnt = 8;
* B! Q. x: Q/ q, y1 w- U+ M; }$ I - * T; }- L: Y# P j) y
- module_param(acnt, int, S_IRUGO);
+ c, M, z5 Z4 v- Z7 |5 w - module_param(bcnt, int, S_IRUGO);
! l: s8 E) ]( K- R% j - module_param(ccnt, int, S_IRUGO);
复制代码 1 _+ i, O9 [& r- W, \4 Q
4 Z7 l& w& F5 v* F u3 o5 _, ^; f8 y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 l7 R2 a2 ?% g' f' ] g$ L) W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. \% N0 p/ ^) d% T; J9 H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; J$ i$ d: B# Y$ ~- C( K j7 |4 w$ S l# u
3 V2 b. e; B' H% Q |
|