|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 l1 v! e; I( E$ |- [code]EDMA sample test application
8 x9 m' x4 i6 b - /*
9 P' d' P$ u3 O9 ^2 b. } - * edma_test.c: D1 r1 }! v6 s
- *
2 O9 S! u9 p! S - * brief EDMA3 Test Application
1 Z( g3 ]: c7 X2 T - *
& j- _) T9 l9 h' C z1 F - * This file contains EDMA3 Test code., Z' Q, n% h% D9 c3 l
- *. `/ b2 w; @: L- l, F- j7 }: X( o3 w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! a5 w. n* \& c2 v/ f# A! Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 ^2 O+ ?" P- m( i: R - * TO CHANGE.. n( s9 v; a0 m9 s8 s% f& F1 W
- *
; n* h4 L% R% w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 r: j- J; u" D' ]9 ` - *- f. i9 p$ c9 S/ j3 T9 {# u2 Z
- * This program is free software; you can redistribute it and/or [. a: z# l1 \& _" f, i
- * modify it under the terms of the GNU General Public License as5 A" w1 }! ]7 C( c$ d
- * published by the Free Software Foundation version 2.
. ^. i. g3 b0 r: v - *3 }( J4 H( _' |1 M$ W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% ~: |2 b0 i, x: k' N - * kind, whether express or implied; without even the implied warranty
# E4 K) Y: Z, W c2 `7 G8 b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ m: H) [6 E6 e, p6 G# f - * GNU General Public License for more details.) D, x- e' V0 k' c2 F7 o q
- */
/ f( V. e+ i9 O' e: r" o - 1 g/ M% Q. \: X, x, e7 K5 U/ z
- #include <linux/module.h>. G8 u, E- n( c9 T$ S
- #include <linux/init.h>
( Y7 I( a# Z: D. O% K - #include <linux/errno.h>
$ a2 c0 \. I/ |) B" R - #include <linux/types.h>+ f' `2 X. Y8 M+ ?
- #include <linux/interrupt.h>7 O9 x% S" H3 `% B' p5 u
- #include <asm/io.h>
0 ^0 \; e- y; B# R8 ]: Q - #include <linux/moduleparam.h>
+ W' e ^+ e4 d& z! o4 i - #include <linux/sysctl.h>( w. j( x* w# |: ] C( Q( M. Z8 ]
- #include <linux/mm.h>
- X* x/ E# y* X! p5 k, h8 _" ^ - #include <linux/dma-mapping.h>0 L! s/ Y5 E# G; v0 O' u
0 v! F! X; F I6 L- #include <mach/memory.h>
- Z1 ^/ t2 @4 {- O+ C - #include <mach/hardware.h>9 H! h d- p' x/ r6 t. J: _5 K
- #include <mach/irqs.h># t/ P2 P, p% y& Z6 I7 H
- #include <asm/hardware/edma.h>3 o% [$ N* E) K6 K5 r, O
* J* {- d" @% L1 g- }- #undef EDMA3_DEBUG! Q# C/ s6 l, H& x, s$ L, F* |
- /*#define EDMA3_DEBUG*/5 Q; l9 v* F" L$ u5 x# L# l
) A& q! ~& b# ]' r! i- #ifdef EDMA3_DEBUG
H) r- Q: L, n+ W4 U% B4 z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 E; }. {+ w; s7 w- ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: T7 w6 _9 w7 ^4 n7 Z0 D3 I, n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 [' S+ I6 ~% [+ x - #else' M# Y/ K- R9 R4 f+ M
- #define DMA_PRINTK( x... )* h' R; G U+ B: ?- N0 K( G F
- #define DMA_FN_IN
' Z U' u5 ]& N - #define DMA_FN_OUT
, N+ b3 }! x* W6 z( K7 Y+ h# @ - #endif
; D0 v- J3 D% s# N) g9 r e - . N$ q7 X2 ^# T2 V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: k; W: q2 O8 K4 k: { - #define STATIC_SHIFT 34 u# G. J( X0 A( d( `
- #define TCINTEN_SHIFT 208 V5 q, k. j0 M9 H2 O& n
- #define ITCINTEN_SHIFT 21
# p' [; O) }" C8 y* H - #define TCCHEN_SHIFT 22
7 }! N# F$ @# @2 r, X1 O- | - #define ITCCHEN_SHIFT 23
5 z/ J7 k/ [" F$ k* E: e - , |* l! F; ~8 w9 x7 H: `' i8 Y5 P
- static volatile int irqraised1 = 0;; ?6 T9 H) ^: h0 U* I
- static volatile int irqraised2 = 0;
5 \' s' ?# m; a' g5 a; Y5 V6 u - % a% h Q% _' [5 G* j5 f% v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Q9 p4 ^/ W, z7 s# |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 N7 [8 a3 @' }$ G& {5 L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ C) ~# B/ z' _4 o |; h; _
# m9 S, _0 ?" q4 h- z: K. U" o- dma_addr_t dmaphyssrc1 = 0;) _# z8 F! y7 B$ _4 w# D% _8 |% y
- dma_addr_t dmaphyssrc2 = 0;
: N7 r5 P. N" e4 R, N+ u - dma_addr_t dmaphysdest1 = 0;
3 o4 y6 u) M1 y/ {3 T - dma_addr_t dmaphysdest2 = 0;
( }$ w% x; f$ J1 [, A6 r' {
0 j6 |, M/ ^3 p h' r$ {/ P- char *dmabufsrc1 = NULL;+ X! t6 d* h8 d* |% W! m- E4 ?+ k
- char *dmabufsrc2 = NULL;6 m; A! T5 }5 _! K8 b
- char *dmabufdest1 = NULL;
/ z; j. T. I. R# V+ _ - char *dmabufdest2 = NULL;# G0 ?9 K9 g0 j7 d4 F% {
- ( P+ W9 u7 F _6 d1 P( b i2 e; |
- static int acnt = 512;5 }" F C. u: P/ J/ Z" I
- static int bcnt = 8;
! X, \8 G4 r/ \8 H) y9 O - static int ccnt = 8;' N7 |7 L" D6 j k' T
# E; L/ D ?- X/ n! T$ r- module_param(acnt, int, S_IRUGO);
4 C6 P6 h6 d; }3 q - module_param(bcnt, int, S_IRUGO);
, G9 i/ L& h( _$ C5 N - module_param(ccnt, int, S_IRUGO);
复制代码
8 G( A P X1 i0 o7 i) K' @" L0 y) g/ U. |- i# E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! s ?# W- e' s7 D f: T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 h) ` R: u9 ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ ?0 s! u) N- S7 X! J
|$ D3 [3 i. d( b3 w
! U" _" m, o" X$ i" B |
|