|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ w* H3 X2 Q# M- n4 b; `) X, t- [code]EDMA sample test application" R7 i2 T* W% p5 n4 _3 ]7 S+ G
- /*% t, z5 Q# W; W* U
- * edma_test.c C6 x+ h5 N( m( K
- *
( T' o3 @( G' x; E: g - * brief EDMA3 Test Application k1 _. a, a) e% M
- *
( ]9 g3 H& K& Q( {9 T3 _ - * This file contains EDMA3 Test code., t% o1 @' f8 i4 `! I
- *
5 t0 x U3 K! n$ D8 m" U* p# T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( {& R0 |9 y0 Z+ q+ v( Y/ b# X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 H! i/ n _6 J# w6 [$ |1 r - * TO CHANGE.
- O4 g+ Y8 F9 Y0 L# x - *2 z# S3 A: x, ]6 L* h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, X! a; V: k2 N3 [/ E) P
- *
$ Z7 T: o& n7 w. u5 ]- o - * This program is free software; you can redistribute it and/or
4 ^7 x$ ^# ]8 s q6 n3 X, m: M - * modify it under the terms of the GNU General Public License as
7 F( A4 l. W% J4 w2 r7 m% k: N2 n - * published by the Free Software Foundation version 2.
5 @# b- t/ Q/ \/ v! o/ M - *
9 X3 G% v% }* J0 y0 u) P$ ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# O) }4 H/ m) K - * kind, whether express or implied; without even the implied warranty
- I. J8 `1 w9 k* j P& W9 ?. @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 ?) h0 B* T0 ^ v+ q4 ^4 M
- * GNU General Public License for more details.
* @& z$ Y# [. X8 f% T - */
- Y: p* y* f/ a" v5 k
' Y! {7 V, P' G% w0 _- #include <linux/module.h>
& C% m6 }$ \2 j" }# u" k - #include <linux/init.h>) n- y) i( e6 l5 R" `& N
- #include <linux/errno.h>4 s: H# u' H" I$ Y' v* A$ i
- #include <linux/types.h>2 B% P" b# K8 ?5 R2 k. z
- #include <linux/interrupt.h>3 ^; O2 ` _+ w7 b* \3 s; l
- #include <asm/io.h># J5 o, ^8 T( d. O* o; o, F. a
- #include <linux/moduleparam.h>2 X) Z, z( T1 N( v
- #include <linux/sysctl.h>9 U. m$ L, X8 T" y- \
- #include <linux/mm.h>, j% @) L" b6 X3 I9 C2 \: f
- #include <linux/dma-mapping.h>8 n3 F+ s* k: G- k
9 n5 w2 B1 {* W4 a- #include <mach/memory.h>, q7 W/ g3 Y( {$ [* W+ z# u; u
- #include <mach/hardware.h>$ O7 `; I$ N8 }% x! ]/ j9 ^2 X
- #include <mach/irqs.h>
* k! \, U& i! Z$ @& f% Y - #include <asm/hardware/edma.h>
( h" M! H9 P3 v' C
" _2 Y/ J8 ^* \" |, M/ y- #undef EDMA3_DEBUG
) b) w0 N! X5 G3 I5 |: x - /*#define EDMA3_DEBUG*/: n( W; S9 f8 x
- 9 J. _1 f4 v* C& ?7 A3 n2 g& i/ j
- #ifdef EDMA3_DEBUG
4 \5 \/ }7 B! r+ \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: S- L. g8 F% S' X8 O! ]7 Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 i- a4 J" m3 C2 K0 t/ h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- |) i- k" S- c& Z& Z) S J6 U& O
- #else
, u( B W2 f) @1 { - #define DMA_PRINTK( x... )7 G5 G! b: b8 z8 S' `% y5 t' C) x
- #define DMA_FN_IN1 L- h% [) y& p( \
- #define DMA_FN_OUT; W$ u, @2 }. A5 S# e6 `
- #endif# s$ Y" S& }- A- l/ h
' \ \9 n+ U. g% i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) I6 d1 e- C1 n- ]5 i& c8 V - #define STATIC_SHIFT 3( x; a0 P x, U, P
- #define TCINTEN_SHIFT 20: H6 e) L0 A' ]( {
- #define ITCINTEN_SHIFT 21" {6 K+ g, d p3 U, h
- #define TCCHEN_SHIFT 22
7 ]3 C$ i& V U4 H+ }/ A- Q% g - #define ITCCHEN_SHIFT 23
& g/ q/ x3 `' I' Q2 z
3 O& {3 X2 K( x: _+ Q- static volatile int irqraised1 = 0;
2 i7 w6 x$ x+ `% y - static volatile int irqraised2 = 0;
3 G' O) i" V. {" Q6 m - & [) q. n/ i" H: z, G# N5 p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 W7 c$ D; N9 h% Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) e. m0 f; M' e+ p7 E9 V2 F5 |& n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) H. }2 q/ |9 W6 L% |
6 p- G+ u4 ]7 G- e3 x5 x0 h- w: q, I- dma_addr_t dmaphyssrc1 = 0;1 c/ q+ v' r# K- x! E+ }
- dma_addr_t dmaphyssrc2 = 0;
. c5 `" f$ s. u6 p" Q4 v" ~ - dma_addr_t dmaphysdest1 = 0;+ s/ o! Q; i! I i" E5 P9 P3 v8 b
- dma_addr_t dmaphysdest2 = 0;
& }! a9 K# C r0 r, A( v
$ f2 b+ Z" |& i, Q0 Y9 I* B: a# K% x3 M- char *dmabufsrc1 = NULL; w$ n6 |, @' y! m I) E
- char *dmabufsrc2 = NULL;9 O4 e# j d9 v' _& Q: ~% B
- char *dmabufdest1 = NULL;: e& Y# Q! c2 l
- char *dmabufdest2 = NULL;
/ O1 Q- V% w/ n4 B& L# c - 6 X$ d2 s& s) i/ V
- static int acnt = 512;
! I) t( b1 T7 d - static int bcnt = 8;, k( O9 L4 L8 t/ i' E- ~
- static int ccnt = 8;. W0 v1 s) u1 ~- m
- " I1 i1 |, e0 G" P: u- z$ f
- module_param(acnt, int, S_IRUGO);
" q2 y! ]1 h+ P6 k$ r0 W! e - module_param(bcnt, int, S_IRUGO);
+ F2 }2 J0 k4 @+ y3 S e - module_param(ccnt, int, S_IRUGO);
复制代码
+ `4 n' t, |% ^, s
- b& _' \: O3 l5 a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ S4 n) C) d4 p5 A- i+ @1 m' ^0 ]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 L+ P3 y- z, Z0 n. r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ f( Z( C7 I0 Y% W3 k6 z- d, J; X% }' h# G+ `& |: L$ t5 i2 Y0 I
/ |9 s1 I" b3 `2 `1 g0 q6 F2 J |
|