|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # T, r. [* D( |; g
- [code]EDMA sample test application
' q: g; t8 D2 |, b! g4 I1 Y - /*
" J' O6 w3 v( u/ B9 w7 g - * edma_test.c+ x: h5 K% ?1 U% Q! x8 B
- *! v; {1 B3 Z9 R% ?9 [5 q
- * brief EDMA3 Test Application
! o+ M- d. Z! { - *
9 c0 c0 b: Q2 |& T) t - * This file contains EDMA3 Test code.
: ~1 ^ H( i2 R/ I& |4 F - *2 i2 F$ Y" n) k( _! ]" t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 ]( m# H+ g# [/ S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 L( u; a9 G2 E, I" k5 @0 u
- * TO CHANGE.4 @8 _- I8 _ M" i9 T& e+ s
- *
; z# r. d& [& t4 ]8 b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 r9 X6 \* [: _0 l2 Q* M* ^. E5 z
- *
4 t, u! F& j# K. r6 R# W0 |1 r' p - * This program is free software; you can redistribute it and/or
3 i( s6 }& b* `5 s0 U - * modify it under the terms of the GNU General Public License as
% \) K2 k9 p l b' @4 `& [ - * published by the Free Software Foundation version 2.
) Q: J6 q, l. K G2 P- L: q - *
8 {( l" R8 _( ?. ?: Z- X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# y1 `8 g W P6 U: u/ N& X4 p
- * kind, whether express or implied; without even the implied warranty
/ }( S4 S! r9 E3 I5 P5 g6 ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 ?" H- }! W5 L3 k7 p
- * GNU General Public License for more details.
7 [; j3 x6 S- Q6 k3 R8 ? - */
2 T; c: z: [ \, g - * F" }8 l: Z! n' k+ [" E7 u9 Q
- #include <linux/module.h>
$ O0 Y+ W4 {5 ^% E+ \, N- ` - #include <linux/init.h>
. N/ F4 G+ \! w/ `( g - #include <linux/errno.h>
7 b/ N7 S, |* i$ ^$ `: \ - #include <linux/types.h>1 Q% T9 E/ U5 M, [
- #include <linux/interrupt.h>
8 @7 P+ L R2 _3 n ^ - #include <asm/io.h>! m4 |- d) t; `- h
- #include <linux/moduleparam.h>
c- O7 P+ M+ Q; b7 E5 ^/ ` - #include <linux/sysctl.h>
$ ^# Q% ?+ ~# ~ - #include <linux/mm.h>, f) y) ^# J! f$ G4 O# i; v
- #include <linux/dma-mapping.h>
- F; ~" y* I; M2 o) d7 d% T" } - 2 Y& b4 }5 _1 [* w
- #include <mach/memory.h>' @* u. m' M, z$ \ u
- #include <mach/hardware.h>; E" H- B- b4 V9 _
- #include <mach/irqs.h> a1 k. H# b1 U1 b% V) q8 k
- #include <asm/hardware/edma.h>
& q I1 U1 w/ D - C/ e5 y; k1 g
- #undef EDMA3_DEBUG
: N# r) ?1 ^; C - /*#define EDMA3_DEBUG*/
$ d* M' ^4 y5 y7 m; h$ M - ; A+ T4 x. l8 b2 U$ X7 ?3 W
- #ifdef EDMA3_DEBUG
& t. _7 m* U$ n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 d9 s" N4 s: c8 B( b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% E8 J3 X3 T) J2 e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ ~* y' `6 R; }6 Z* d% L+ G - #else" `" ^8 M9 J* _2 \7 {$ ] H$ i5 ], h
- #define DMA_PRINTK( x... )& L" g4 H% m1 @. _3 P4 ^4 B2 k
- #define DMA_FN_IN& g3 x: C& B* y5 w/ h, b
- #define DMA_FN_OUT
; v" }2 ?- V/ D2 G - #endif5 e9 m# N# \, s
Y3 M' K9 v7 K* o1 u9 g9 m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% B8 ?8 N7 S: D! a9 @$ y
- #define STATIC_SHIFT 3( `" ~% K* v# `0 z! `
- #define TCINTEN_SHIFT 20
: I3 q; ] J! { - #define ITCINTEN_SHIFT 21
+ |1 K$ X7 y b3 S$ V - #define TCCHEN_SHIFT 22* t* G7 e6 b8 k8 J- k
- #define ITCCHEN_SHIFT 231 t" w8 J1 B% l6 p- y6 y5 p
9 B. q0 |" J* L2 d, N; k- static volatile int irqraised1 = 0;- W9 y! K/ f8 M8 K/ i9 {+ X/ O7 y
- static volatile int irqraised2 = 0;# h# w+ j& Q3 D# t0 p) g: v' q
- 7 y, J0 x4 D* V- s% }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 K2 U1 R4 g+ x& J4 [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ~% J1 O( S3 l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; y- F+ u ~4 k( h9 J3 R3 v
- : J' z4 W( F) ?' }
- dma_addr_t dmaphyssrc1 = 0;
, z$ I4 ^+ @" Y& d; j - dma_addr_t dmaphyssrc2 = 0;2 S/ c; |9 K2 f% s4 Y
- dma_addr_t dmaphysdest1 = 0;8 t1 C5 p3 m6 c1 \: W5 c
- dma_addr_t dmaphysdest2 = 0;0 O5 w% z4 G- @+ Q6 ?( y
- % f/ I( f6 r% T# |9 [
- char *dmabufsrc1 = NULL;
: I9 k, `8 Z B; U% g - char *dmabufsrc2 = NULL;
: x: k8 R$ e3 L" n" q - char *dmabufdest1 = NULL;; M( _. S$ f# b& v4 C7 D" F! m0 r
- char *dmabufdest2 = NULL;
X( M6 V$ [# C' c( y5 O, {/ ~8 K - , }+ F" F9 S. Z/ v
- static int acnt = 512;) m m. k) w H. j4 M: ?2 Y+ B1 F9 D5 [
- static int bcnt = 8;
, t# m; ]; Y" ]6 b' L2 o& d+ [$ X - static int ccnt = 8;
; K$ E5 ?# P f7 c - 6 ^) V0 T# `: g& U
- module_param(acnt, int, S_IRUGO);5 c& W7 X# E; t1 G. ` m8 \0 x
- module_param(bcnt, int, S_IRUGO);
) I/ @/ V- M$ S. M4 A - module_param(ccnt, int, S_IRUGO);
复制代码 1 y! p1 ]' t6 U Y; P
8 G! l% p6 P2 P- ~# \1 Q4 R) f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 u- |5 \. N. n* t# p$ o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 N6 ?- X/ O4 t2 E7 c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ {* w b* G4 [" i* P9 b; |
( M4 L6 \6 K+ I2 h4 D) F
1 X& \9 u8 Q. Q$ j e5 _
|
|