|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * |: F/ z1 M5 N# z! q) K2 j
- [code]EDMA sample test application$ q+ U+ n9 v3 c) ]( g. ~7 S3 B; |
- /*7 |* @2 T2 C. |3 i- U# x8 V5 N' Y
- * edma_test.c
# N8 r4 A( A5 j# b$ P - *5 o, H) W: `1 J* ^( k7 ?
- * brief EDMA3 Test Application
! q4 X" v: }3 c! ^ - *
. _8 q' h7 M* b _- l5 t - * This file contains EDMA3 Test code.' c" f! C: c! f8 ]" Q
- *
7 s4 E/ f' k' X) Z( x9 ^! n/ k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, ~7 [. O; i7 R8 |" f1 V; D6 ]" _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) D! w; u9 U8 k: F# k
- * TO CHANGE.
; K, {( l' R2 a& D# h I _ - *
9 ~7 u3 |& W' E6 J1 Z9 D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! T5 P/ \* L. B% w
- *4 g. ^6 x; x: H
- * This program is free software; you can redistribute it and/or
4 ~) E/ {9 ~; |7 q7 P8 g0 L! y - * modify it under the terms of the GNU General Public License as
% b }8 P& F3 ?3 z: x - * published by the Free Software Foundation version 2.
/ i; k0 {. L2 p( O2 r, u - *
$ I- B- m7 G" L2 e1 k0 Y7 ?0 a& n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 x7 W: |. \" W9 v0 Q, R: t: a
- * kind, whether express or implied; without even the implied warranty
$ d1 X; Q0 Q+ V! c& a/ P J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' F$ e- C6 U; M6 V/ C0 Z. ~ - * GNU General Public License for more details.7 n% G2 i9 w6 C8 V+ M
- */
* B; T4 p; o0 z: h8 o4 ^ - " ~* g- g' z9 s6 N, S
- #include <linux/module.h>; w* _) V) K* L
- #include <linux/init.h>
7 w g, d7 j8 S( v! f( u - #include <linux/errno.h>
/ |8 i% e& t1 v+ n- g. _4 d - #include <linux/types.h>/ B+ M) r& Q X! k& N6 N
- #include <linux/interrupt.h>4 `2 m! Y+ U' M9 d6 p- {
- #include <asm/io.h>4 M O! m4 h0 r) u2 \
- #include <linux/moduleparam.h>: l0 P/ F6 \- P) J6 X' b) V4 ]
- #include <linux/sysctl.h>1 `1 A( [, B, n# F6 X
- #include <linux/mm.h>
5 C/ s; M( |& M, w - #include <linux/dma-mapping.h>
$ @ d/ t; K( Q - 2 w+ [# C f- g u4 H
- #include <mach/memory.h>! g; n7 W1 X7 c5 c' }% O" S
- #include <mach/hardware.h>$ L, r/ y2 f; l, f8 D( M" ^# M
- #include <mach/irqs.h>2 g2 v+ j* _! `% c
- #include <asm/hardware/edma.h>
, U& I: O" l- r
, W5 x9 J+ V5 E4 G; ^- K ~- #undef EDMA3_DEBUG5 Q/ o& B+ a8 Z( T a
- /*#define EDMA3_DEBUG*/
" n& A' v) ?; h$ Z, t; v
/ J! G+ P/ L7 o* {9 V ?, t- #ifdef EDMA3_DEBUG7 b+ R. Y) A# N' c" O) D3 v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 V6 z" \! n( C( T) p) [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! N8 Q) Y$ _8 B' R' Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 P1 L: T( b4 n/ d
- #else/ ]9 a) S* a1 ~+ x- ]/ j% o! |
- #define DMA_PRINTK( x... )
' W( @, e# Z! g0 R - #define DMA_FN_IN3 c: Y6 ?' b7 W9 g
- #define DMA_FN_OUT" {; F+ E3 p# F" \ P+ P, S; \
- #endif/ v- U$ M( ^5 q0 }" {+ T
3 W' g( L& q+ f, _2 A6 G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 q1 I+ p; h% i" q3 W
- #define STATIC_SHIFT 3
) G( q6 Z4 Z5 V" W. H0 I - #define TCINTEN_SHIFT 20+ C* p9 M( [+ d1 M
- #define ITCINTEN_SHIFT 21
+ Q% v. Q& H9 f; U; y - #define TCCHEN_SHIFT 22 w9 }& a( {& N
- #define ITCCHEN_SHIFT 23
, i5 F! ?2 }4 ?8 I - . a1 o: k4 r' t5 u
- static volatile int irqraised1 = 0;7 p$ Z9 ]# x* l" [9 U/ v& Y
- static volatile int irqraised2 = 0;
" o7 A* _9 ?' ^, W6 W - $ K% G+ k7 M" c. B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 i4 r" I9 ~- ~* S7 c* @: s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 x! G9 A( @& x- W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- B7 A7 a4 N( K8 X2 e
- o2 P) v* B! k" `% G; I6 F
- dma_addr_t dmaphyssrc1 = 0;4 p+ ]/ L3 C3 M0 f- P
- dma_addr_t dmaphyssrc2 = 0;
7 u- ^& b2 z, X- K" |8 {$ Y0 k - dma_addr_t dmaphysdest1 = 0;
$ t( v/ ^2 {& n& X) D4 W9 \( k' l - dma_addr_t dmaphysdest2 = 0;
; S$ } V; i! i5 I) h) D+ M1 J$ Y+ {
: g9 E$ T( q% \. [3 G4 S/ y- char *dmabufsrc1 = NULL;
" ]5 L% I q4 M1 t3 X+ K - char *dmabufsrc2 = NULL;2 G [# v E) C4 `0 G3 N9 f
- char *dmabufdest1 = NULL;5 }" p; p, S) K9 R( ^
- char *dmabufdest2 = NULL;
/ X2 j4 \9 q+ e* K* E% m - ' ?: P# B y$ s& B% H1 W' r3 }
- static int acnt = 512;5 D( ?- D) i8 w( p. A* v; B
- static int bcnt = 8;
8 T# I/ @3 d ?' e- d$ ? N - static int ccnt = 8;; F! v1 u2 Q7 z
- . { j; D" G. Y& Y( ~, L
- module_param(acnt, int, S_IRUGO);
* K* W3 W6 K0 B: o - module_param(bcnt, int, S_IRUGO);8 k* |- k7 e6 X2 u: ^# w* I
- module_param(ccnt, int, S_IRUGO);
复制代码 - j) o0 v4 ~. {9 G
* d6 J: k7 k0 B# N8 b6 ?/ v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ n! \. E- t: w( P/ D4 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) u2 Q2 p: c o$ _% ^: H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& Y. q/ u5 `! |+ y; W! e& h
: q( g3 \ ?7 i7 P# z6 |8 Q" t$ E4 w) I1 l
|
|