|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 O) A; A! X# E$ @- a) M- [code]EDMA sample test application6 A+ @2 c3 u6 n# W: R6 Q
- /*
, {6 A6 V: {* K. f9 _8 D" u" h - * edma_test.c" X- \2 P. n( f2 j3 a8 E( l7 ]
- ** U; {9 i; M$ a- V% P. _2 I: p- p
- * brief EDMA3 Test Application+ b: k" _) k+ x9 [" h3 A
- *( {! T% a0 }3 \: ^) M3 M9 J: {
- * This file contains EDMA3 Test code.1 W* m6 o2 _- X
- *
+ c5 [/ r; J& { ^: E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ x- f. h; }1 T% F# R& J% u8 t5 K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 d/ l) g( i3 T* ?
- * TO CHANGE.4 A; S$ L) s- q3 x
- *
7 A; }5 U) z+ B+ Y5 H3 c- D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 X+ b% u4 g: C - *( j: W6 X! R, y
- * This program is free software; you can redistribute it and/or) g4 n5 q- g$ s
- * modify it under the terms of the GNU General Public License as
. y: k8 P* J0 o' n - * published by the Free Software Foundation version 2.
: W) x/ c* M5 F - *$ r* m6 L6 i o* W/ I. W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' E/ @& s* {. a9 @" M
- * kind, whether express or implied; without even the implied warranty6 b4 c I9 ?3 q* J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' L2 O$ y: M& i# j& a - * GNU General Public License for more details.
( a/ Y, \5 S7 H2 p5 r - */
# S; h6 m8 {" u1 |5 a7 r
1 D: `% T) h7 q4 P+ f2 K- #include <linux/module.h>
8 [6 {! h8 j2 {- s/ ^ - #include <linux/init.h>3 ?$ g/ e1 ~4 D
- #include <linux/errno.h>6 \9 _: d8 B8 w2 f# R8 |* v( f
- #include <linux/types.h>/ H M* W# B9 v; p5 X' k; o. K
- #include <linux/interrupt.h>
' ]0 v& R: l$ X( i5 a* ? - #include <asm/io.h>
( ^% r0 j( |4 d; ?( y - #include <linux/moduleparam.h>; g9 Z- i) F) `- ~1 L/ x
- #include <linux/sysctl.h>
, p0 M' X: P7 H' f - #include <linux/mm.h>
! g1 h+ _6 O- [, ^8 ? - #include <linux/dma-mapping.h>
" { \' i4 _+ u2 Q- B
9 b% D8 g! [+ Y% E! w5 n4 |% y3 y- #include <mach/memory.h>
/ R/ A9 R8 s4 ?! n8 v2 t - #include <mach/hardware.h>; }& w. C; W. _- q1 x: |
- #include <mach/irqs.h>
5 M" C |* |5 b& k ] - #include <asm/hardware/edma.h>. K6 J4 h" V" B; P, r7 \
) `% o% c" m3 f9 x& z% ^" u; ?7 |- #undef EDMA3_DEBUG
9 O% G9 T G6 I( A. r2 u J. d6 ` - /*#define EDMA3_DEBUG*/7 ]% S1 z: J' e
- - P9 p- n, h6 t8 l
- #ifdef EDMA3_DEBUG
; t- }$ A' X$ V0 r4 g5 o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 ?' o* J7 G( q! I) o" {+ X6 B0 a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): _4 a( }& X- S4 L* @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). E& d9 h8 V% u! ]1 U7 d: h5 N
- #else/ z! I M- E h J2 p. I. N: z- V
- #define DMA_PRINTK( x... )
: g# H/ r) ^7 L8 A - #define DMA_FN_IN8 j; m" P" a, j% n; [: q
- #define DMA_FN_OUT' S* Q, A, T+ ?: q0 L
- #endif
8 e# C' }) j" q2 l, n' a e! B
. s: |8 C! P- |5 T7 D' g- r0 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) j' I8 a: r* B8 S; V - #define STATIC_SHIFT 34 j9 _. l8 l) B1 _
- #define TCINTEN_SHIFT 20
$ E+ x/ r1 ^( c: P9 | - #define ITCINTEN_SHIFT 217 S8 W; j G) H6 @
- #define TCCHEN_SHIFT 22% Y- h0 ?/ H7 b& \9 H: H
- #define ITCCHEN_SHIFT 23
$ {7 s$ z# u2 u J - 1 y8 n2 e! o) I6 W
- static volatile int irqraised1 = 0;4 h) D8 ^' G% A* v" O/ d$ v
- static volatile int irqraised2 = 0;
, q+ P/ ^( d8 Z6 {# n - 2 y; n" n, d o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 S( `6 u+ E" P8 R4 F. D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 c# Z6 U; g$ f( V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) d6 R; ?2 g* F; {: A- G3 a
- [% a9 X& J+ i" `4 z7 q- dma_addr_t dmaphyssrc1 = 0;
# Z5 E( k; H, \" |0 s - dma_addr_t dmaphyssrc2 = 0;3 H6 T- c. g2 d0 A) t. D$ z! ?" k
- dma_addr_t dmaphysdest1 = 0;6 @: z1 j% w" U$ I n
- dma_addr_t dmaphysdest2 = 0;
I8 @1 ~; g( N6 f' ?" N0 S
- a, k- \# {3 X5 o6 K- char *dmabufsrc1 = NULL;2 O' e; |) R# }4 |7 ^' Q5 i
- char *dmabufsrc2 = NULL;/ E) Y/ x8 D9 y7 v" @
- char *dmabufdest1 = NULL;
; m: ~3 D( ]7 @/ p3 G0 D: m0 s2 [ - char *dmabufdest2 = NULL;& S/ H7 B2 D8 h
- * U! s8 U+ t/ D( H: w
- static int acnt = 512;5 K, \5 `. x1 O9 @1 A# `( [
- static int bcnt = 8;5 z2 C- h" s$ }0 f8 ?
- static int ccnt = 8;
j& ?% k4 A, A
/ c( g; Y2 v2 D- module_param(acnt, int, S_IRUGO);
1 @- j7 H9 T1 P8 z t0 e' o1 W - module_param(bcnt, int, S_IRUGO);2 A# y: k* H. g( [ y# P
- module_param(ccnt, int, S_IRUGO);
复制代码
* |8 d) {9 d- Q% R; L; n% Q2 N5 S+ H
2 {5 [( w7 Y9 O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# O$ {! V. W, k" O% darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" T# `& l* P, y, U# M$ f3 q/ Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 J; ^1 m2 J! {2 d0 M0 }
/ A3 B1 ~* g8 l" f. R0 j
% B$ g# X5 C! h( S, I: E5 ?& T4 m+ j* C |
|