|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- t7 r4 z( l; O. f- x2 v* q( H- [code]EDMA sample test application+ ~# {: }+ j0 i. b, M9 R: {1 o4 D
- /*
9 a/ q3 r Q* ~9 Q- x2 o. j - * edma_test.c
0 h1 |4 H* }( A1 |3 b5 C8 D, J - ** ^6 p. o2 }+ a1 j6 S9 z
- * brief EDMA3 Test Application! Q* \; Z) a5 a- G! X. o) c' x
- *0 w6 a- ]* {7 k5 l1 i9 P
- * This file contains EDMA3 Test code., ?' E% `* v1 d* m/ O* f
- *
* z( [* G& g8 ?4 K+ [. w& m" ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" d% u5 \+ Y2 O! q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; L+ y" V& y' t- H6 f! M4 p
- * TO CHANGE.8 P8 Y$ f( {0 O7 e3 m
- *" A/ P9 i) X: |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ D4 {8 j! P- z9 I0 V
- *5 [# ~0 U) o% F* c; _/ \0 h
- * This program is free software; you can redistribute it and/or& e$ @# l* h8 F+ Z. M
- * modify it under the terms of the GNU General Public License as
- A' e s( u! h- z- Y3 m% J) I - * published by the Free Software Foundation version 2.
5 d6 f( \- E# F! u9 m - *7 V2 }" D. ?' I/ r1 s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 z+ A u" U) v% Y9 r r8 V8 N
- * kind, whether express or implied; without even the implied warranty
7 }3 g1 x% k4 J6 r9 B, ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: K" v: ]! a+ p8 e - * GNU General Public License for more details.
( R- V- ^' g+ n. Q7 \/ I: u- R! [ - */* F, ^% w, n% Q
[& |& _6 A. i- k) m I- #include <linux/module.h>
% h+ ]9 I/ g \1 R1 B0 J - #include <linux/init.h>6 N. U D7 E6 P
- #include <linux/errno.h>2 [2 J. l- ^0 x, a9 `& y A! C
- #include <linux/types.h>* \$ I2 j* _0 `, l8 ]
- #include <linux/interrupt.h>8 R- R! [( W9 N- a6 K
- #include <asm/io.h>' L. G E7 }" Z. ]: |3 {
- #include <linux/moduleparam.h>
* w! w" i8 V# r/ z - #include <linux/sysctl.h>% s7 |8 N: {8 P
- #include <linux/mm.h>
6 Y7 t' k j5 U - #include <linux/dma-mapping.h>; A' ]& |& @; @ B5 S2 g5 A+ z+ Z& r
& C. z R3 f! @' k, ] G- #include <mach/memory.h>
' ?% i* e5 ^9 G) X8 y2 G/ w - #include <mach/hardware.h>2 W; \+ `0 S# J& I3 {
- #include <mach/irqs.h>
$ r. p* L% N. \ q8 U; _ - #include <asm/hardware/edma.h># l6 u( ?1 u, m2 Y' B% n# ~1 S
- 7 Q1 h6 S/ M+ H9 k3 t) _: [
- #undef EDMA3_DEBUG: o4 u' t0 t9 p' ^* V& E
- /*#define EDMA3_DEBUG*/
( S' R8 x( G) h% ]; Z
9 N a4 X) V3 `5 G6 O- _, f y- #ifdef EDMA3_DEBUG# e5 r8 z. ^# t) k9 G0 |5 S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 Z5 s2 m% m v6 z7 e* d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 q) u( b# a. T8 Q+ m! a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 j! M* ~3 R( P, j. _1 o
- #else( O1 _0 K( l$ g8 N$ F
- #define DMA_PRINTK( x... )
( s3 H4 `1 l# y0 e - #define DMA_FN_IN" D2 {7 D) ]" x+ T% E, B
- #define DMA_FN_OUT2 l4 q% v6 a6 E% ^2 Y
- #endif
. |" c( u0 W# N$ X# u
' Z# g7 v K+ o8 D+ T# d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# [# n1 U3 N; s - #define STATIC_SHIFT 3
) M7 q7 M5 M4 n8 K, q$ X$ n |* \2 | - #define TCINTEN_SHIFT 20
: J7 q! |0 u. E" [9 ? - #define ITCINTEN_SHIFT 21
6 U" H/ O& v" W' Y6 N- Z! f - #define TCCHEN_SHIFT 22' g" c. x1 e0 N+ H; m
- #define ITCCHEN_SHIFT 233 P, e3 _" o1 |( T T
: ]; f, G7 e, H" K* ^- static volatile int irqraised1 = 0;
. T$ \! l9 L" u. `1 g - static volatile int irqraised2 = 0;/ b8 b/ P! ]' K% h- C2 @
- 6 _6 d* u% ?2 s5 L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ g, b* |% F* H/ b5 U% ?+ _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( Y2 r' O! \4 k" }. S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& J/ o0 E7 j( z" r4 }8 @# W - l5 r8 Q ?0 L7 Z/ ]8 n' M7 \
- dma_addr_t dmaphyssrc1 = 0; s% _7 w4 O! ^7 p; l0 L6 I
- dma_addr_t dmaphyssrc2 = 0;5 X# V& |* h, X% h* B- M, p
- dma_addr_t dmaphysdest1 = 0;% Z; c6 s6 D/ Z" @8 U4 F/ Z; ?
- dma_addr_t dmaphysdest2 = 0;
. j6 o% R: n7 H; w" j
7 ^& x( L3 k" D7 b8 _6 U- char *dmabufsrc1 = NULL;
6 R2 Z% `* f. B - char *dmabufsrc2 = NULL;
{1 f" k- L! F; i+ a r% }# ]7 T1 f - char *dmabufdest1 = NULL;- M' M. K$ @3 ?1 R# x, h: z/ `& E
- char *dmabufdest2 = NULL;# r" Z( |" h- k
- + c* n0 g7 a+ B3 A; b& D; J& b2 D$ [
- static int acnt = 512;! f3 ~. Z8 Z. J( o2 l' O
- static int bcnt = 8;
' C( g6 v2 p/ g% b, Y; O - static int ccnt = 8;) d# _8 n) W P" t
v8 j% R# P! \% o, x/ u- module_param(acnt, int, S_IRUGO);
$ J9 |. x, D( J% d! x; G - module_param(bcnt, int, S_IRUGO);
: J! g: Q; U/ d7 W: D) ^3 N% Z% y7 b' I - module_param(ccnt, int, S_IRUGO);
复制代码
. Q4 I/ ^' n0 j/ U f1 O
3 G! c |5 T& {, H7 I; b: C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, T2 p2 l0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, u7 e1 H( J' M& b1 D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 z6 ?# g9 e! ]* T" v* ^: h5 V/ r
7 b* X7 f2 z. {& ]5 i6 {8 C" T) E5 M2 Z( f
|
|