|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 N; \2 W1 d0 i% X, `7 \
- [code]EDMA sample test application
' e5 L) J4 U3 Q$ [5 T# z F0 m - /*8 t- U; l: s- y
- * edma_test.c' K& A/ J5 U0 x# z
- *2 U6 V, G& h+ H0 o7 w* R* q
- * brief EDMA3 Test Application' m* \% I: i; z0 Z1 b F+ [" ~
- *
$ G0 d, X5 X/ a# q$ p2 H, e. V, G - * This file contains EDMA3 Test code.
6 `% E" B7 e( V - *
9 w+ K# _( Y7 Y8 D8 ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ s8 U/ a2 s+ Q5 T0 ^! ]0 f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' @" d' x4 u. y$ M- d4 | - * TO CHANGE.
/ O" H6 |5 X+ W1 V8 L0 }. J - *& N3 a$ u4 ^. H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' t2 m3 ^. n/ l* l' x" ^1 l- W# M4 p
- *1 k, P. F- S; ?5 }
- * This program is free software; you can redistribute it and/or/ J3 {0 [/ Y T! Z
- * modify it under the terms of the GNU General Public License as
' b4 p. ~0 I) {' o5 M9 M& ~ - * published by the Free Software Foundation version 2.
8 S1 f" q& F. q1 i4 O& L- s - *
! U. \* E8 N, r# `& m& Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% W7 x8 D1 t2 H# O' J; S
- * kind, whether express or implied; without even the implied warranty
7 \" Q* I, b+ n9 o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) L& u0 {8 u! a: X
- * GNU General Public License for more details.3 b, E4 c# l# W0 a$ H. Y7 s
- */
. B! F) F$ S5 C
, @* ^7 B! m8 A' j" R( f- #include <linux/module.h>! v) f% L' D* Z4 z' {2 ^
- #include <linux/init.h>+ {1 ~' f6 N N( Q( j' z
- #include <linux/errno.h>. _2 S7 d; N# D0 c
- #include <linux/types.h>
* f* L! n) h) K; }5 n( | - #include <linux/interrupt.h>- g) S4 o5 i9 [" K" {* Q
- #include <asm/io.h>0 x! H* p4 w7 L
- #include <linux/moduleparam.h>
Y2 S. B& z5 y( A# a% e - #include <linux/sysctl.h>4 R- u7 W J+ I* H% K* X& G" o
- #include <linux/mm.h>
2 l! M8 x7 m J: D% z0 q - #include <linux/dma-mapping.h>
1 J C2 Q" r' K* v" K* O0 ~" O
" `; U2 S. @( h) s- #include <mach/memory.h>3 x/ _0 A" I! u' l2 `, ?
- #include <mach/hardware.h>
2 \# F: @/ q- d' ~7 I0 ] - #include <mach/irqs.h>- h/ e9 s" u7 w1 V8 q Y
- #include <asm/hardware/edma.h>
, V. ^2 h: d' @" I$ Z) R2 I* T7 ` - 9 K$ h9 w. ^' H% ~/ J3 v4 ?
- #undef EDMA3_DEBUG
. u, V& \0 f$ m/ \4 \6 Y5 q - /*#define EDMA3_DEBUG*/5 ^$ U( C4 [1 G9 K3 K
5 Y0 a7 Y6 W1 O4 Q% W/ l- #ifdef EDMA3_DEBUG
" a# g. J( Y- H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), Y$ M; Y0 m2 {1 E# h t3 ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 C! J/ {( }3 u x: S0 w7 V v- ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- m1 x9 h \6 k7 \% }: t, I - #else
3 a6 W$ s5 n* o$ T; f8 x) W7 s - #define DMA_PRINTK( x... )
7 g, {7 j s" e# h0 I - #define DMA_FN_IN
0 v! I$ m+ B5 z2 T- ~ - #define DMA_FN_OUT
6 c# l2 V; U$ Z5 L7 y0 P - #endif3 g9 m( d! I9 J' @8 m% k' Y7 }: T
/ c; p4 o8 W2 Z; R* \5 N* g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 n) Q3 j1 F% D: r- x- V( V+ Y3 S
- #define STATIC_SHIFT 3
- S$ u6 l# A8 { - #define TCINTEN_SHIFT 20
& E* g& g, ?9 T* c( | - #define ITCINTEN_SHIFT 21& r+ D) q& }/ t c* u- d
- #define TCCHEN_SHIFT 22
3 G5 \8 [' v# f - #define ITCCHEN_SHIFT 233 k: W6 e. H% t* s& R
& G: L- X( @/ x3 N$ p$ P' m; k- static volatile int irqraised1 = 0;
& Z- e+ d( V% O/ o - static volatile int irqraised2 = 0;6 B4 A. F) W" ]$ V
6 f" g/ }1 ^; k7 o$ `. j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; w, m A4 h3 A& _3 C' o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" d1 ^7 V2 n3 D+ R9 \& Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ^# O8 c9 `6 h+ E0 X5 V
% h# Z- }5 L7 b) m |- dma_addr_t dmaphyssrc1 = 0;- X5 I% a6 L# e4 M
- dma_addr_t dmaphyssrc2 = 0;* o1 B0 k. F/ [( }$ ~ W2 Z% Z- ^; o6 i
- dma_addr_t dmaphysdest1 = 0;. M4 k8 c" S: D. m; w
- dma_addr_t dmaphysdest2 = 0;: Y! N m7 M" \0 N0 D6 o8 [. I0 I! X( g
" B4 M5 d" Q# o& l- char *dmabufsrc1 = NULL;
) v3 E# p3 U: `0 v) t - char *dmabufsrc2 = NULL;# r2 e6 c+ [& z; b) E$ i. I9 J$ ]
- char *dmabufdest1 = NULL;; Z0 ~3 ?/ o1 O' ]- E
- char *dmabufdest2 = NULL;$ }# R2 [# a; z$ N5 A1 X8 t; T; i
8 Q' e v4 l/ s8 @- static int acnt = 512;
3 K9 ]3 }( u: @; K( r - static int bcnt = 8;6 [7 K5 m& N1 A% |# {$ Y6 X; ~- ~
- static int ccnt = 8;
6 H4 c3 Z! J7 g9 X - . x. E" z( A' y" n4 {: X; L! s
- module_param(acnt, int, S_IRUGO);
- G) d" r# `8 e5 f% n! }* q - module_param(bcnt, int, S_IRUGO);& w) T* L- }4 P% A4 `
- module_param(ccnt, int, S_IRUGO);
复制代码 ! W9 F( }5 M ^ W
& G8 U& N6 Y0 k" A5 E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# O( J) X, |6 f5 N8 { ]1 N6 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ~& Z% U5 P* _$ M7 r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* j: l0 N7 e" W+ E. V5 Z+ f' ?
H D0 i, p; ?5 E
. |8 T* U9 q$ f1 N' C" ]9 A9 ` |
|