|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. _% h, P3 r; L7 h* Z( o( O5 L- [code]EDMA sample test application+ [; o2 Z8 E" m
- /*
4 p/ m% n4 ?6 U! B: L - * edma_test.c
7 B% @8 ~6 S/ q0 A$ B2 y - *
3 X& k8 l- A6 @3 c4 G - * brief EDMA3 Test Application8 ~( b$ \' z% M: M
- *0 w% v$ D# `9 O' q# q6 s
- * This file contains EDMA3 Test code.
3 v4 G! S' T3 e- r+ f- F8 A - *
, S9 |, B& a5 A9 F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 o6 {$ @1 X! r8 n% w, k& T; _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 n: @% k$ O; x7 [ - * TO CHANGE.9 P$ e1 P8 t; Z5 ~" Q
- *
" V$ X9 V" {5 X6 z0 u4 h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, I2 P1 k$ \6 Q9 G - *+ {1 y) n4 u6 a- k
- * This program is free software; you can redistribute it and/or* _5 K: f# m/ p! r1 i* u0 J
- * modify it under the terms of the GNU General Public License as8 z$ t6 n& O4 \( V" G7 Q
- * published by the Free Software Foundation version 2.
0 P, d( W+ Y# @6 k - *( J9 x4 V$ {! d. R m4 r0 w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& f- t& o% n+ T' A4 c' v/ p! F - * kind, whether express or implied; without even the implied warranty
. D/ g, n9 K4 u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ a- \& ]9 k/ l! g! g7 T; [
- * GNU General Public License for more details.
5 ?. e5 f2 ]9 f H - */
- t* g1 G m& \3 G; `/ O( b
6 ?3 z; M" W' ^- #include <linux/module.h>
; r' W1 @( z2 Z8 {8 r8 ] - #include <linux/init.h>; P% z/ B/ @7 H, q4 e8 G
- #include <linux/errno.h>
$ i) w- X p+ U( I4 X" J0 P! T k% b - #include <linux/types.h>; N1 I+ _! M" k
- #include <linux/interrupt.h>) E1 y$ m& F$ ?) z3 K o
- #include <asm/io.h>) l1 d; V% r- X* i
- #include <linux/moduleparam.h>" |1 [) E' D' X
- #include <linux/sysctl.h>
3 y2 _3 [* ^/ _$ w5 M* ^; Q1 _ - #include <linux/mm.h>
0 R% S! `2 c+ E4 _ - #include <linux/dma-mapping.h>
' ?1 x/ W7 w( l9 D( A* \. M5 j
k7 J$ U' E8 p) [) Q/ D- #include <mach/memory.h>1 i7 x; H/ I' g2 S$ Y8 M
- #include <mach/hardware.h>
, e) {) B3 r7 Z- y3 j - #include <mach/irqs.h>
# t4 v; k! D% X* {, s! h - #include <asm/hardware/edma.h>
" K+ V/ S9 V( B# _" L0 ~
: l+ V6 e9 F" t" J# s% [6 \. q2 }! C- #undef EDMA3_DEBUG! R. B6 ^ r9 \2 \
- /*#define EDMA3_DEBUG*/- h3 d, D" u" G5 g9 B
# L# c7 i* v9 a# C( p5 W# Y9 l- #ifdef EDMA3_DEBUG
1 C: V# ?8 w( K! Q% C1 } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- z) }% e6 |/ u/ ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 U/ ?; [/ m! N0 L3 F0 ?% K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 o7 x5 c. z! M, g) _, w# _
- #else
# @( n" k, D: K: Y% j) r - #define DMA_PRINTK( x... )
4 U$ m7 y) J( s - #define DMA_FN_IN
" R. @. A9 d- |. Y2 ~+ w, i# c K - #define DMA_FN_OUT* n# ~, \4 i" O. E" T, U
- #endif, ~# a, X% _6 j; X' Q
! p; {, I: B3 b: r5 R/ i7 n2 T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
T6 T% H( J* y" L* F [ - #define STATIC_SHIFT 3; D% d; J2 Y5 O5 ^, _
- #define TCINTEN_SHIFT 20
$ `+ {- _) V& ?7 T - #define ITCINTEN_SHIFT 21
% l6 R8 {8 |% E" u4 Z% J4 S; {6 P! T+ J - #define TCCHEN_SHIFT 22
! [% |4 f4 z9 J" ~2 O- A: t - #define ITCCHEN_SHIFT 23( K# w( x/ r* a* i7 `2 ?
" ]# _1 j1 G9 i) i8 b$ Q- static volatile int irqraised1 = 0;: f( R: a7 ^ f8 Q. i4 C2 \
- static volatile int irqraised2 = 0;
}: p9 y" c; ~4 _: n0 P+ ?" {- q - % i1 T0 p5 p8 V4 K7 j& M c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 P6 w3 @/ a. j1 W' Q! _0 l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ v0 b# O( M- E. [$ c w& i, \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: E! U4 Q( ^5 h1 A4 g6 d
- . H' [2 S, X' _9 X6 c
- dma_addr_t dmaphyssrc1 = 0;
2 d- j& c U, i4 g7 ?: |- }7 \ - dma_addr_t dmaphyssrc2 = 0; R4 v8 t9 `! r D
- dma_addr_t dmaphysdest1 = 0;
0 G7 F/ v! r& E6 r) ] - dma_addr_t dmaphysdest2 = 0;
& F! I% q4 u) h! F' n' F2 L& h' Q7 r - * L: X; o" z$ @- a% n6 e
- char *dmabufsrc1 = NULL;: @& }6 F7 T5 v! D9 ^2 Q
- char *dmabufsrc2 = NULL;
+ N& @; u) n* k& I( ~% u - char *dmabufdest1 = NULL;
! w) l+ Y% v* E, B9 G3 U - char *dmabufdest2 = NULL;0 b- z+ s% w$ D0 ?" t! w; U
* `7 \1 A+ W5 Z) W2 G0 l$ l7 f- static int acnt = 512;
6 i# T+ I, V9 B! N9 L" ? - static int bcnt = 8;$ z) G) o& i3 T$ J/ x: B
- static int ccnt = 8;! N3 ^ Y. @% `, b
$ x: l1 D! A0 \ D8 ^- module_param(acnt, int, S_IRUGO);
* _. i7 p+ c4 E& |5 L - module_param(bcnt, int, S_IRUGO);2 t7 E5 `1 H! o
- module_param(ccnt, int, S_IRUGO);
复制代码
7 \- B2 o: _( A5 j
! p) p1 M) {0 W+ o5 o' g( W' t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 G6 j1 y) j- Y( {! R' I. [4 m# e) k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 G6 O; o, |& ^$ c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 O( j# _ b& f$ w6 f/ a5 ^9 h# {
- a3 u) R7 r2 a2 m m
|
|