|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; k' t' t7 O& p
- [code]EDMA sample test application
2 s& \: R7 {0 Y2 x5 [ - /*
7 r* t! P u, C% E, P d - * edma_test.c4 A+ y: ~0 U6 T; S# N* j: G
- *1 N }- ~+ {- B6 p9 v
- * brief EDMA3 Test Application* |7 S. a& O3 Y# h2 a! {
- *
5 u& X& ^) q% H" j' v8 a3 K - * This file contains EDMA3 Test code.: k! E' a8 i( y4 j/ }4 w& n
- *4 k' |! w+ Y0 d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 a I0 v, n5 s/ ^+ W3 ~) M. O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ d5 x/ J( R" O* I* x
- * TO CHANGE.. u8 A. M6 t& Q9 C3 N& ^5 f4 w' e
- * X' e2 `% Z9 X( s9 } f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, q+ t3 K' w6 K8 F6 ` - *
3 d8 b! @/ A A4 }: Y# ~/ h - * This program is free software; you can redistribute it and/or
- Z& L6 L. Q6 d0 u, b- J& K - * modify it under the terms of the GNU General Public License as
$ b9 H5 J: ^+ |* x. j# K+ @( \ - * published by the Free Software Foundation version 2.
7 E0 h9 S6 o; f5 k' v - *; y( W$ Z8 }$ u" I) i( y& A8 d h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( U5 V1 q8 D, ?
- * kind, whether express or implied; without even the implied warranty1 U7 u; l& p9 Y1 [- |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! ^8 C! T. t7 t; k - * GNU General Public License for more details.
# j7 Y" _# |4 ~. x - */
* ^$ J0 D" a, |" f: E
. h& U+ V4 {+ l; e4 ^2 k- #include <linux/module.h># q# i- {- b. I
- #include <linux/init.h>
6 a) f0 X0 N5 o0 N+ e - #include <linux/errno.h>
7 C0 W6 k0 _% I. ~- e8 S - #include <linux/types.h>/ t' i0 I6 ]. Q$ X# r: T
- #include <linux/interrupt.h>
' ^, i2 V5 H5 W7 {- Q7 r C; \ - #include <asm/io.h>
- f( ^# D0 S. ?5 H# d! j2 o - #include <linux/moduleparam.h>' i8 o r: c3 n/ P: L
- #include <linux/sysctl.h>- h3 ?8 U: F- `6 n( ?8 L
- #include <linux/mm.h>
R; I" v1 U2 ]. c - #include <linux/dma-mapping.h>5 h0 ~9 m/ z0 r, |7 n; B
1 Q4 u; Q- e6 y2 g9 Y& s9 G8 [- #include <mach/memory.h>% H6 X: a0 r1 J, \$ s/ C; `5 `
- #include <mach/hardware.h>8 g2 t& e l; m5 t+ c! ]' ~
- #include <mach/irqs.h>
( {4 X O f9 W& T+ ^1 V2 J' S - #include <asm/hardware/edma.h>. o1 W8 Q1 i! y# ~& g
- 7 i" ]2 `+ s+ _# ~1 A
- #undef EDMA3_DEBUG" F* b* g0 M+ ^$ X
- /*#define EDMA3_DEBUG*/ E3 l) O$ I% K5 P
* z1 \0 w' k/ {" {+ f5 J- #ifdef EDMA3_DEBUG& ?( ~' E* E* I% G, N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ s% u8 E: _6 u g8 M! q# B& E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 T4 }0 G: {0 h4 g! z& S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& q/ c! Z* Y8 C - #else% s5 Z: t, e' l
- #define DMA_PRINTK( x... )0 B# |$ j4 S6 s! g, v
- #define DMA_FN_IN. [: R0 ~3 N w0 n
- #define DMA_FN_OUT
- R8 b) C' `* S" w - #endif
5 B' G- X q! L* F5 Q* b3 D, L - - q1 g v, B0 e" M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ A/ L+ u* Y0 {8 a4 ?. D" k8 V+ {
- #define STATIC_SHIFT 3
6 u; C6 k7 a- U5 u! Z1 E/ @- w - #define TCINTEN_SHIFT 20
" H- e: X: i( F& E - #define ITCINTEN_SHIFT 21
6 E) E: _; } s - #define TCCHEN_SHIFT 22
4 n+ C4 G/ J" Y" H1 r+ N - #define ITCCHEN_SHIFT 23
1 C8 Y" b* F+ f S) d - , n( |- h+ } j* v7 b
- static volatile int irqraised1 = 0;
7 t( D7 z; x' ?% M4 V - static volatile int irqraised2 = 0;
/ b8 F! a( p, z5 |1 E& |8 x - - ?% C. h% B2 G+ e9 C4 Y# A5 P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 n5 ~+ {0 D' r( y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" ^0 b$ u: s% L) n) a* d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ j% }. @# o1 G" n4 q# n
* L( J, d# O3 |$ ^# R3 B- dma_addr_t dmaphyssrc1 = 0;
4 k& O' q" ]2 G0 K: L - dma_addr_t dmaphyssrc2 = 0;
+ O" Y2 j0 q$ f4 y( \9 l* a1 J) \3 s - dma_addr_t dmaphysdest1 = 0;. m8 Z! b( V% |1 c
- dma_addr_t dmaphysdest2 = 0;
' V& f% {* W" |" j; u% ~ - 0 q. j7 z# W) a
- char *dmabufsrc1 = NULL;- E: n, B+ \9 _
- char *dmabufsrc2 = NULL;* A% \& w. k. p& l( ~! S) j
- char *dmabufdest1 = NULL; I" P+ f, G" ~! s/ U
- char *dmabufdest2 = NULL;
7 W) y4 v9 ^2 O6 n9 ]
- D2 O+ o5 q$ f- static int acnt = 512;
2 V5 m6 a3 c z5 {- r - static int bcnt = 8;
7 G6 |0 I* l: a2 x0 J" I - static int ccnt = 8;7 l% k4 u2 Y9 V0 _
, F) s, X# B5 V; q- module_param(acnt, int, S_IRUGO);
$ `5 h& N- b* K# n - module_param(bcnt, int, S_IRUGO);
/ T& c" T) z- Z0 a. A8 ] - module_param(ccnt, int, S_IRUGO);
复制代码
* w) m, Y, \0 R* H e* }8 E( ^' \$ l
; s g4 \* G( o) d9 l8 ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" Z8 k& g# g3 K) o. N7 H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, j% c- T/ U f" R# B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: Y% t* q0 k0 E. k' _; L, i* k
# w/ d3 W4 b7 F) ?0 e* c( g# [4 c# p) d
|
|