|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 ^: r6 S2 b6 A$ D3 T- a- [code]EDMA sample test application9 W! w* o- W7 A/ X/ A
- /*
+ B$ q' L8 ?4 c* H - * edma_test.c6 _* G7 k/ S" E
- *6 ~' }5 ?+ l" l: E2 U
- * brief EDMA3 Test Application8 `5 g- X) Y) x1 O3 U7 w9 z; @
- *
+ @* `$ v. \ z0 M3 T$ l. e - * This file contains EDMA3 Test code.4 ]' M, c! I6 n! B' t3 P% N
- *
4 b+ }+ ]4 M) A, K+ m0 A0 @; Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 `) L7 b( ]% c5 b6 u' \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' r% Q3 _% K" _- @7 X& n - * TO CHANGE.
) R* J( j5 Y/ { - *
0 ?9 N8 R" n* x) L& l* V1 F! I4 S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 y* C0 d w2 |; _9 o1 x
- *
' S, b6 I0 F$ L) L - * This program is free software; you can redistribute it and/or
6 W* \9 m& y5 X4 W) V5 f - * modify it under the terms of the GNU General Public License as
A; e D. J3 {* O - * published by the Free Software Foundation version 2.% D' b( m9 X0 z# ^/ E3 H8 o$ k
- *- d: W/ x2 o f+ a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 w4 l5 m2 Y/ z! q - * kind, whether express or implied; without even the implied warranty1 E; F! ?8 B) }* l# H9 B: ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 |4 H5 T, {, B+ O7 D6 l- h - * GNU General Public License for more details.0 k2 b* R8 D" E/ N
- */2 h- `% a' n% o! o6 w. \
- / R5 T& ]6 w7 n& y
- #include <linux/module.h>
" f& N% p4 d" N0 v - #include <linux/init.h>3 S1 A u' l% X1 x
- #include <linux/errno.h>
1 V2 i' a& }4 A0 w9 `% f; e- k4 G: ` - #include <linux/types.h>
" e/ E0 z- u6 f: _ - #include <linux/interrupt.h>
3 ^ @, p+ S; ?3 M) J2 l - #include <asm/io.h>
" p/ k! m8 e K5 Q+ Y- \2 k2 t - #include <linux/moduleparam.h>
2 p9 M7 M( a. j4 v8 x* ^ - #include <linux/sysctl.h>
' v/ d* f" k/ B& y3 S - #include <linux/mm.h>
* ?( {( T9 ]0 `1 E6 |" B" M - #include <linux/dma-mapping.h>* f6 C9 L# j: d& h5 _5 D, L
. X8 s) b" I; k3 L* ?- #include <mach/memory.h>
+ y* h; G9 a$ ]8 ^) V - #include <mach/hardware.h>9 d. g. u9 m! N6 O% Q% W/ {' V
- #include <mach/irqs.h>
- F2 |: [' q' o+ J& @ - #include <asm/hardware/edma.h>
* H* r( w" h9 V0 @* ~
( ?/ ]; _" l- x- #undef EDMA3_DEBUG
3 ^/ m8 G5 Z6 L1 }5 l6 c - /*#define EDMA3_DEBUG*/
7 P e5 ]# Y3 l4 S& [6 }2 ?
! q3 G' @9 e) E* F- j. g$ |0 K- #ifdef EDMA3_DEBUG
* n$ q' m: Y% D' x. w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 Z1 D- e5 F# W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 H4 W( s' J' j, {* A2 @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( c6 ^& }) q, u/ R/ f* b - #else( O" f/ f3 W+ K7 R. J' F; Y, X( G
- #define DMA_PRINTK( x... )) t; [& u0 q+ h2 o0 N" D( u
- #define DMA_FN_IN
/ C4 j$ J3 Z) t; _5 _ - #define DMA_FN_OUT! E6 X( D8 U* {! T. j' t
- #endif7 J( I' w- e: d- W, ?- H
' x( J2 ^4 c: A$ J$ {) s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 q4 p G) W4 k; C - #define STATIC_SHIFT 3
$ V0 B+ J; ^5 I; I - #define TCINTEN_SHIFT 20
1 ?9 ?7 v; y0 p; c1 z7 W; W - #define ITCINTEN_SHIFT 21
1 N: `2 ]6 W" p8 v# [9 ^ - #define TCCHEN_SHIFT 22
& a6 N! k: Q6 g; n0 t' j& l0 }; X7 x5 { - #define ITCCHEN_SHIFT 23
! w/ d. S P1 G7 q5 M6 k
6 i6 X' q1 e) F( {- static volatile int irqraised1 = 0;
4 m9 p- @2 Y$ Y6 c0 g) {; p- l0 x - static volatile int irqraised2 = 0;6 e0 @. r- g$ d1 j; s, B7 @5 F
1 n; \" e) D8 }+ x. R/ R+ Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 D# ^5 T& l/ w6 R$ j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. M b/ g3 V3 e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; M; J6 r' j9 q. K: }; F - 3 n/ A9 }) M' M- m8 x, c# G- s
- dma_addr_t dmaphyssrc1 = 0;4 R( P& W/ N- C6 Q, H# F
- dma_addr_t dmaphyssrc2 = 0;) ]% L% M$ S; x" W% M
- dma_addr_t dmaphysdest1 = 0; W& M' D6 |6 W7 W
- dma_addr_t dmaphysdest2 = 0;! N1 b% k# n8 J* H3 E! i3 T
: o; ?; l7 R8 T# s- char *dmabufsrc1 = NULL;
6 ?. E( O) h6 n* M - char *dmabufsrc2 = NULL;
+ h/ e e+ i& U9 ]( ~9 l/ w- ~# y - char *dmabufdest1 = NULL;
/ m @$ j) {' I/ w4 E - char *dmabufdest2 = NULL;+ N/ |7 z& v: l
6 N9 Q7 L5 s, c& N+ s3 V0 v9 z- static int acnt = 512;8 ~( i! ~8 }: {: m' q" c
- static int bcnt = 8;- [! C: `+ c m
- static int ccnt = 8;- q8 v3 s+ t' ]& W
- 1 g3 D, s; e7 Y6 o
- module_param(acnt, int, S_IRUGO);1 G% l+ V4 h7 M2 ?$ j: z$ t
- module_param(bcnt, int, S_IRUGO);3 I- |* u6 x$ p. W5 p! @1 ~3 `
- module_param(ccnt, int, S_IRUGO);
复制代码
# f. }$ S% f, ?2 R; C
@3 p" D c8 ~ b. j3 h% I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 _* Q* e' X" H8 f+ f% }) z- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ s* n1 r4 C/ H5 U3 p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 H5 L3 O" e9 ]# `' s
D: x! T( @, h; |
. ?! G4 j& L7 p5 C4 u# `$ \& a+ | |
|