|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! m" {- [$ K! B) D. b F- C0 r3 J- [code]EDMA sample test application! t1 z/ h, o& S% W! X3 F; g# l
- /*
. I! R6 j2 t& U8 S/ ^* y - * edma_test.c; a+ S0 f2 d4 ]8 O- D4 n
- *0 O6 D" T+ d- j7 L3 \# A
- * brief EDMA3 Test Application
( s3 M- y Z9 v2 f1 `' P - *
9 c4 R* j+ T4 h1 L6 l, E - * This file contains EDMA3 Test code.+ H8 t2 Q* ]( z/ E8 W+ i$ a' m
- *
* \$ I# d w$ {6 [, U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 A' F' I" X4 J1 _/ F1 @# P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT e: s6 k0 j& m8 D: K2 m
- * TO CHANGE.
: Q: ~# Q9 \& C/ [0 F1 J) p& [ - *
0 j1 W# ]% m1 x5 e' t; Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 P0 h/ e% o+ c% w
- *9 p" t7 C8 c5 r' [. P8 f
- * This program is free software; you can redistribute it and/or+ b! j* N7 @1 W! G# j7 o
- * modify it under the terms of the GNU General Public License as7 S' d! } @3 J2 ?& L4 B
- * published by the Free Software Foundation version 2.
# w4 e, B: d e- Q - *
% }3 E( R. U+ H* ` W6 K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! q) `7 e, d0 k% a; Z9 q% j r - * kind, whether express or implied; without even the implied warranty' s* n. L% f( J9 X$ ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 |- H. [: Z6 _2 v2 | - * GNU General Public License for more details.
1 A' b; V" o7 c# [# A; x5 U - */
/ p: R9 U% L- M0 w; B - + O' P5 ` \# v K+ s& U9 L
- #include <linux/module.h>
- u* x2 E# [) k o* B+ d, K - #include <linux/init.h>7 k! A! J7 e% {; h% T# e" a
- #include <linux/errno.h>) b1 ]3 a, R6 I& M2 r r( X. G9 }
- #include <linux/types.h>
' \! h" a. N/ f+ ~" n; a - #include <linux/interrupt.h>
8 U2 V7 t8 E1 e- J. ^# A8 f3 s - #include <asm/io.h>
2 h8 U/ D# p# l' H: P5 @' m7 A# S - #include <linux/moduleparam.h>9 z4 d- E6 @8 e0 _
- #include <linux/sysctl.h>2 M* N) L9 V% k* G
- #include <linux/mm.h>/ c- I# A9 I$ z+ l5 v
- #include <linux/dma-mapping.h>/ W% N1 C5 a j4 H3 c
- + Z S% J! C. }) {4 }
- #include <mach/memory.h>
. L A5 Q% D" C - #include <mach/hardware.h>
2 h m: R$ @5 K/ X( h2 a( U - #include <mach/irqs.h>6 S9 O( Z1 X5 v. F; ^3 y; n/ o" l
- #include <asm/hardware/edma.h>) h8 }4 H( _ ^- ~9 y! d8 F
- 6 z. O3 E% o8 }+ ^7 l- c
- #undef EDMA3_DEBUG
4 g5 j1 y* D3 I: x# Z0 q4 Q3 f - /*#define EDMA3_DEBUG*/
- k) O7 h# x- K1 b3 e3 z
" c1 W7 Y5 Q6 q! s6 p- #ifdef EDMA3_DEBUG
) B+ M( ]* G- \# \6 N1 M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( R% e4 `) ?3 v q7 g% `; b" G2 V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 @; `0 }, ^1 \% b" ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. k. |! v6 C/ D. r U1 `+ A - #else
: ]7 g, O$ F3 P( G0 I/ v - #define DMA_PRINTK( x... )2 }; K5 T8 P1 h8 r) q
- #define DMA_FN_IN
& | Z G8 H* {' J - #define DMA_FN_OUT
- K7 M6 L; E% a: u% T q2 |" T - #endif x c" o" x- S7 w4 P) }
- ( p5 @9 L5 o; a; D, I! k4 f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ m4 o, f0 T) j
- #define STATIC_SHIFT 3
/ f5 r/ C. d+ h3 L - #define TCINTEN_SHIFT 20# Z6 t( Z. \! s
- #define ITCINTEN_SHIFT 21 Q7 y) k/ A/ y* P7 ^9 m' d+ }6 i: \
- #define TCCHEN_SHIFT 221 d4 Y) q' J3 z8 B. t! ^0 O
- #define ITCCHEN_SHIFT 23/ W1 I4 D# m0 w! Z9 Z% [
+ X6 i8 y# V- ^ T4 N7 |: G, Z- static volatile int irqraised1 = 0;! \0 d6 C9 w# o& v ^, J/ ]
- static volatile int irqraised2 = 0;
; [' P# E/ K3 [. O5 ?9 S$ Y
9 ~" X' ~) }! |# L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 m- L9 I! A" W1 M( ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- d3 Y3 [! S% s8 G- u! H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 t( J* i9 u1 X& d" e9 L
: D: g1 K! G5 R$ Z. {6 d9 K$ I0 Y- dma_addr_t dmaphyssrc1 = 0;
; O9 q* y) n: |4 g7 C! ^2 \2 k& X: s - dma_addr_t dmaphyssrc2 = 0;% S6 f0 Y% w Q
- dma_addr_t dmaphysdest1 = 0;
$ p& M* h A, ]+ t$ T - dma_addr_t dmaphysdest2 = 0;
5 [. X0 b4 P: R0 A# z - ; V. w6 q# X* y
- char *dmabufsrc1 = NULL;
8 [0 O) L' B1 o) o# W, m - char *dmabufsrc2 = NULL; \% v: L# P2 r0 c* Q) l. @; F3 E
- char *dmabufdest1 = NULL;9 ?. U. D5 ?* @. I8 D) \
- char *dmabufdest2 = NULL;5 K. N7 K; e g% ^. Z
. w: a S( x8 C7 R- W- static int acnt = 512;7 b5 O4 V h4 P+ m2 U6 x
- static int bcnt = 8;& P; q9 u. Z. Y# k5 L
- static int ccnt = 8;
- y$ x: g( b! O1 V5 {
/ E! F$ Z4 V6 N* u- module_param(acnt, int, S_IRUGO);5 s; J/ y4 t# d0 {* B0 u+ V7 |' }
- module_param(bcnt, int, S_IRUGO);
' d+ b. }6 f: S! [3 H" |. F - module_param(ccnt, int, S_IRUGO);
复制代码
! A$ y& r5 o$ ?3 @8 O, t+ g& j. k
/ S% ?7 `9 n# ~2 B+ V8 k w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 h- h* ~* c/ d# |1 V1 qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! i2 u+ v) d7 B: s$ f& ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 o: b: U- t* @
7 t+ B; @( D, R$ h, m0 s8 z3 H6 N% c; V. g3 y! Q( o
|
|