|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( b# h2 g- P6 J- y- [code]EDMA sample test application
# h9 F C" } s% s, ` - /*0 G( Y& d% v8 F3 E0 d( G
- * edma_test.c! ?6 Q. f7 M# `
- *" C8 l K) G" M9 }- g
- * brief EDMA3 Test Application8 F& |, K4 ^$ q& W7 g9 @! |
- *
0 I- J4 M7 A3 p( T9 B- L4 C - * This file contains EDMA3 Test code.
# x8 _5 y1 N. c* {: N. U - *
" k1 u, o2 ^' O6 ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, U0 I. Q7 x) u; K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 M. o- h' v) |! ^# _% T/ p
- * TO CHANGE.- b8 X# O6 V1 Y& o" g8 u8 _
- *
3 S4 n8 T2 c9 \0 v+ @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' k- v) K' Q5 ^. r - *: q. M1 S- j: y% m" O; P
- * This program is free software; you can redistribute it and/or/ T8 b$ M- H0 z' ~
- * modify it under the terms of the GNU General Public License as
! c+ x9 ]5 L" A4 p, x# l( ^- b8 c! V - * published by the Free Software Foundation version 2.5 K+ }+ S/ q0 g3 O. f
- *
; z y: @% X2 R0 b, N7 G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ l. O8 ~+ R% U+ R- R - * kind, whether express or implied; without even the implied warranty
* y6 q/ ?) Z3 S6 I/ K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ Z% m2 @. Z- E. v; r - * GNU General Public License for more details.
7 E; v0 V2 `8 r+ j. n* o5 Q4 { - */
. g+ c! x$ G3 c/ |2 L - 8 ?! i, ~2 P t; A
- #include <linux/module.h>+ D1 L/ V* P4 F' g5 z) v; |; @
- #include <linux/init.h>
" Y7 u, i$ u# G; c# N9 N+ E - #include <linux/errno.h>' C+ L# p$ L( n( U: v& Z; \
- #include <linux/types.h> x+ o( h( `" ]; g
- #include <linux/interrupt.h>
! k. y9 @4 G# h( b7 O. J6 J# j - #include <asm/io.h>
1 T9 @ s. }- P Y - #include <linux/moduleparam.h>
/ ~! s7 m: k. W4 n - #include <linux/sysctl.h>
* K$ P5 C: Y! t- ^, s" f - #include <linux/mm.h>7 A% F6 T6 _9 M# o
- #include <linux/dma-mapping.h>9 S! S! { t; n, b) g- L" n0 a
* l1 J# u7 c6 }, w1 L/ W! [9 Y6 \- #include <mach/memory.h>
( h0 t% p& V0 t! B* {% W, G5 \ - #include <mach/hardware.h>3 Z b: g) |- ~! z: Q/ O" g
- #include <mach/irqs.h>. ]9 ~, |9 J! ]% A- d- @
- #include <asm/hardware/edma.h>
1 e- f1 [! G9 D" U4 d - / s4 A/ n( }* n+ G% d2 d
- #undef EDMA3_DEBUG0 Y; N: z3 V$ o: q1 ?' g8 h+ ^
- /*#define EDMA3_DEBUG*/
7 O; n. ~2 F" V* @# t0 _ - 1 Z* D3 K: f. v: A: M
- #ifdef EDMA3_DEBUG
; w h' o4 ?" C: c e- G3 R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); I* M6 v3 ]) o. s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); D a- j& M( }& P, U0 o) Q" m+ G, Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, Y/ o2 T. r" R+ F - #else1 e8 K; o: i! C& p* H. P! J! C
- #define DMA_PRINTK( x... ): `/ \; A) ~/ u- g \- X
- #define DMA_FN_IN
1 r- j# y/ N/ y) w, { A M - #define DMA_FN_OUT: F! k" q/ f- a' F
- #endif
# H% t9 A( @: A+ ?7 o* U/ e - + j' W1 b0 x& u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& g; G4 K( W- W# A# ] - #define STATIC_SHIFT 3" k- T N! ^1 q4 P7 ]! i" S
- #define TCINTEN_SHIFT 20$ w$ V7 q7 C+ C* d5 y
- #define ITCINTEN_SHIFT 21! d( k o# n8 R+ O6 H8 ]
- #define TCCHEN_SHIFT 22 Z2 N& f/ _* |0 ~- H! c
- #define ITCCHEN_SHIFT 23
0 P3 m. [' N8 J
5 B/ M& M3 ?+ J k6 A" l& Y- static volatile int irqraised1 = 0;
& k* C& d* ^. e" ^$ R- o" X- z - static volatile int irqraised2 = 0;8 U' l$ _, I& }' ]2 s5 V# A
- # S4 z' u; n; C0 C( |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 S' X# m B6 m8 M6 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ^* L) L6 M e5 a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* r% ]7 ~3 q' I( l1 J4 V) S/ \
: v7 D+ H" W0 y5 L: R; k- dma_addr_t dmaphyssrc1 = 0;2 w' g& ]/ R |4 z" V! I
- dma_addr_t dmaphyssrc2 = 0;/ C/ u; I* [! @' ^9 ]# N4 T
- dma_addr_t dmaphysdest1 = 0;+ C# j- \" ~4 J1 }: E
- dma_addr_t dmaphysdest2 = 0;
* [9 z4 N- R5 g \. y: D5 k
' d! E, x" K! S2 _, P2 U- char *dmabufsrc1 = NULL;
" u9 z, B+ [$ x1 |* v: v - char *dmabufsrc2 = NULL;
" g U6 u" {4 k& }* J4 ?$ b - char *dmabufdest1 = NULL;
: j2 B9 M, U% G# _6 P - char *dmabufdest2 = NULL; q& @5 I7 U5 O: C+ M# u( d' r
3 R ~) X# u& u- static int acnt = 512;
7 w% t& f. r1 @) h! K) L3 L - static int bcnt = 8;
5 T/ T; ^2 l$ I4 F+ I - static int ccnt = 8;3 ~0 C6 f: F+ k4 t" `& ?9 f$ _
7 F v$ F( @/ p- module_param(acnt, int, S_IRUGO);
7 F- u! g7 m2 b3 l. t2 a4 N8 ]/ A- ~ - module_param(bcnt, int, S_IRUGO);
- Y9 a* s8 y4 B4 [1 f - module_param(ccnt, int, S_IRUGO);
复制代码
5 `* y: q1 M% F& S. X; ]) b$ K' @) B* v7 C3 \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 s9 \2 E {8 q9 g( u3 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# z0 D: l. H* w3 L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! k$ o. j) E* w* z) t
) y2 ]% b! z$ r' s# s: D
( J8 S: E' V4 W1 K3 x/ Q |
|