|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / q, d" h/ W( W/ u( a7 }9 {6 b% K
- [code]EDMA sample test application+ L! a9 f* f6 s5 _; V* O; ?4 T8 I
- /*: C5 P; E& ~/ ?
- * edma_test.c4 r9 n7 ?2 L' u# Z* w, |/ S6 |9 ]0 ]
- *: I1 G: ~: _) T7 e9 ~& x/ f0 ^* }
- * brief EDMA3 Test Application
$ y. o) D9 M5 T5 Y$ Z; q - *
; h J, x, {: d# M- r2 \& r - * This file contains EDMA3 Test code.
( k0 @$ K% x' u/ _% M: i - *
/ B( K( }( a$ O5 n8 L7 Y2 O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 J& A& K; r% T& y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" k. T* b, B4 J8 \. ?% G - * TO CHANGE.
~9 |. Z9 z6 E, k) x - *
4 h8 s& f' F1 D6 I6 g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 t7 G; e! f& \9 |! h. C" { - ** Y9 y( ~- i5 F' B+ W
- * This program is free software; you can redistribute it and/or
3 N- `3 |: W6 a3 c; d* r - * modify it under the terms of the GNU General Public License as1 h1 ^% J: M3 Y1 \% Z0 ?$ x
- * published by the Free Software Foundation version 2., ~* g( A5 ?, p7 ]' S6 P6 I
- *
) g0 Z8 n$ Y% z- D! ]/ X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 T, Q1 S- o. R: h* a2 K - * kind, whether express or implied; without even the implied warranty
7 \$ _: [! ]/ C- ~1 c7 a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: f. ~+ G1 }- B' K$ c$ K
- * GNU General Public License for more details.
- |4 P7 l+ c3 {$ Q5 G2 m! { - */3 ?3 N/ b3 |. ?% ?! ]+ w) K
F4 J/ ?2 V/ y$ t: P5 ]- #include <linux/module.h>6 i6 M/ K% P" i- N* J+ l
- #include <linux/init.h>6 `; ]. N" k7 C. C/ c
- #include <linux/errno.h>
4 D# E }" c) H6 U7 o - #include <linux/types.h>- [$ g4 G8 X/ P
- #include <linux/interrupt.h>
1 @* t% n; Q6 M - #include <asm/io.h>" f$ R6 C8 Q3 X/ @% O
- #include <linux/moduleparam.h>
' S* l7 [/ z$ F5 K2 R5 T4 O - #include <linux/sysctl.h>
# {$ H# Q8 [* w - #include <linux/mm.h>
& A$ q8 ~' Y3 E+ P4 c. _6 _9 i; d - #include <linux/dma-mapping.h>
$ [) g1 X+ E( t, G8 v
) r. \% p# M* U) ?# t) L" \- i- #include <mach/memory.h>
3 e3 Y' H( z7 M& u p5 \ _/ D - #include <mach/hardware.h>6 E6 H) C4 w ^3 x E7 I9 h
- #include <mach/irqs.h>3 p# K1 _, ]1 R2 m# r
- #include <asm/hardware/edma.h>- u# Z8 U* V: g6 U* x
- # O7 v+ n* d4 }" c0 K
- #undef EDMA3_DEBUG, b) P& w4 ], u
- /*#define EDMA3_DEBUG*/. m y+ n ~+ f/ Z2 e4 u
- 6 }* g3 a4 F# X3 A: e1 p' h
- #ifdef EDMA3_DEBUG
; j. o& ~( b- z& D1 Y1 d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): N2 q& C! T& W8 J) H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% }$ @4 d8 b2 D3 U( w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 f4 x; `: c/ J
- #else) |' i% @# s0 J
- #define DMA_PRINTK( x... )
' a9 U$ g- t9 H. v9 N - #define DMA_FN_IN
* Z8 w& J. I/ B d% @; A) O& V7 B - #define DMA_FN_OUT
; o/ Z7 i4 i+ \: a: ~$ ] - #endif
( ^" N3 h R# g$ ^ - 7 n2 d' Q" Q3 s T+ i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): T0 y- w m8 U
- #define STATIC_SHIFT 3
" d2 [: J7 {, i3 s; v9 [ - #define TCINTEN_SHIFT 202 P8 t. q- I9 ^3 X" n# y% Q
- #define ITCINTEN_SHIFT 21
3 n: N" f! x a( g. F - #define TCCHEN_SHIFT 22& U: \' N* Y6 p
- #define ITCCHEN_SHIFT 23
3 K# ~2 w/ h/ b# |) L8 H
G& o: |5 {) H& S K3 k4 j- static volatile int irqraised1 = 0;
1 [# z% q( A! U* i! r" O' q - static volatile int irqraised2 = 0;
$ j5 G% V3 p5 p - 9 j5 z- d. d: L5 t* ~; d5 |. y' u0 x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 \& Z5 P8 F( j. H" N6 c6 g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 r. m# W- x2 b& E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 b) J4 N5 k8 t( A7 e# C0 Y - 1 u. A& b) k: P2 z0 g
- dma_addr_t dmaphyssrc1 = 0;
' K7 h# s8 Q% i1 P$ W0 p+ b - dma_addr_t dmaphyssrc2 = 0;
5 Y B% W. ~! [% B - dma_addr_t dmaphysdest1 = 0;) Q f* A+ M! A
- dma_addr_t dmaphysdest2 = 0;+ U" x$ b! I0 w4 ]8 u% e
- $ H8 F) L. v' t0 X( I7 E. I
- char *dmabufsrc1 = NULL;
* N% k+ q- R& T - char *dmabufsrc2 = NULL;
, f4 o3 L1 f1 b - char *dmabufdest1 = NULL;# k4 M0 L. D/ Q( j8 b" w
- char *dmabufdest2 = NULL;
6 d" s+ g! a& z o# d
& w- d0 r0 d j8 f! k- static int acnt = 512;& `; b" A, n, N% B; H' P# d
- static int bcnt = 8;% k, D2 q5 [4 g9 ]
- static int ccnt = 8;4 V! }2 z5 k- e3 s# A+ m+ R' B b1 R/ _
& D* u0 G% l7 X- module_param(acnt, int, S_IRUGO);
5 R4 q$ x1 ?2 j. m9 n - module_param(bcnt, int, S_IRUGO);
6 N2 N1 e' a5 F5 g - module_param(ccnt, int, S_IRUGO);
复制代码
7 w% v4 L* M" ~; }) t; R ^! b% X! d. ^0 A* h t, Z$ D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ V; { w' Y' h8 X7 {$ i% Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" `2 ~) _( e# M- T! I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 V9 p, O4 p1 |9 `" |/ O) r+ J- v+ \. Z1 {2 A- u; g
+ m9 Z7 c) T$ y
|
|