|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 B7 j( X6 Z2 p; E$ g- [code]EDMA sample test application: f: \, ~4 Q7 e! l0 M; o" D
- /*
2 z$ G* I( ^* b% A" A6 O1 V - * edma_test.c
4 ?1 Z9 h" `' [3 P0 X. j - *( P+ V F1 `$ j9 C
- * brief EDMA3 Test Application! _' B8 K8 d5 i$ m! i
- *. ?8 e, t/ V- ~+ q5 |% f
- * This file contains EDMA3 Test code.2 C; }& M( N N/ ^. X
- *9 a! c4 W; L2 X% v: \/ }- M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 c2 B2 |5 _, v y) j) y2 t" s+ q* P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 l" B& \( X9 ~+ I - * TO CHANGE.
: z# l3 ?9 G# T2 A - *
2 R6 W: X3 E. t8 I4 [( l4 ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- q. B. ?) y* A1 F
- *
4 N# z8 N6 u3 l0 O! i - * This program is free software; you can redistribute it and/or0 H2 X) g' B+ d1 S' Z. j
- * modify it under the terms of the GNU General Public License as+ }3 h6 P2 d: L8 j1 k6 P
- * published by the Free Software Foundation version 2." @2 ?. O+ E X, O7 _/ j
- ** I; x+ Y4 S" f2 M$ {# G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; i4 P" Q& t. S/ H - * kind, whether express or implied; without even the implied warranty! |9 @, Q; p, \, g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. V6 Q, G7 z+ ]1 e9 y
- * GNU General Public License for more details.- {" w0 H" w; R( r
- */
/ p6 S! P, \0 Q: f C9 ?" l - % I( @& w( t) X9 Q+ C$ V
- #include <linux/module.h>* w* {: S* M* j4 V4 U* d" X8 _8 \
- #include <linux/init.h>
( P/ u* u3 H9 W7 u5 Y - #include <linux/errno.h>( Y, h2 M" t: a$ F! _, Z9 S; P( r' c
- #include <linux/types.h>/ q5 i% c! |$ r: J
- #include <linux/interrupt.h>
% A! E8 ~, u0 r: Z8 U0 x - #include <asm/io.h> U6 g6 H8 R& g# Q. \% q/ _
- #include <linux/moduleparam.h>
0 N( [4 ~" I% F$ U' b0 h) Y( q9 A - #include <linux/sysctl.h>
, g8 ^) I8 g4 G6 c - #include <linux/mm.h>& N1 e" q \4 }+ G
- #include <linux/dma-mapping.h>" U( n) W: k n. ^( y- R( C
( Y/ u |+ `4 [! x* P: A- #include <mach/memory.h>( q& N3 P) B) A
- #include <mach/hardware.h>
T# M4 ]) ], Q: a - #include <mach/irqs.h>
9 H. @! y! [: D5 C - #include <asm/hardware/edma.h>
' K2 }* z' U- r: a5 H4 S- ? - 1 a& o k( v4 W5 g
- #undef EDMA3_DEBUG+ c' Y& u' ?& ^3 E2 \# `
- /*#define EDMA3_DEBUG*/
% H8 b4 ?) Q& e7 _0 G
1 t5 x8 ]5 T, M" D# y( J/ Y- #ifdef EDMA3_DEBUG
5 b# G. k. o8 n0 c0 N! O/ M% K: z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 c$ k0 r5 \2 d/ ~) R3 M2 L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- ]% s. ~5 o) q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( ?, ?, b3 O1 U5 w - #else; E7 W, C: [, B
- #define DMA_PRINTK( x... )$ P1 K5 }# _' J7 J
- #define DMA_FN_IN& t( u2 D1 B6 B, V s3 l0 i, g
- #define DMA_FN_OUT
7 [' h4 b6 Y7 J. U/ X x - #endif5 Q. |- x; z! G. r
- 9 ^9 e% F+ x" R) K8 A! @/ a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 j9 P$ X# [8 t t - #define STATIC_SHIFT 3
9 M/ A% W% V* d, h- ?, e - #define TCINTEN_SHIFT 20- C+ M( l$ [% `- y
- #define ITCINTEN_SHIFT 21
$ |5 X' O& K4 q' I - #define TCCHEN_SHIFT 22% m Q: p7 c9 p" ^# ^8 g
- #define ITCCHEN_SHIFT 23
$ I$ H% e4 T. z _7 E6 P' d
& }+ A" ~( R: x) J- static volatile int irqraised1 = 0;- x& U, E' \. A1 Y8 ~. g8 q
- static volatile int irqraised2 = 0;1 T/ K2 ?/ e' p8 j- Z
) `5 u5 p2 _. a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- X3 N# N! I5 y- p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& U6 h- _ P5 p" M' g, w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& M2 u0 b4 Z( M/ i
' d* g' l5 x5 @7 r* b- dma_addr_t dmaphyssrc1 = 0;+ b* ?* U. B2 V
- dma_addr_t dmaphyssrc2 = 0;& Q- c' w s" B) [! \. ~' \ U
- dma_addr_t dmaphysdest1 = 0;
& F1 x0 C; z. i* h - dma_addr_t dmaphysdest2 = 0;
# _+ H% {* A" O. i5 i" R" `$ p9 R" j
$ N) B* \% X0 D, q9 w* r9 s# V- char *dmabufsrc1 = NULL;
' @. W2 @$ k! A - char *dmabufsrc2 = NULL;
! H' f! y8 G' _1 M% t- d7 [* g - char *dmabufdest1 = NULL;; ?( A! q, g; h. l' P
- char *dmabufdest2 = NULL;
. z6 M9 J9 C F- ?" E% ^" w. R& k
- X% m2 H; I( T2 J$ f- static int acnt = 512;
0 ~7 p7 V. j" z, C - static int bcnt = 8;8 K4 |1 {0 i/ U! `
- static int ccnt = 8;
1 Q1 u6 E5 H( L" ~1 n9 }* I* u - # l0 S. j# V: d2 }
- module_param(acnt, int, S_IRUGO);) w/ U* c1 \$ u/ l3 ]% [
- module_param(bcnt, int, S_IRUGO);
8 v7 w/ K. D% j8 t - module_param(ccnt, int, S_IRUGO);
复制代码
5 }. L/ s4 M5 S; Q* P9 ?: c8 m7 _6 u2 J( ]0 N* ]; W- y+ m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* q1 q* G" n! }" f$ i2 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
K7 {0 y5 g3 ?2 ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* Z2 D: X$ U3 f3 U
6 K) ^9 W. _; J
6 G7 z0 V- J4 O4 ? |
|