|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 U5 |- p( w0 C! M _4 ~
- [code]EDMA sample test application% Y! t) c5 o8 I- X
- /*
2 l5 j# ^6 u2 L* h { - * edma_test.c
7 J* N( }* `" t; I - *8 a) {0 {6 C, J" t- ~
- * brief EDMA3 Test Application, N j- ~* `% Z4 S( V; Z6 f$ Z
- *5 n8 ^3 B* O' y/ i7 }! h" n+ H
- * This file contains EDMA3 Test code.8 d* C/ t* r2 J
- *
6 X& V; Y- `; R$ Z% _0 @" @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! {/ x1 M2 Z# d3 I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 _5 Z* ]/ j. k
- * TO CHANGE., ?& P1 D$ g- e- @
- *
2 p2 h( w2 W% m$ j$ n+ C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 V1 W( w# Y7 Q7 e Z - *
+ ?2 r) T3 U) ?: { - * This program is free software; you can redistribute it and/or
5 n) r% V' u- ~& s - * modify it under the terms of the GNU General Public License as) {6 r6 F! k$ t8 a
- * published by the Free Software Foundation version 2.; b+ w7 W- |2 e
- *
3 P& c2 {" a0 ^# X9 w, f* V* W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ }& a3 n6 D# f9 T5 _ - * kind, whether express or implied; without even the implied warranty+ F6 g' h% t* V# V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( G, J/ o {9 ] D, p
- * GNU General Public License for more details.
6 E% x* e6 ]" E - */
& N# ]+ D5 M/ o0 p9 E
+ J' b0 J0 ]5 d# ]8 ?* }- #include <linux/module.h>2 h; t, ~* `9 N! z9 X) X! ?
- #include <linux/init.h>
7 Y4 V5 z+ n7 x* s( P" D: K - #include <linux/errno.h>- q; F$ U4 u9 x
- #include <linux/types.h>: X9 J8 H: x( s# {: g" k
- #include <linux/interrupt.h>5 j2 i+ b- p3 P
- #include <asm/io.h>
4 [. c7 E3 j7 x - #include <linux/moduleparam.h>
# R% P- V; h' y7 Q- Z - #include <linux/sysctl.h>
1 S6 x5 l) \7 F& m - #include <linux/mm.h>: r* l: s$ J* i# f
- #include <linux/dma-mapping.h>
. ?7 j: w u+ d5 P6 } - 6 R8 |/ S& A& c9 Y7 S' m+ G
- #include <mach/memory.h>
) _; M3 K e/ d% T - #include <mach/hardware.h>
1 d9 I; v3 j/ G - #include <mach/irqs.h>
3 ~! t+ g: F0 ` - #include <asm/hardware/edma.h>3 i/ X7 s) R2 ?; k
+ o: e! E9 B9 t+ v- #undef EDMA3_DEBUG2 C# J! {* a: V! z! P7 z
- /*#define EDMA3_DEBUG*/
% ^/ H; E! C. z$ g6 p7 d, l - 1 |* c; H) L) _3 f
- #ifdef EDMA3_DEBUG# ^8 K N& g/ Y( w) s5 G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. L' b+ f) D' e" O6 p, k8 _* \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) h t3 T8 ]( P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): g8 C; i( m. x7 e# L/ T& H% y
- #else- `, N L/ m) J! z
- #define DMA_PRINTK( x... )- k3 y( D; W( v0 t" o. a
- #define DMA_FN_IN
: N4 a/ Z' c& ]% W/ |& q - #define DMA_FN_OUT* V% Q2 ?( s7 K
- #endif
; Z3 C5 w4 C- |/ M8 ?( _8 ^( {& { - 4 C; z$ U! s# w+ v7 x( @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 R! k J5 r) X
- #define STATIC_SHIFT 3
' H2 T+ g/ K( F7 g) i3 b - #define TCINTEN_SHIFT 20
! e# r7 n2 l& @8 N1 V9 c - #define ITCINTEN_SHIFT 21
1 P9 a7 b3 c$ g* M5 @ - #define TCCHEN_SHIFT 22
! `4 Z2 e8 `. t - #define ITCCHEN_SHIFT 23; h4 T |% Q Q! w
- + _; b/ R- _3 E
- static volatile int irqraised1 = 0; |( M" `% z2 q [' S# Z5 \. |* ^6 G
- static volatile int irqraised2 = 0;7 A2 ?' @1 e F* H
9 ~/ |; D5 E3 y1 @: J* f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. S; [1 N& z' X$ W" Z0 ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 M$ L% s* o5 {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% L8 Z d/ C H, [4 a0 B u2 |, f$ X+ m
; P' |+ p" D/ ?/ M/ y2 _- dma_addr_t dmaphyssrc1 = 0;* O4 ? z& w! C" T7 ]+ i
- dma_addr_t dmaphyssrc2 = 0;
# h7 m) v5 L' k - dma_addr_t dmaphysdest1 = 0;3 w& x( r' N% X# u) P& ` C% x
- dma_addr_t dmaphysdest2 = 0;
0 s2 k4 @* y6 Q2 d/ u _
* \: w: t& \" ?: q% m J+ I- char *dmabufsrc1 = NULL;/ x& X3 \6 {* \
- char *dmabufsrc2 = NULL;
8 O, C. r, M1 I, f+ K; @3 Q# a - char *dmabufdest1 = NULL;" Q$ E9 _% w1 y: b" F
- char *dmabufdest2 = NULL;. U- u! ~! U" e
& r, s' Z5 l3 f$ W* a/ _! B' Z- static int acnt = 512;
! Z3 Q3 ~# Y$ s' n& B - static int bcnt = 8;' O# U- n- B0 m3 K; k y J# D
- static int ccnt = 8;
# x( R5 n. [; z* |) Z6 @+ Z
8 M; l5 Z0 Z9 V4 q* z6 x: `- module_param(acnt, int, S_IRUGO);& \8 d1 `- J; o+ D' T
- module_param(bcnt, int, S_IRUGO);! P$ w0 B! V2 O) l
- module_param(ccnt, int, S_IRUGO);
复制代码
( ?* u: s! O1 ^" H! `
. C# ?! |% ~4 j% h( s" J" H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: E! j0 r5 g' d; N0 \+ u1 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# Z0 y8 p. Q% v. d& I4 ^/ j+ e: A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ z, x! L3 Y1 O L2 x- i5 }( u5 v R( k+ p" Q; a- K& r. i: d
8 x g# R' _, e& w$ O! }
|
|