|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' A2 D i. H2 t% n9 \2 C) T" R! D- [code]EDMA sample test application* d" A: i7 p, T0 m) p8 E5 ~& S
- /*
: j4 Z# `! @3 G0 d0 ~' T - * edma_test.c
B, H. O+ @) n2 |9 W' a6 q3 Q' S5 G - *
& o; \. @ Q! B1 b8 p - * brief EDMA3 Test Application( ^5 u% H6 L9 t. z, j, q1 R
- *
# \9 V' F6 u" R1 H3 H q - * This file contains EDMA3 Test code.. }# Y9 M3 x* F: g# m
- *% [+ j% y( s1 k* i( u# r! A, T! J+ m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ }6 \ t2 r# [6 x2 u# }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ I1 }* I1 a' U* K' [ - * TO CHANGE.. W5 @& b8 A* a9 C) D
- *
- H% }: s1 A( Z, e6 u& P) w$ L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& y' ]1 m, g7 v( r/ V7 w5 v
- *
1 Y/ Z! B' N( L) d+ k - * This program is free software; you can redistribute it and/or
1 \& B' ~, W( U, K - * modify it under the terms of the GNU General Public License as
" ]+ j8 o2 D d3 N - * published by the Free Software Foundation version 2.! i( z4 Q4 O/ p* |& C
- *
' N8 o1 J! z/ h/ K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! g0 L+ h; `: G7 j - * kind, whether express or implied; without even the implied warranty Y: A& t. k0 t0 n/ \8 v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) G: c2 t* J6 I. { - * GNU General Public License for more details.
* j4 z% [# T! k8 L8 t, s: s - */% [8 y- C% [1 ? z' |9 B
0 U7 v! d5 a9 V3 w R% P- #include <linux/module.h>
( u2 ]" q, ?* Y' g: C - #include <linux/init.h>
- F; R C/ r# O7 w: Y, x - #include <linux/errno.h>$ S. Z/ U% u) P5 b
- #include <linux/types.h>
5 ]& }( W( ]" G8 h4 c/ E, s8 f$ I$ D - #include <linux/interrupt.h>& \& D4 R% V7 k- A3 ~
- #include <asm/io.h># W" {2 k. @3 ]1 q- X5 ?% H
- #include <linux/moduleparam.h>/ t) |9 T/ s; ~
- #include <linux/sysctl.h>
7 v; c9 T% [; R - #include <linux/mm.h>
! P" z, `% Y' @/ t$ p+ i8 Z - #include <linux/dma-mapping.h>4 r! p4 c; D5 G1 H* O- P m
- # U: J8 S4 g3 ^
- #include <mach/memory.h># I0 A+ N; i% u, \& h
- #include <mach/hardware.h>
- I' w" l; l& w. s" D - #include <mach/irqs.h>
, \. z- P" {4 n7 Y, C0 t- C - #include <asm/hardware/edma.h>
( V' O- { F6 t7 T0 q - 8 D8 z- j4 C( r
- #undef EDMA3_DEBUG
! P# h' k- u3 I: X, @ Q: D6 E - /*#define EDMA3_DEBUG*/# G' \ c- O# j0 J) Y; Q
- & n" ?# `/ T. z- P# g' m
- #ifdef EDMA3_DEBUG
2 X, U( i) l) J/ T& ^& f* j9 C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( g2 V$ N$ A4 m9 ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 y& r `: k; J6 ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 L: \/ W/ r* r* W% }8 N; V - #else7 O3 D q% i7 n1 ^
- #define DMA_PRINTK( x... )7 G8 C& W, w% N7 q9 f, _, ~
- #define DMA_FN_IN
8 I3 Z( |6 q0 N" }5 I - #define DMA_FN_OUT, `5 Y( `0 J7 f; ?% v* g1 d( p" u
- #endif+ S/ ~, l5 w7 {6 s: Z
9 H- I2 @" z' j m, \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) Z1 Q5 X8 R/ V" v5 Z; l
- #define STATIC_SHIFT 3
?& T7 Y# b, r# l - #define TCINTEN_SHIFT 20
1 W7 w8 S9 S, i. j - #define ITCINTEN_SHIFT 21
7 F/ f5 ?( w1 t2 T5 ^- A( p( M - #define TCCHEN_SHIFT 22
" O k1 ^/ Z F s - #define ITCCHEN_SHIFT 232 f! g2 `/ Q6 c* q4 b, F8 [
* g) j$ H- |5 S4 ?: I9 H- static volatile int irqraised1 = 0;% X# L0 V3 S- d
- static volatile int irqraised2 = 0;& I- P1 _+ V# F" c5 y
- ) a: N. v0 A/ |/ q$ {4 N2 V+ w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Y0 o9 Z- `1 ? s% v7 u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 d: T* u6 y( m X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 z' J0 |3 P9 g% f$ N
' @9 |' h" H4 U1 ~- H- dma_addr_t dmaphyssrc1 = 0;, [" W) c0 ~1 o# K6 Q: O+ H/ x1 V% l6 X
- dma_addr_t dmaphyssrc2 = 0;
0 e* B/ U2 @' O: o9 G0 r6 U - dma_addr_t dmaphysdest1 = 0;
5 ~! z/ ~1 J) l2 t; A) N5 }3 a o - dma_addr_t dmaphysdest2 = 0;
2 S3 f- b _) ~% p& k
8 |" U% L$ g! O* o, _3 E- n- char *dmabufsrc1 = NULL;
" P N9 M5 [$ F1 J - char *dmabufsrc2 = NULL;
2 k4 l. k' y. T$ ~ - char *dmabufdest1 = NULL;
0 f& B! G9 X. X9 _* |1 Q+ f - char *dmabufdest2 = NULL;
- S+ H0 p: B: @) ^0 x - 0 e8 G0 q7 E8 j% V3 g/ ]
- static int acnt = 512;
T4 a( O( x7 M - static int bcnt = 8;
' C2 x4 t+ H. g- I5 T - static int ccnt = 8;
) U E* d& O6 I, L; e9 D7 A2 w - g1 R$ j+ O! q5 P; A9 o" e& o
- module_param(acnt, int, S_IRUGO);/ P2 Q: \5 J6 c& ^0 R) K
- module_param(bcnt, int, S_IRUGO);" }3 m7 j- S. G9 U$ z
- module_param(ccnt, int, S_IRUGO);
复制代码
! z1 G/ A1 P* t( m5 V* Y* I& o0 o& g2 E; d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" ~" f/ h6 j% j8 D' y. d4 C$ t+ carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ @0 k# }; A6 x! Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 K6 C. i- x7 w1 X1 h ~
, X1 c: q, o! I, y2 h* X( Y4 S
; c, l# r6 b# x; A& z
|
|