|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; k6 N" X4 V; o- d( Y
- [code]EDMA sample test application% n) L; v% o3 d6 ~+ C$ o
- /*
# V0 ^! [+ q4 Q$ [) d - * edma_test.c
2 a- }2 O/ Z d9 Q8 y - *1 l; j1 {# r+ r
- * brief EDMA3 Test Application% z9 r; g# `0 h9 E' c
- *
1 f1 B; b, @' n& \ - * This file contains EDMA3 Test code.
. ~9 Z+ ~2 @0 k3 G$ U: r4 E! ]& d - *
) J( ~# r0 {3 C3 ]/ i: x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 W8 \5 l% o& ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# u* E* O2 ^ V( {! U1 }
- * TO CHANGE.' e) E" Y; ~2 Z! h$ S" z2 X
- *
. ?$ u' q3 A% R* [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 Y, G F# J* Y: I8 A. o
- *
( m8 p, @* L! } F, K" z4 C - * This program is free software; you can redistribute it and/or
% R2 _' C& z% b7 p' s - * modify it under the terms of the GNU General Public License as
8 f: D* R, w! }, ~# e3 M+ A+ J - * published by the Free Software Foundation version 2.; _- ~7 L( M& G* I: N+ _8 }
- *
* W/ N9 J% {9 }$ T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. I, w9 T4 w/ [$ e: k7 T - * kind, whether express or implied; without even the implied warranty
# o8 L, z& R! l7 R, ~# Q& K. z! j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* d* h- z& b$ B" x- C
- * GNU General Public License for more details.9 |' A( q+ ~& k. x: d" d% |
- */
2 @, t' ~0 O: x* t# R
1 a0 S( x( k1 {* O0 q- #include <linux/module.h>
- h" ]1 e7 y, b' b* U) V1 z - #include <linux/init.h>- P1 y/ h6 p; H z/ r
- #include <linux/errno.h>
: r0 M5 R, a" }- G. o - #include <linux/types.h>4 m( T' Q0 k [0 z6 {* C+ q
- #include <linux/interrupt.h>
+ G& g H- ?) J6 {- Q - #include <asm/io.h>
2 D; J6 `. {+ V - #include <linux/moduleparam.h>
8 Y5 g7 i% ^1 }3 ^& ?7 o, g - #include <linux/sysctl.h>
* z. D; q) x3 ~5 Z% o. W" f - #include <linux/mm.h>
h: d. v" o6 z% o& T - #include <linux/dma-mapping.h>
3 n# g3 \3 L9 _ - & P3 F: q4 f, ~5 N* F
- #include <mach/memory.h>6 g8 q" H( o! g& ]3 }
- #include <mach/hardware.h>* q) a: G' T# O! @, v
- #include <mach/irqs.h> h. t# Z& J0 \1 {7 Z( Z9 h4 q* l! V
- #include <asm/hardware/edma.h>+ ^- n* A# h F- H# w
$ i' ~; `) i7 o2 l$ n- F0 v. x$ a/ \- ~- #undef EDMA3_DEBUG
+ }3 D; i, R$ H" w* k6 l) M! G - /*#define EDMA3_DEBUG*/
, @, j- Q) [. E/ @ j - - `9 Q7 ^# L) h7 ~# }, e7 D+ `
- #ifdef EDMA3_DEBUG' A& u! b! ^) K3 s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& l* t$ h; H% }9 r: n# v4 p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" n0 U! r( A ~2 ^; M& \4 X8 o! s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( R; L- n. J- H7 L - #else
* U8 Z+ i/ w$ P0 J5 G; P - #define DMA_PRINTK( x... )' [ b7 h4 H! P3 K9 V* P
- #define DMA_FN_IN+ ?6 l: v: N3 P& i0 G" { W
- #define DMA_FN_OUT
% @! ]3 d F3 w+ W2 Z' s: ~% O - #endif
8 o8 \0 a( Y* q* {8 m. Q. q - . Z" c" J# Q1 Z1 g Z- P" Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 i3 ]! ]9 s- Q. ?: q
- #define STATIC_SHIFT 3
8 |9 ]7 J' |4 a/ q" z& V - #define TCINTEN_SHIFT 20" H. i( Z6 e6 j. R* v
- #define ITCINTEN_SHIFT 21
I2 o- ]9 ^4 w& y - #define TCCHEN_SHIFT 220 O% r z5 M* P3 D; J. z4 Y
- #define ITCCHEN_SHIFT 23- G {. ?, K' b4 H; S
$ D* l* H ^/ g9 @4 S- static volatile int irqraised1 = 0;
+ a1 h8 ]& ~; t6 t( ~+ x/ w4 {0 \ - static volatile int irqraised2 = 0;8 ~. ~% }7 R3 Z9 Q, d
- * A9 L2 Z" C7 }3 @+ g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ~1 J$ k+ A3 g/ c: G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& x* ~. ~5 r* u4 V! S* }- P6 E# H/ L6 ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) _: V4 N7 w2 n: o$ I& o
- % \3 |) `8 ` `- i
- dma_addr_t dmaphyssrc1 = 0;
/ j2 O- R7 @' P; l) o. u8 D - dma_addr_t dmaphyssrc2 = 0;
% K6 d1 K: i; |( Q - dma_addr_t dmaphysdest1 = 0;
: f" V4 z* V: Z' @5 Q: q* c' g - dma_addr_t dmaphysdest2 = 0;
1 U/ v5 l" r ] - . [( g2 {1 u" z. y/ ^7 d! e; i' Q
- char *dmabufsrc1 = NULL;
: E. g9 |% L% m! Q0 V - char *dmabufsrc2 = NULL;9 G M% m. D5 ]. h
- char *dmabufdest1 = NULL;2 k) ? {# X" M0 r
- char *dmabufdest2 = NULL;. H$ A* \6 }, h9 }
[6 {+ E% m, ]: ^3 u6 d+ e1 C- static int acnt = 512;
( S! y7 D1 f' q( I& h$ o5 i+ W - static int bcnt = 8;) a7 H; y/ _# j, S$ |$ v: ~$ x1 U7 Y
- static int ccnt = 8;
1 Z# y) h5 e4 c0 ^' h8 x: [& b - 4 q3 b) X2 i% c7 [: e0 \9 g( B
- module_param(acnt, int, S_IRUGO);
8 K0 X& h! P/ B; j6 x - module_param(bcnt, int, S_IRUGO);
" [0 g2 ]+ l8 E, v" N6 U0 | - module_param(ccnt, int, S_IRUGO);
复制代码 6 R3 c1 n1 D% m& d5 g! B
8 t+ z) `- j \2 Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ d8 C; y: m6 }/ b: w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 A8 l9 h, j$ Y# T" n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' [( j& ~& ?* u% \" e# l1 ?, M1 t2 R3 n. N1 J7 ~& ?0 L2 f- L2 i
# ~3 j: ~, E( M/ E |
|