|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 f3 g; A% a0 e- [code]EDMA sample test application6 Y' ] A O: q5 E- w+ W
- /*
: Y1 R! A7 C: a( z - * edma_test.c4 e0 L0 M; w- d i% Z! i
- *
& a) J% x' F, w& Q4 H - * brief EDMA3 Test Application2 k! ?) }% w2 m! f3 W! I. t
- *0 b' v4 A* Q& p
- * This file contains EDMA3 Test code." E1 j d& R4 L/ U
- *- E0 e7 d" z( W" t# k" k' Q4 z8 w; Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ [ p! `' h. v, G0 j- _# A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
m3 `' w, X5 F6 u: ` - * TO CHANGE.* W: v9 g; {% s K" Z' M' M
- *6 D# {0 l, S0 v. `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, c* a2 [& F2 B% Z
- *: W% T% i/ L. }5 d
- * This program is free software; you can redistribute it and/or0 ]: @4 H& G A' N8 b
- * modify it under the terms of the GNU General Public License as" d/ _- W' ]- b' {
- * published by the Free Software Foundation version 2.
8 k- j& O k7 \ s& A. D - *
1 A* j$ Z# \) ~* n5 C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. B6 s( y4 O) k0 c9 k# L2 n - * kind, whether express or implied; without even the implied warranty& R" \3 g; u. f' ]5 Y: a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 f/ p4 A/ h2 H - * GNU General Public License for more details.
9 K3 d; V$ }8 e# E, C4 O - */
$ G# r8 e% r- n3 p - 6 |& j3 Y7 p0 s/ V
- #include <linux/module.h>
6 \6 \: e9 I& i" n' _ - #include <linux/init.h>
- }( a( L, V. L* D" I" G5 l( d, T, Q - #include <linux/errno.h>
$ V1 a* y" }+ q0 `: j4 L - #include <linux/types.h>2 [' p( z) D% ]1 o5 J
- #include <linux/interrupt.h>7 Y* V _9 u/ N d' w) u
- #include <asm/io.h>4 x; l' F2 @" q% Q9 c( j7 C
- #include <linux/moduleparam.h>
0 u! j+ B- _. B1 f& t. K; G! } - #include <linux/sysctl.h>( n9 N5 d) y. E S
- #include <linux/mm.h>
# I1 u3 G% T+ L: D8 g - #include <linux/dma-mapping.h>: ~0 e& E9 }) u- \" }" Z" @
- ) ]. L6 j* \: W: N1 D: s$ L
- #include <mach/memory.h> e" O7 J. Q) q3 A6 x' Y: X0 h
- #include <mach/hardware.h>0 ?9 {4 K* S+ `# V
- #include <mach/irqs.h>8 Z! d% S) V* b) P
- #include <asm/hardware/edma.h>
$ g; Y c7 R5 |9 l) _# D - 3 k( X- F' y: [. R1 H" @. B- e
- #undef EDMA3_DEBUG
; x0 @% S3 a! S4 ]/ u. x - /*#define EDMA3_DEBUG*/
5 O, a; w3 X, d; V - 0 C2 g5 |. }. ]8 D
- #ifdef EDMA3_DEBUG
6 J, H. m9 {/ p' a* J& t k7 | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 F3 p2 K# U6 E3 \( m# Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). _& V E7 w5 _; P/ |5 N1 c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 d1 }% \8 _; G8 {9 }* H& V
- #else
: g2 K0 W7 J/ ]$ C# @9 q9 w - #define DMA_PRINTK( x... )
: C$ L/ f% r7 y5 @* k( Z - #define DMA_FN_IN. J6 g! f1 U/ Y1 H$ V+ I# W
- #define DMA_FN_OUT
" d. h$ U) r& V5 \4 f% Q. I - #endif, D1 j7 P# c" `
- - U5 c; | E0 ]) B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ U# @6 U+ E& p- ~' o* p7 i
- #define STATIC_SHIFT 3
8 _$ L. S7 a7 G1 d- `- S; T4 g - #define TCINTEN_SHIFT 20
+ D @" U- i- Q0 r8 q - #define ITCINTEN_SHIFT 21
7 S. m7 H8 i$ E1 `0 j - #define TCCHEN_SHIFT 22+ L9 q3 b$ Z& V
- #define ITCCHEN_SHIFT 23
+ c; e/ x3 S" Q& Y# l2 M - - E' _3 M& p$ m" K1 T2 g9 v
- static volatile int irqraised1 = 0;
$ S# h7 @$ S; Z$ D% A7 ] - static volatile int irqraised2 = 0;
/ B* N, U; t4 h- w0 u. k2 w - % A$ V% h. X) t. ?! R7 q5 c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 @& h, {' E8 x( `7 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 V* r% f7 I: X. h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ^# B8 m( ~0 E4 z+ {" e# t- n
- * k1 {# J$ }5 X- k/ m
- dma_addr_t dmaphyssrc1 = 0;# i7 @0 T9 }, v3 u
- dma_addr_t dmaphyssrc2 = 0;
9 ?1 B! K8 i8 S# z! \ - dma_addr_t dmaphysdest1 = 0;
( F! |) [$ [! q - dma_addr_t dmaphysdest2 = 0;
8 r( ^1 ]( ]( G: F - 7 z3 F Y/ n/ a$ Q- t- k
- char *dmabufsrc1 = NULL;! D' G$ c& h8 z9 C3 R; g
- char *dmabufsrc2 = NULL;; I5 `% `; W& c6 A) Y' Z
- char *dmabufdest1 = NULL;; u7 T# } Q. N' A
- char *dmabufdest2 = NULL;$ H- ?* |1 ~+ [, Z- Y/ G. h
+ N. V* `+ k, e1 ^. b% @4 `- M" Z4 r# y- static int acnt = 512;; d5 `* `6 V( B' h. |
- static int bcnt = 8;, e" P! Y6 g9 ~+ L- v
- static int ccnt = 8;& s* t4 N7 n7 a0 A1 n# E
- ! x; `2 t. E: Z* [5 }/ h9 m' s, V
- module_param(acnt, int, S_IRUGO);
: l6 P1 P; W* ?* U( S- c - module_param(bcnt, int, S_IRUGO);& N9 s0 V; { ^. v! t$ A
- module_param(ccnt, int, S_IRUGO);
复制代码 3 [- Q8 a: [- v) l) K1 r( Y: I
# R1 Y9 |- u$ |7 F/ W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" _6 }& L* w4 l7 z5 W* y$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 \+ H( L2 y E! s0 t. X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 ~7 L: T5 Y# w3 B; Z" G6 |) w7 _, D4 e' h @) D+ J* l1 X' S j
3 {* F {: w) p" }7 b8 I# ] |
|