|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. l5 m2 h! `" o$ \& ~" x& @+ a4 _, d- [code]EDMA sample test application0 Q* S8 F% x/ o I
- /*' r1 d [6 T9 k4 |4 s$ O
- * edma_test.c
) ?2 Y: p' j0 K% p- I- L* ^ - * U" a2 l* _$ b- s
- * brief EDMA3 Test Application
6 V3 m3 \ Y6 K) t- p8 ^. Z) i$ N3 u - *
/ u$ z- \- @4 Z: Y2 g5 S" X6 e - * This file contains EDMA3 Test code., M7 X* @0 K w/ ^4 R, F8 O7 }5 ]9 j
- *. D' I& O: \" l }# R9 v* D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 ~; R- r0 h5 j/ ]8 d7 Q1 P* s& y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ J0 U6 q( p3 W) Q4 Y* y' y - * TO CHANGE. y! Q3 A3 f8 L! v
- *+ w, w% r P8 E5 Q4 ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- E9 e; W j: u$ l8 g - ** l# e: q$ I \) {
- * This program is free software; you can redistribute it and/or/ v. P- V7 A# B" G
- * modify it under the terms of the GNU General Public License as! E, f {9 ?8 n
- * published by the Free Software Foundation version 2." o9 \/ Q. g& ]# G7 {( c
- *6 l5 `6 Y# @7 {" Y& M' M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 l+ Y+ y8 [) v6 n- k3 `, a
- * kind, whether express or implied; without even the implied warranty
2 C- X4 W1 n3 X; y! d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 H4 K6 w6 w$ E& a, n
- * GNU General Public License for more details.
' }- W; H2 t2 e - */2 @7 w! y2 s. r m D, M; ^
- m# ~3 `) C7 J# d7 e0 Q7 b
- #include <linux/module.h>4 z0 ?% `# w! @8 a7 p3 J3 @8 Q: V
- #include <linux/init.h>' Q+ ^3 m! e+ H7 |/ \
- #include <linux/errno.h>
. ^1 Z) u! @/ E. X' q1 r/ C0 s - #include <linux/types.h>
8 F) ^0 N, R% K1 g! @ - #include <linux/interrupt.h>
0 d L* P, b% u: K# y - #include <asm/io.h>
; z7 w- d, \' Q6 o1 F+ ` - #include <linux/moduleparam.h>
5 _+ T1 S9 r& W X" J - #include <linux/sysctl.h>
5 i; N! ?/ s5 o" ] - #include <linux/mm.h>
! }1 h! n6 k- ~$ t - #include <linux/dma-mapping.h>
+ z1 M: f) e! i; d' l+ n9 w8 y5 a% _ - / {2 Q9 [' P( a9 L8 [
- #include <mach/memory.h>
7 ^4 Z3 B# {- h3 h0 W8 c - #include <mach/hardware.h>
: p9 N4 [/ T/ i3 E1 r; B - #include <mach/irqs.h>0 V1 V7 x7 s( g& g7 y; z& ?* S
- #include <asm/hardware/edma.h>% i% U) o! r! q+ y8 J# ^8 t
- ) Q* k% X- e" R b. j9 _" ]* [' E4 N1 i
- #undef EDMA3_DEBUG8 b; P. W# M ^% ~( |4 h4 |2 j+ w
- /*#define EDMA3_DEBUG*/. O/ |% h8 S! e6 I7 T% h( w
; |4 j. l# G' W5 }' k7 E/ v D- #ifdef EDMA3_DEBUG f' C5 o2 |1 v0 A- f( p- C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! k7 V) ^6 ]& Y5 V. H/ z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 h- Z+ \6 E, J* k# e" k5 J* k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# z: V% S! f% [; J - #else
; o1 _& z2 E* o% N - #define DMA_PRINTK( x... )
( D" t! d" t# F2 G8 z1 | - #define DMA_FN_IN
$ ~. x" z3 C3 I& e: ^ - #define DMA_FN_OUT9 B- ^) i8 W( n1 Z7 A! x
- #endif4 Q9 A4 ^0 S" p
& B, w* f' `7 _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" ^, v0 n9 B. o- h# ^( p" j; J m$ u
- #define STATIC_SHIFT 39 r; u7 l: A% s. c A* A
- #define TCINTEN_SHIFT 20. m# z) {0 v/ ~" f( o
- #define ITCINTEN_SHIFT 21- V. \* R: v! x% D
- #define TCCHEN_SHIFT 22
2 N2 ?! C8 d3 X. d3 z - #define ITCCHEN_SHIFT 23 S) b1 k4 a* o9 H9 C" d
9 E4 D$ n: d# U3 S- static volatile int irqraised1 = 0;" {0 x! v7 K- _
- static volatile int irqraised2 = 0;- h* ?) o6 z! k
8 i, P% c( r! m4 c, A! l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 ~0 |, K% ]* w( j6 N; ]/ @$ Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( u* B# N: ~2 E9 D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 X9 q! J% m% J1 E: a1 b
- k# j/ [) V7 M0 v9 q# E5 G- dma_addr_t dmaphyssrc1 = 0;
2 U* _8 H0 c }0 d0 R - dma_addr_t dmaphyssrc2 = 0;
) l1 p# j8 T6 F% ]5 n0 }0 P6 j - dma_addr_t dmaphysdest1 = 0;3 X5 o2 \6 A2 }4 } h) f
- dma_addr_t dmaphysdest2 = 0;, G1 n( o: P' A7 L6 U+ o# B
8 ~7 q& n/ g5 |, K- char *dmabufsrc1 = NULL; D* V/ i8 }0 J: T- L( f9 |
- char *dmabufsrc2 = NULL;: ?3 Q6 x9 `8 `. j$ E% p1 Y. q# W
- char *dmabufdest1 = NULL;- B4 l [" V/ @) J6 m0 ]& c
- char *dmabufdest2 = NULL;0 { D7 k) j j' L
! u- c" g% x' B( T- G( X" ^* ^- static int acnt = 512;
0 |) S/ L# `" t. G" A) C - static int bcnt = 8;" A: b3 ?! r* I; J/ j) R
- static int ccnt = 8;
. L( w# M" p% h# ?: n( `$ O+ M2 f
/ I4 E& I: Y% W8 O% B8 D- module_param(acnt, int, S_IRUGO);
7 W3 G7 ^$ c" F - module_param(bcnt, int, S_IRUGO);
( i! a" x. a& b; J - module_param(ccnt, int, S_IRUGO);
复制代码 , E" d! t7 f1 y
! [2 j2 E6 J5 w0 Y* N" T' I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* g; x0 z* s2 S9 Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 ?0 v1 H$ L n* q9 G. {7 M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. z4 }$ H0 c* E1 Y
1 Q' U% T, N( `& e; `+ g: Z& W
8 @0 P* H: k2 q |
|