|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ U0 i0 f" }$ B7 Z0 a2 n* I2 k+ W
- [code]EDMA sample test application
5 l& O7 O4 T+ @7 P4 _ - /*2 a3 ?8 I6 Z5 v% E1 x; d
- * edma_test.c& w9 \9 h& j8 K+ n: J
- *
. {' b5 o5 |! H, f: b( u - * brief EDMA3 Test Application2 z5 q' {' b( u' H
- *
7 S& |" ~. }! X( T2 O3 Z, I: G }7 D8 Y - * This file contains EDMA3 Test code.# v' L$ I1 `/ A% Y: R9 b6 y: B
- *; X* Z8 B: m9 _, c; g* Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ s( t- ]4 m8 k0 q% H$ t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 ~; p" ]7 V: L0 ~ - * TO CHANGE.
& u/ {" J, n, ]# [0 {' [! n8 Y - *; {- D! G6 J- k" @ y% Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: u" x8 ]# V. S+ [* Q - *+ J6 t. u4 f9 [" y
- * This program is free software; you can redistribute it and/or+ u6 z3 {1 Q. G% k$ X v7 e; _) J k
- * modify it under the terms of the GNU General Public License as
( e% c- P) z# u+ Q; Z3 _ - * published by the Free Software Foundation version 2.
. ?4 U/ n& P) {3 p# C/ t - *6 ~8 G4 E: k8 s$ ~$ m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: o1 r& t9 t# i' r - * kind, whether express or implied; without even the implied warranty( z6 d' |2 [3 f& c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 f% S" f$ {4 }% W' { - * GNU General Public License for more details.
0 c( M8 k7 N5 a7 P1 ` - */& o" [7 E7 ]8 B4 t5 ?7 [. E
6 r/ F* w4 w( ^9 d) v# |* s3 a* ~- #include <linux/module.h>" N7 r' R$ W: Y- L9 _
- #include <linux/init.h>
# D0 ~( l* N z1 ^! n7 A+ E' H2 u J5 k - #include <linux/errno.h>
8 c5 P2 z3 ?" N' j. q - #include <linux/types.h>
7 [- O% u% F U1 M, V - #include <linux/interrupt.h>
- h, @* }5 N8 ^; Y6 t6 e: I - #include <asm/io.h>
. W4 ?! ?6 m* c. _7 q0 S$ | - #include <linux/moduleparam.h>: a" n8 N: s4 C0 T# i
- #include <linux/sysctl.h># j. X, D) J4 m
- #include <linux/mm.h>1 m- B4 o/ o+ M# g/ }1 U
- #include <linux/dma-mapping.h>* L' _7 l2 s; X# N! J2 H0 c$ d% F
- ( D( z1 l/ Z* Z
- #include <mach/memory.h>
2 _) P* {) x% U) N5 T3 g1 D - #include <mach/hardware.h>9 g2 a7 p8 o. j. Q' k
- #include <mach/irqs.h>9 k2 b \+ B2 q& u
- #include <asm/hardware/edma.h>$ N# B7 f' b1 \- j
- 6 r8 b1 }# \* z- f4 q1 C& J* G
- #undef EDMA3_DEBUG; p J. x1 T. G9 G/ ^
- /*#define EDMA3_DEBUG*/* O" l. ]3 W) v2 V
- 3 N) c. E4 s- _: z4 e5 V! I; D
- #ifdef EDMA3_DEBUG
9 H% O" N" _5 D* y V9 n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! k* O* j$ \ g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 u! }; d! J: r3 ^* H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* {4 B" ]: s4 t6 R - #else
' G8 b5 Z4 u. Q' Z* w8 l - #define DMA_PRINTK( x... )9 Z# b, P- Y }
- #define DMA_FN_IN
( L1 P9 k6 @" D# ]4 v6 z - #define DMA_FN_OUT
4 ?" I( m2 d1 K9 E( ^" K& H; \3 [2 B% S - #endif
# R# X {4 l( a$ M# y - # P' P' v: w& i" N/ T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
`. Q! J% ` @$ L% M1 \1 b - #define STATIC_SHIFT 37 {1 f4 a& Y5 o& {6 l5 u
- #define TCINTEN_SHIFT 20
1 j- m: p# r5 w - #define ITCINTEN_SHIFT 21
: z2 M* j- i M8 J+ B' ^* _* j+ Q - #define TCCHEN_SHIFT 229 l6 i# ?$ J2 w% g. Q; O& M
- #define ITCCHEN_SHIFT 237 ^: B1 c4 r# b! J
- 4 j8 n# i2 S5 x: J/ G
- static volatile int irqraised1 = 0;
6 b& u) Q& ]# ]# Q - static volatile int irqraised2 = 0;+ I8 L2 L7 F* J
4 [5 a9 V* B7 Y, C4 d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); W2 F9 \. |$ y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) }1 T: ?+ I2 W5 w" y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 M3 o6 @& j8 e$ S5 v; D1 l$ ?
) c$ K$ m1 R3 E/ H- dma_addr_t dmaphyssrc1 = 0;
* `3 b4 k" i$ q" _: w - dma_addr_t dmaphyssrc2 = 0;) i: `! o4 k: X! i- w" w
- dma_addr_t dmaphysdest1 = 0;4 F7 z/ W/ f k. N
- dma_addr_t dmaphysdest2 = 0;
8 F+ {! v$ t/ d7 R; o% u
! S `; I8 E8 ^: z5 h( y- char *dmabufsrc1 = NULL;! W2 y: ^9 \+ M4 G
- char *dmabufsrc2 = NULL;9 [9 P; v8 k: U% u
- char *dmabufdest1 = NULL;- p8 F/ a7 i: v" Y
- char *dmabufdest2 = NULL;
( k0 u8 B0 i5 s3 h. o$ p' P/ l
: ~1 Z, D8 a2 f! j9 g b- static int acnt = 512;
! \, @8 A+ e9 Z" ? - static int bcnt = 8;/ v- L) H" k/ m* _! r6 t. @' }0 }& B
- static int ccnt = 8;
: n! Y# z" W' ]7 }" Z
' w8 H3 y8 A' |, S6 d& G- module_param(acnt, int, S_IRUGO);0 l, U! Z$ l# G& L2 q
- module_param(bcnt, int, S_IRUGO);
: b6 {9 b) p1 \ g7 e - module_param(ccnt, int, S_IRUGO);
复制代码 4 E* V5 _/ |0 f5 l
# a1 y! X: ]& p" `' ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 J5 Q: g# B2 K& t$ X: h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* n6 ~. V. q; D* r6 [) Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* Y; @! ~# E! X c9 z# Y m5 E5 T
" t+ c- E# H: d# L |
|