|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 z3 O7 }( H. }- b- [code]EDMA sample test application) m: N' S2 ?) H7 S/ _9 D" I
- /*% b! ~7 T$ v* D6 D7 k6 y7 c
- * edma_test.c! I+ t* w+ Y6 P
- *9 H, A# X* H# `- p' U
- * brief EDMA3 Test Application' N8 D! k3 e# c7 {0 i
- *( d* ]" Z- P$ }5 ]+ C5 p
- * This file contains EDMA3 Test code.
2 N* @3 E1 K `( M0 y& p - *0 S# r5 A% f# k! `: g' U8 R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 |, z5 B; s& o4 x% S" c4 {# ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& j7 p8 I0 B! }, @. a9 s - * TO CHANGE.* A# p6 b( D- a) _+ {+ e
- *6 R: g& z7 X4 ?) t! U# h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ r# f; U3 I; P% ]. D - *6 W- u5 g' ]9 m7 } A- A
- * This program is free software; you can redistribute it and/or7 a8 d4 K( C9 A7 s4 R& R' a0 x; C5 }- A* D
- * modify it under the terms of the GNU General Public License as
O+ S1 ^5 A! x+ V" U - * published by the Free Software Foundation version 2.' I, A' T5 e( _+ z- M" j8 M
- *4 @4 H4 k6 A7 E$ P0 F( @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. n3 A! q# X, E4 N( Q8 r
- * kind, whether express or implied; without even the implied warranty" b$ s! H& z9 e5 A; |, C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 K2 `5 U6 @* c* N+ N$ p; z2 T+ A
- * GNU General Public License for more details.2 g$ C" ?6 }$ x
- *// z v+ P% }8 @9 i5 J8 `6 V
- 7 D; H: E5 o4 C( R5 n# T
- #include <linux/module.h>& x6 o+ {7 ?0 f; \6 c
- #include <linux/init.h>) U* E) J/ m# S4 z% W. e: u
- #include <linux/errno.h>' I3 K9 [9 d& x& x
- #include <linux/types.h>) S+ M7 R; i# Y' G
- #include <linux/interrupt.h>
{3 f, e* T1 d$ O. k% c - #include <asm/io.h>
1 A6 q i& W; ?6 F( l - #include <linux/moduleparam.h>
" O0 V* k; o* f+ O5 l - #include <linux/sysctl.h>
* |7 N+ s) u/ _# T- B3 ~ - #include <linux/mm.h> b+ t h4 D5 V# L
- #include <linux/dma-mapping.h>4 Q; e- `) O- Y z! u4 h# E
- & E- C- V4 ^' ^4 @, V) X7 ~$ w
- #include <mach/memory.h>
3 A$ O4 B. Y1 ?+ }! D - #include <mach/hardware.h>
/ ^# U) w3 n" M, b% _ - #include <mach/irqs.h>- j) r$ k" d" P3 P7 F9 k, ?
- #include <asm/hardware/edma.h>
8 k* x9 v6 B" D) @2 f - 8 O3 }( e. A+ V0 I
- #undef EDMA3_DEBUG3 S" n9 D9 v* V# i5 z/ O1 B
- /*#define EDMA3_DEBUG*/% d4 |1 z2 b7 n5 P% i
" j+ [/ d2 u1 w4 q0 Q- #ifdef EDMA3_DEBUG4 U$ \! F- a! e( y) Y- m* ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 [: t7 I* z4 h/ a. |9 v5 ^/ \* h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 L, |6 F- `% D1 K7 x& r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. R; }# a& u% e' k" [1 n - #else
( _/ b) r. O. i1 \, `7 V v9 A - #define DMA_PRINTK( x... )4 ~3 R, X( r; e7 i" Q7 Z& p
- #define DMA_FN_IN
7 E0 J/ J# @; G& X( k i; ^+ q& A - #define DMA_FN_OUT+ {, c4 N) K8 j+ g0 T) h
- #endif. J& n# ?8 ]) ?# i' L$ E' T; b
- . W( _" H$ r- ~% l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& \1 s5 R' M$ Q4 s) Z8 Y5 W; P$ s
- #define STATIC_SHIFT 30 f- u2 Q# T! _( [! Q: P9 _, C" F1 r
- #define TCINTEN_SHIFT 20+ h: F' p+ Z& l* p+ k/ ~
- #define ITCINTEN_SHIFT 21
' f* f2 t- f5 d; d# w - #define TCCHEN_SHIFT 22
3 m5 J* W; \2 m4 T - #define ITCCHEN_SHIFT 233 j3 j8 u# A. `
. X' U. { Q, o. z, l6 t& Z! u/ n" c- static volatile int irqraised1 = 0;
. m I4 P9 k( f# r/ K - static volatile int irqraised2 = 0;
; O5 ?( M) |) x9 H - - j) E n$ o4 o5 T( `9 F! @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 }- s2 V) E6 X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. l( L4 ~1 U- S R7 H; k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, z6 N4 D$ _# g6 J& I
; x) g: `* d+ x- dma_addr_t dmaphyssrc1 = 0;- ~; `! u- [+ r4 B8 m$ ^; [
- dma_addr_t dmaphyssrc2 = 0;% H) b" u* V. o# Q- t2 H1 k
- dma_addr_t dmaphysdest1 = 0;( I- c- z- b7 x0 D2 h
- dma_addr_t dmaphysdest2 = 0;
1 G! d: \! y" ?7 v8 Z0 K6 R0 d. g
, ] x# N( ?0 p: O- char *dmabufsrc1 = NULL;: R2 S" K5 w, d# B3 h( J
- char *dmabufsrc2 = NULL;
# p( Y4 v: S& B9 M5 `# | - char *dmabufdest1 = NULL;+ B; ^* g- \6 `4 o
- char *dmabufdest2 = NULL;
; |# z; E0 B, `" ]4 C6 `, X - : C( _, b7 K+ y/ t m
- static int acnt = 512;( J& p8 s, Q, b
- static int bcnt = 8;
3 H8 T" m# n& _7 m - static int ccnt = 8;
9 Z! `' G ]8 t# C- c, p
: w# }# G6 |# R- module_param(acnt, int, S_IRUGO);
$ J* x# t& z4 [3 o - module_param(bcnt, int, S_IRUGO);
9 t% }2 V9 c4 v# ]* v- \% D - module_param(ccnt, int, S_IRUGO);
复制代码 ! w: d1 A4 P3 B3 S1 V$ z9 B& G- ]
8 a$ c- i, S7 k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 ]7 ^+ f4 R2 N5 V: v' b5 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; F: N' w! w' Q+ e: } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 x1 h5 W* g$ ^+ p8 U
& q* X5 K3 @- n
( L" w. l H: ^6 F" W6 K/ D |
|