|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % |+ n% h' p. F2 k/ H
- [code]EDMA sample test application# C P! _1 s* V5 |9 Q; j
- /*
# ?6 J% D& ~3 e - * edma_test.c
( b% f7 R5 T% a) i/ u* _* _/ v, s6 l - *7 u9 V9 H# ?5 x1 G9 y$ h* T& D
- * brief EDMA3 Test Application
$ \& C3 T" S4 e; x' W) O7 i - *
& f+ G. t6 x9 @, L6 D - * This file contains EDMA3 Test code.
& V. E( o1 ]* \8 O4 I. h8 Q/ ] - *# @- h0 F: q b0 }3 ~6 n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! ]! z! ^/ @" T: Z2 B7 ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. c( i% C) ^$ ^* X$ G/ E0 t - * TO CHANGE. L- ?6 y( A" t2 z
- *
, r' \$ I$ z: G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& A8 i* M6 f/ ~ - *5 x& D% a6 [; G4 n* s& K
- * This program is free software; you can redistribute it and/or0 D9 q& m. z) _4 [% Q" j2 G) z( g
- * modify it under the terms of the GNU General Public License as, U! j5 W) R; Q: f% I
- * published by the Free Software Foundation version 2.5 {" {1 ~3 h6 |' Z" X
- * s# x4 f$ L9 L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 V7 j' A+ N' F8 t& Y; U9 M: q+ J - * kind, whether express or implied; without even the implied warranty& v& M" B1 O% y2 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, c+ j' U; J6 @- d% k. ]
- * GNU General Public License for more details.# a* h1 U- E/ ]1 _ U) n: N s' D) R
- */
7 N- Q# g- \( j8 p, D! c( w, {& M( @
/ G: {; O" [9 j: s- #include <linux/module.h>' e8 T: W" s7 h! t8 G. W
- #include <linux/init.h>
* l7 C6 B0 n# c/ v3 N - #include <linux/errno.h>
7 C2 B$ Y o. o& p/ u% o - #include <linux/types.h>: k, p0 N( s5 X1 s4 z( g
- #include <linux/interrupt.h>/ `& v6 }) ], Z9 Y- ^" S2 g5 q
- #include <asm/io.h>
C: Y/ ~) L0 l( R& ? - #include <linux/moduleparam.h>
! }: u, q+ r* \% N1 C. T' N - #include <linux/sysctl.h>; h, `8 W) E2 `7 d$ H
- #include <linux/mm.h>
; O5 K$ H* t3 f8 M P! D - #include <linux/dma-mapping.h>
5 t- @3 ?- i4 P5 q3 [ - # U# f2 f8 t( H7 I! U3 u8 l: Q7 F" N
- #include <mach/memory.h>
7 d ~+ u m# h" N E# n- k - #include <mach/hardware.h>' _, |) U' k+ r! z
- #include <mach/irqs.h>
4 J9 o% j' m; }/ Z5 T7 g) i! _$ @' J - #include <asm/hardware/edma.h>' V! G1 t+ I( v* W. s6 ]
- # u5 ]+ B) m# z
- #undef EDMA3_DEBUG
0 q3 Y. P0 Q0 d3 y& Z - /*#define EDMA3_DEBUG*/! Q/ ~6 a6 I, @9 i( a% U( s
* {$ ?/ Z# F5 H( z, G- #ifdef EDMA3_DEBUG4 E4 r& |* v# K) W5 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& T5 e, w# `0 p8 _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) O6 c" k$ W5 c) V; F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 A0 V" C, ]+ }& M6 `
- #else
7 X" y: |- W# v4 V - #define DMA_PRINTK( x... )
: m8 \! R( Y3 C; l2 f, H - #define DMA_FN_IN
- ~8 g$ ]3 ~) o6 e% d3 G& ^8 H3 z5 S6 U - #define DMA_FN_OUT
6 I5 s8 w# _5 A# r/ d - #endif
. R4 @. E" `8 X. A& e' g7 }( t& E* [
$ O- |5 t: K6 M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 j; G ^% ]& O p6 K. A* k! f - #define STATIC_SHIFT 3! O2 C1 A; t7 T/ S7 L
- #define TCINTEN_SHIFT 20
. i" c a* U( {& ^" b% v* r2 s7 N - #define ITCINTEN_SHIFT 21
, D& e8 V% M% f - #define TCCHEN_SHIFT 229 u4 e/ I ~! {6 t
- #define ITCCHEN_SHIFT 230 }! u& f7 x0 k8 Z/ N, s
$ @6 g& S9 j+ I# Z& M# \9 x3 W- static volatile int irqraised1 = 0;
! K2 G" M) \7 H* i, b - static volatile int irqraised2 = 0;
# j0 f7 F2 C1 h, l5 B
7 T$ D, L2 b$ @+ @8 R/ Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 \# s5 @* ~, O. v5 |7 R0 T' h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ V+ V- B3 M! v A- B }! t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% I6 }, j B7 J: n( P% t
- }' {; \; I" k1 @9 @
- dma_addr_t dmaphyssrc1 = 0;
8 j8 q$ ^1 O+ l; h/ ^6 S& a9 i - dma_addr_t dmaphyssrc2 = 0;
, j5 [( ^# Z" } - dma_addr_t dmaphysdest1 = 0;) Y0 V/ x- A9 b& x' U" A
- dma_addr_t dmaphysdest2 = 0;' u I% C8 F8 x3 P& I
3 I4 o( _, H# ?- char *dmabufsrc1 = NULL;. q3 s+ ?1 s% c, `! q
- char *dmabufsrc2 = NULL; _" a( i. `, D; ]8 r4 f
- char *dmabufdest1 = NULL;
m+ y# ^$ ]- o - char *dmabufdest2 = NULL;
4 g/ W, I8 m4 T: @ - ! k2 x- s7 q' ?( M) ?& N! K/ j
- static int acnt = 512;% @/ f" F& N" r& E2 p' d6 e t
- static int bcnt = 8;( j# p! @3 O/ A# _: \5 e* I, R
- static int ccnt = 8;2 X& ?0 R$ p1 h K6 R
* p- i* M6 k" w6 S- module_param(acnt, int, S_IRUGO);
$ Q& v7 ]: P6 h - module_param(bcnt, int, S_IRUGO);
5 }! _2 c- l; A - module_param(ccnt, int, S_IRUGO);
复制代码 # @5 c$ P# T. `; B
5 b. b+ o' u$ N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( c' E0 F. }+ e. U% Z( |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; W& r2 \4 Z% r0 S$ \* G! b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 |: N$ D2 l7 ]( g) f
% V! V# W+ L4 V- D2 M, r/ G2 p
' n7 u( {4 z7 S# Q |
|