|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ @ F' ]$ \1 v6 `; e0 s5 _- [code]EDMA sample test application
4 j0 c: N9 f6 {# f0 V0 l+ _( E1 ? - /*
+ A* M# X0 c8 R. f5 `+ I - * edma_test.c# r8 M+ U0 z% A; h/ ?6 C H
- *
$ S$ S1 j- S2 A# T/ Q% W" u - * brief EDMA3 Test Application) N g5 z7 Z! w! U
- *
+ v# `: k: ^% J/ I4 |7 {& Q - * This file contains EDMA3 Test code.
4 B; T% v+ |: f - *
. b% G$ Q$ ~% p/ W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 }( [! k5 ~' {' @9 k. b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' W& |# p" a( ]& E# \ - * TO CHANGE.
; E0 |! s' B9 i - *9 d/ V0 z; J; d; x0 F9 Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 w2 b; }* u- w" Y- R: ?) T$ F" J - *
7 X; u' d4 @7 e/ g% \ @ - * This program is free software; you can redistribute it and/or7 L/ ?2 o: N$ F* }( `! V
- * modify it under the terms of the GNU General Public License as$ X) g0 M; \( a5 i! x
- * published by the Free Software Foundation version 2.% `0 @! _- k% O7 g' M( K" Y
- *) y- }0 l9 I! u! R1 O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) W# V2 U6 i. L9 Z1 \ - * kind, whether express or implied; without even the implied warranty
0 K6 t4 I; ~4 \) v+ ^" J8 z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ v& e- A: C' @; t$ w - * GNU General Public License for more details.
2 }) r! M8 n: Y$ ^ - */; I3 X5 X H( n9 R. t4 V
- W0 i3 g1 L9 z) g9 D+ r' ~- #include <linux/module.h>
$ {: s% `5 o7 v+ o+ Z- @ - #include <linux/init.h>
- x3 i) {7 A( |+ }/ i: x% E, ? - #include <linux/errno.h>; c; U9 A" k1 s. L( Q8 ]
- #include <linux/types.h>- y4 F+ e& N( x9 N1 w- |
- #include <linux/interrupt.h>: P$ B Z# \' W/ l) _& a6 g/ i
- #include <asm/io.h>
+ |+ |/ T _4 u; c; B: M - #include <linux/moduleparam.h>
: x. t7 |, G+ {5 a! s) A& j3 z - #include <linux/sysctl.h>- `6 o2 p, `- z$ D. [
- #include <linux/mm.h>
( o; b, V; a# j' a+ ^0 Y - #include <linux/dma-mapping.h>1 x) h6 W% [" k# ]' u1 P% M
* P9 V% ~& r5 {* a, E2 K- #include <mach/memory.h>
2 ]7 \0 L) \! J2 ^' u - #include <mach/hardware.h>
! C9 u# [# }+ J# O7 i( t$ m - #include <mach/irqs.h>
Y; y# c' B/ |- I' Y3 q9 p! s - #include <asm/hardware/edma.h>
3 t6 R! B ~1 k8 n% C. @
) M) g6 K* o" {: r" M- #undef EDMA3_DEBUG* [. e$ L7 T% t% M' H
- /*#define EDMA3_DEBUG*/ O" `( L' F/ h0 I/ k
( s1 d4 X- ~8 | x/ o" v- c- #ifdef EDMA3_DEBUG) o1 Y: T0 X$ Y, p8 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- S( \# q" f0 i! S" p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 A |; N1 e( z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 V V8 r/ _6 _* l
- #else( |4 r* X( m4 }8 G
- #define DMA_PRINTK( x... ); K) e w* r9 p. [/ c; t. x; f
- #define DMA_FN_IN5 S, G( ^* j& E. u( S' U
- #define DMA_FN_OUT+ ^+ p* ^+ I0 V2 }
- #endif
3 \: k2 ~4 u9 V# p' C- F2 Z. x - ! E8 E% C5 R5 L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* E& _- Q$ p+ i: E3 r; m; ]$ N - #define STATIC_SHIFT 37 @0 b8 H) O: R/ e
- #define TCINTEN_SHIFT 20
. A+ @9 y6 m+ [3 q8 V - #define ITCINTEN_SHIFT 21% \+ O2 n8 p Y5 K! S) I
- #define TCCHEN_SHIFT 22
( Y$ j1 t" f3 ^ C9 w4 L [ - #define ITCCHEN_SHIFT 23
$ {, v, b6 X; H! A. C$ s; z
1 \1 T8 d/ a' e' o- static volatile int irqraised1 = 0;2 U) W2 m- }0 U- N. q
- static volatile int irqraised2 = 0;
' I9 }2 N# n7 g- o" Z% P - : Z# ]( @7 e4 r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 R5 j2 @4 d0 S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; v3 \# {; M* e3 \) [% ~" J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( C8 i% c' a. R
% K# E+ i! S! |- w- O3 u8 J- dma_addr_t dmaphyssrc1 = 0;; g+ v6 z9 a5 q6 E) ^
- dma_addr_t dmaphyssrc2 = 0;7 s2 @* r0 }3 E3 \; i. x
- dma_addr_t dmaphysdest1 = 0;
. ^2 O" I& ^) W% ~ - dma_addr_t dmaphysdest2 = 0;
( d7 w- B1 _0 H3 C
" W8 }5 c# i+ o- `- char *dmabufsrc1 = NULL;
% P! }- G1 @6 t- U - char *dmabufsrc2 = NULL;0 ^& k+ ?# z% k5 o
- char *dmabufdest1 = NULL;
) Q# w) L% l9 \8 K8 D: w - char *dmabufdest2 = NULL;
+ Q# h# ?2 j, y6 a8 V* f - # J+ h- w/ y3 n+ F0 S
- static int acnt = 512;
: E. @% b) z3 p0 R% F6 v; | - static int bcnt = 8;4 ?. |! i( i x
- static int ccnt = 8;: t% c" r- O7 U4 c$ k) k6 v. o
7 \$ p8 o" U1 g# b, p3 D* ^% i- module_param(acnt, int, S_IRUGO);
9 h/ E$ k' u6 P9 I* Y) F% d - module_param(bcnt, int, S_IRUGO);# _* f# V& ~8 d8 E8 N9 v
- module_param(ccnt, int, S_IRUGO);
复制代码 & F& B, l$ k8 z% J; N
/ t3 M# ?; k$ m: a. B: \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 A1 V% s2 P8 G! X+ b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 i! { h. i) o' P. b/ e& [1 L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# z0 V: l s; I y% D
- ]' ~2 v; f# N6 W v v' w# w
* A3 J/ X3 }6 U9 m9 N% W5 m u; A |
|