|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- R) [6 z+ g/ U5 e) w- [code]EDMA sample test application
0 B: I4 v- A4 C7 d3 w. u1 p - /*& }) i; B L/ u1 h" x3 `# l
- * edma_test.c
2 g1 h' [" @$ t0 i3 p) O: p6 x# q - *" }! G) [8 ~5 h k! P
- * brief EDMA3 Test Application
) ^8 e P/ z- I; x s - *
( a& j& f, H1 z! ^& Z: \3 O" T* a - * This file contains EDMA3 Test code.
$ m8 N! f- D8 |( |1 `8 O& e - *$ P: M h( X0 e0 f6 Y. k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 |; R- l" v& _7 w, N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 A" n H3 @& Z
- * TO CHANGE.
- g$ J; j* Y5 ]5 q# _* y! ? W - *
4 _& p, u( C9 I- _3 s5 U3 _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 R& \; {0 \' S9 c$ i5 _ - *" u5 p3 G- |8 R4 c" V
- * This program is free software; you can redistribute it and/or
' R& m* ^$ `; H: B2 k8 k - * modify it under the terms of the GNU General Public License as% Z! ~% I4 w7 Z1 T/ E& n
- * published by the Free Software Foundation version 2.
) ?& R2 k* M8 d% {/ D9 l; D - *
8 H" g& g) i3 u, x$ r+ L. e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any ~0 b* {0 n1 ^& H t4 e6 o
- * kind, whether express or implied; without even the implied warranty
$ [5 X2 P4 i" `4 j1 x0 i. \' W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 W8 N- g, N) A9 t: g( L
- * GNU General Public License for more details.: q9 W; |- X; }
- */
! S* f$ W9 U8 `! S, ^3 m+ S' q$ |) Z
) s& H1 ~: v2 b. M; }- #include <linux/module.h>
+ a, `6 n; F5 d; h - #include <linux/init.h># V6 |* V% Q+ T: T9 H* D* ?
- #include <linux/errno.h>
4 L3 S* }9 S) e F7 a2 o7 w - #include <linux/types.h>
, Y) } v% E( [7 p" E' v$ n - #include <linux/interrupt.h>
7 J3 p2 B& e2 h& Z5 }6 ]* G - #include <asm/io.h>% y, q# Y5 J) Y0 R% ~$ @" Q, P4 w
- #include <linux/moduleparam.h>. o. E5 z1 F6 b* ]4 V" X$ n. ?
- #include <linux/sysctl.h>5 s" M3 R, ^' v6 k1 b/ A; `7 V/ \" _0 c
- #include <linux/mm.h>* Y' u0 Q3 T0 a4 l: n* q m
- #include <linux/dma-mapping.h>
, C2 e- n: X0 S$ S4 G7 q; H% j
& P a. v; O+ }: u$ Q2 _; x- #include <mach/memory.h>
) Y l& S+ z: Q$ v - #include <mach/hardware.h>+ ]8 W5 @* Q, H- j* y
- #include <mach/irqs.h>4 E; h( C$ A9 N f9 {
- #include <asm/hardware/edma.h>+ W" A8 x: X. A3 |3 L# m
$ z6 u; [0 n/ w. R& U* }- #undef EDMA3_DEBUG& [& ?: a2 \+ X' U
- /*#define EDMA3_DEBUG*/! @. i: S: W: H& Y5 P: g0 Q
! u2 X+ p% L8 K3 s- #ifdef EDMA3_DEBUG
/ k) U% ~6 m$ T/ }/ i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' M. ^# _& C: m: Q' M: Q p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 K8 d* O: o4 x$ l, \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 g% r" r- p2 y2 `( r3 b* n" O - #else. a8 o! t2 E! ?% l% `" E9 V1 S; b
- #define DMA_PRINTK( x... )' T5 j* U2 k* t+ A' `5 C+ p
- #define DMA_FN_IN1 d$ O5 O9 V+ J
- #define DMA_FN_OUT
8 ~5 A# U; \6 D- j% j; s/ V - #endif
3 Q0 m' t$ W- E% C6 [. [
1 ]+ A4 \% R5 J: M# P& ~: o/ v6 r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ X) E/ ?( v) r" q0 t3 ~6 q
- #define STATIC_SHIFT 3
0 z/ q5 L' B2 b0 N9 x; y - #define TCINTEN_SHIFT 20
/ `6 a4 A! m$ h& X7 z w( h* E( i - #define ITCINTEN_SHIFT 21
% [& Z* |- ]4 q - #define TCCHEN_SHIFT 22
* e1 `' Z" [4 T1 j& y( f - #define ITCCHEN_SHIFT 23
3 r- l) t- t( V
) D* J$ K& x2 E4 ~- static volatile int irqraised1 = 0;
2 _" \* Z4 R) G6 h: V E# ? - static volatile int irqraised2 = 0;! a6 G) \/ {2 W) v; h2 ^& W9 r
- $ m# I3 c9 ?' H$ Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 Z; n; e& h f4 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% I. S# G3 s5 b7 o7 q) `7 S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! `4 Q) t8 A6 S M2 m
7 d, ~# M, E) ^* a1 r( F# V5 R7 _- dma_addr_t dmaphyssrc1 = 0; `0 x* h$ B( g2 N7 ^; u9 ?# c
- dma_addr_t dmaphyssrc2 = 0;
$ b' U9 q% [: @6 B. `: s I - dma_addr_t dmaphysdest1 = 0;4 G( D. A9 a6 c# x/ u% U( t
- dma_addr_t dmaphysdest2 = 0;1 N( Z9 [" H$ {9 ~
4 h3 E Y% ]5 A/ C7 @. V$ W9 y7 E- char *dmabufsrc1 = NULL;
( M- r* U" s* k# e) v, A5 { - char *dmabufsrc2 = NULL;
) d! d1 k1 g* j" C% k) [ - char *dmabufdest1 = NULL;
' T3 d; R5 a1 f0 i! s2 G4 N - char *dmabufdest2 = NULL;/ d4 V0 O! s6 y" H K
& \4 U- y. g) a6 y- static int acnt = 512;
. J+ V) ~& d7 y7 |. m2 M6 J - static int bcnt = 8;% Z! ^& c+ Q9 @6 B* z3 c' |( R
- static int ccnt = 8;! B7 `" x. ~8 F( {7 F# ]6 V
2 Y! Y/ q: U* g% [5 e; ]$ t- module_param(acnt, int, S_IRUGO);; @1 ]% E' R& `. t) O% I; Y" u
- module_param(bcnt, int, S_IRUGO);
" g3 |. f7 B; Z - module_param(ccnt, int, S_IRUGO);
复制代码
! w b1 a6 D& y m2 {3 X0 D
) a" d8 f* U( |7 G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 ~% F! @9 {" b0 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 g: P" m7 P3 ~# D& f. X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* r8 t1 R9 h% {5 d; e6 B$ V8 G! h$ F1 w* M
1 W+ _4 a+ o- p- j
3 I' j" M8 M5 m8 S6 w) B8 c |
|