|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : G$ j2 I# `% z
- [code]EDMA sample test application
9 \& t S- l3 e6 y - /** z' K6 @8 ]& o/ r
- * edma_test.c
. L2 |) S, z; N+ J# m/ K8 O - *8 |2 e, ~% J7 h& A% m5 D
- * brief EDMA3 Test Application
D {& Q6 h. O0 L0 f - *- E$ F# H' }/ W+ F5 h; Z6 u
- * This file contains EDMA3 Test code.* q- _! F- z5 O4 a
- *; F! q4 Y4 |7 S! Z. \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE y& L/ U7 b$ H: J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 T9 ~0 `+ S2 ?1 G5 M, Q
- * TO CHANGE." t2 ^# a! x% U0 V
- *
5 n" Y/ W. z* t7 J0 A- M/ z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 J0 }" v. o5 n - *
! k. M3 S | i9 A5 e1 V - * This program is free software; you can redistribute it and/or
1 u3 B$ n5 k B8 Z$ w2 q& Y - * modify it under the terms of the GNU General Public License as
* |4 W% e l) X/ V/ u& y0 K+ S - * published by the Free Software Foundation version 2.
8 F; o/ q+ ^; m$ }4 W - *( S ^, z' V2 q" O2 v G7 @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 r/ v3 G- e# y - * kind, whether express or implied; without even the implied warranty6 f# i* L" Y5 D# K& r' `* J( y8 Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ z- U; O* F% d+ V* w" L
- * GNU General Public License for more details. j5 }4 b) g7 L9 g2 Z1 |$ @9 j
- */
7 _& v* M6 k1 }/ i. X9 n
7 N" R4 i# ]) i2 L7 l- #include <linux/module.h>1 |# Q2 c7 M9 D1 t1 v
- #include <linux/init.h>
) H) N* R: @/ k2 O' { - #include <linux/errno.h>* c' h& D: s! q/ t. S
- #include <linux/types.h>
5 a6 H% L0 V' c" r+ G. q0 z - #include <linux/interrupt.h>
' r9 H9 V" [4 f% o( g - #include <asm/io.h>
. r0 j7 C) v# B+ M. Z$ b# @. y - #include <linux/moduleparam.h>
( Z; |0 D) W& F7 t- H- v - #include <linux/sysctl.h>
! c, S! u b( U4 o' H" ?" K5 I - #include <linux/mm.h>
! z6 U% d B' O9 Q$ q! a# _ - #include <linux/dma-mapping.h>
6 F/ G) A8 V( i* p. u/ I4 i' ]
+ h: ]2 [$ s) R7 X- #include <mach/memory.h>6 M! P& z& f' Z9 O. K% T6 F( E- Q* Q0 U
- #include <mach/hardware.h>
7 K: B, ]/ |3 @! E. d - #include <mach/irqs.h>0 r' b3 w7 }. R' e' ~% U
- #include <asm/hardware/edma.h>$ M4 H6 |% r; M" J. f
- 9 P% @0 b" T+ r' x) b" H1 l
- #undef EDMA3_DEBUG0 |- o4 ^; V+ K: k; U; j
- /*#define EDMA3_DEBUG*/: w6 t0 ]" F9 O1 a1 K
- ' |% i( a; j! ~8 S4 p2 I5 ?
- #ifdef EDMA3_DEBUG) |* K& N6 a. c& }) A1 `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% {! ^2 C0 Y: l6 X: g* G) L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) f2 q6 U; Y+ g/ q: y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! S! e& O* Q* H, ^" y, z
- #else3 Z6 M1 V1 L% u' {2 L+ a
- #define DMA_PRINTK( x... )
# x0 d& R; R8 e3 j; `1 m - #define DMA_FN_IN8 |# o: p* Q. v( q4 w3 ?
- #define DMA_FN_OUT
! U" Z/ ]: C8 i' n5 {- f, U9 e' r - #endif* e; Y- _7 b3 M! z; p; [
# N9 G5 Z3 b9 a6 U1 a2 n: |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) Q" L% d7 k0 W' t- n: c - #define STATIC_SHIFT 3
4 z* d3 r$ A& l8 b) [4 a2 R) u+ E( } - #define TCINTEN_SHIFT 20
8 E3 T" d& E: @: K5 Y - #define ITCINTEN_SHIFT 21$ d( Q5 A% g& q0 V. q: }
- #define TCCHEN_SHIFT 22
3 m1 y0 y& @: Y0 G- I - #define ITCCHEN_SHIFT 23
& Q. g5 t8 ]. u; w: L4 E
2 U- e7 X8 o4 Z4 i( m0 T" ~- static volatile int irqraised1 = 0;3 D- Q9 Z j# g* R/ D
- static volatile int irqraised2 = 0;
Q+ Z) R( d, A( k4 N - $ }! y8 {) e8 q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) \* i- Z& `5 v+ z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' N% G, |/ |. @$ z. ]1 Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& O+ r; @; P# o' B) r4 N
- 8 G) j% l( \$ J: W3 q
- dma_addr_t dmaphyssrc1 = 0;3 q/ G$ \+ G" `" u7 H' i- Y
- dma_addr_t dmaphyssrc2 = 0;
9 d7 S% P; j' I" p - dma_addr_t dmaphysdest1 = 0;
% ]5 K5 b8 f! d! K& d - dma_addr_t dmaphysdest2 = 0;- `# T% A% T/ q* [' {/ _: k
1 l. ]$ F. ? g: t" |; {# l- char *dmabufsrc1 = NULL;9 z+ B8 x4 r W3 f
- char *dmabufsrc2 = NULL; u% v2 \% j8 y# X6 o/ I" l5 r
- char *dmabufdest1 = NULL;
# C. D Q) T4 f1 O9 @5 h - char *dmabufdest2 = NULL;
5 p; m: q4 n$ n" j
$ h3 C7 v8 v, ^- static int acnt = 512;
0 @8 C u( [7 b! U; h - static int bcnt = 8;9 Q) P6 d7 ^9 o" G- z; f9 ]
- static int ccnt = 8;
! C* X. n' _" J$ Q, [
~" L8 m, f: t6 \3 r0 P% I- module_param(acnt, int, S_IRUGO);. f- {2 j) z8 G: O) Z
- module_param(bcnt, int, S_IRUGO);
8 \" _' W$ H' A1 a% n: Y9 ^$ k ] - module_param(ccnt, int, S_IRUGO);
复制代码
% v- N/ Q6 l# A( ~. v% S: J7 f% [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ p2 p! @6 m: s& I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 s* ?9 e' j. `6 l+ Y$ p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ U% Y& j4 S3 L/ U" ?
& _. o# _4 F; m$ g/ i- i, |+ }" G. s5 A: z: z5 n* ~$ C, W& g
|
|