|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. I$ n7 D+ c f, L# V+ v4 S2 e# M- [code]EDMA sample test application
2 i" U* w, u" n( | - /*
, ~% j; g7 {3 t+ L - * edma_test.c) l9 i0 |8 i0 O n& l- u- N' Z
- *7 \+ c- C N0 o( y7 K0 U: s
- * brief EDMA3 Test Application$ `0 w$ _$ b6 m0 q
- *
( w- |' ~* V1 S. K7 a - * This file contains EDMA3 Test code.
8 G& t5 f/ w2 P; \% ~ - *) t4 i+ s0 s. ^ \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 ~6 x4 P5 \' w0 V! D. l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; }- `9 O3 b# ]+ n/ C
- * TO CHANGE.
6 p" r" R, i' ^ e4 d6 Y - *# p/ z1 z. C& E+ W: E, x- `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. }3 ^' c3 M" o# ?' V4 D5 i1 z - ** E9 Z: p- u1 t7 q! D3 \/ D
- * This program is free software; you can redistribute it and/or
- _2 G. Y- e! F9 L# `$ f& i1 E - * modify it under the terms of the GNU General Public License as
" |2 L+ S0 q, ~& }) w, \ - * published by the Free Software Foundation version 2.) ]6 m. j1 h' P" l5 j+ K0 W! e
- *+ o4 G7 g W" E! @" ?( G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% c1 E/ j8 f Y' z( n% L
- * kind, whether express or implied; without even the implied warranty! H$ K4 u% ?# x( b6 w5 q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 V' e$ e! l# ]) @+ p/ i8 ] - * GNU General Public License for more details.1 ]3 [" E4 v; O' O6 x3 A
- */
4 y, j& R5 f7 c( q% L$ x& t, K - / ]4 D0 ]: X. I* p# ~4 S) }8 k* A: c% v- G
- #include <linux/module.h>; g; j: a- W, J. h
- #include <linux/init.h>, g5 M5 ?* z( h! q( a7 y% n2 X
- #include <linux/errno.h>
' d- R, X x+ G2 e: s" J% b& y - #include <linux/types.h>
4 l6 E! Y* Y+ m% J' ? - #include <linux/interrupt.h>
2 q8 a. ^% V+ n9 X$ p* I - #include <asm/io.h>
( w7 y) S, ]: a" x - #include <linux/moduleparam.h>+ d% V: E) r7 N
- #include <linux/sysctl.h>
, M- p0 w) d7 v - #include <linux/mm.h>3 a3 L0 o5 S! x) H* T9 P
- #include <linux/dma-mapping.h>- v. x% i% R5 y
* k4 N5 y$ a8 _" n9 Q4 H. ~0 V' u- #include <mach/memory.h>) F8 |) y0 }8 l. v# N% w
- #include <mach/hardware.h>
9 p) i+ ~2 X1 L - #include <mach/irqs.h>% x$ H: i+ y |# O
- #include <asm/hardware/edma.h>
) q3 w. y8 G, Q: S5 _( i' S4 |% G2 L
6 q1 @. \. [8 c# U: ]- #undef EDMA3_DEBUG' A1 G r0 w/ u/ E2 Z% @
- /*#define EDMA3_DEBUG*/* z" \( c/ t, c" C4 a
- ) d$ E( W% x- u* T/ K+ p
- #ifdef EDMA3_DEBUG
, ~7 i+ i) z; k8 H& B; {* C( ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# J2 G2 L7 ?* \' F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" J+ h4 S/ q3 x0 p7 W/ ~3 M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 k$ d" O& [6 V5 \/ t7 ~) W" G - #else2 Y% x A+ |, y' m
- #define DMA_PRINTK( x... )
9 p! q! ]+ L, P! x R2 G' u0 Y: R' P - #define DMA_FN_IN' a, w! t1 u' Q! S/ _
- #define DMA_FN_OUT
6 w Q+ ]8 A* n, V' t' w - #endif
: R3 B* ?5 i* b/ D' h4 r! ] - ; d* z) w7 P0 l* ~5 [ D8 b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 ?8 ]8 K" W* Z - #define STATIC_SHIFT 3
0 z* n9 a2 G( a! R4 `# W - #define TCINTEN_SHIFT 20
: ^7 L. q3 j: e5 X$ B; b2 t - #define ITCINTEN_SHIFT 21& ^- `$ f) ^1 M T, O
- #define TCCHEN_SHIFT 22
: D( y4 C+ e+ ^( e8 h( { - #define ITCCHEN_SHIFT 239 l5 d g4 E" D- l) a
- ! A- t. s ]2 A* o. n: {2 l
- static volatile int irqraised1 = 0;
* q& g; M: u% l( j% l' v) v - static volatile int irqraised2 = 0;
% i; ]7 x5 l" Y9 }$ P% a" Y4 Y3 Y - . K. `4 W+ u& ?2 d" D) C+ S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( |; ?# |7 F3 P& G+ A l! b+ K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); Y8 U. ?( Q( C' e+ X) R) T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 u2 V% o7 f U7 r3 }2 `; u- a
4 r6 a; y N- G- dma_addr_t dmaphyssrc1 = 0;/ ?( g1 f% v. R% @( s
- dma_addr_t dmaphyssrc2 = 0;
/ J! x6 \8 c; r" K. Z, y3 I1 t. ] - dma_addr_t dmaphysdest1 = 0;' w- v r2 B! f5 q' M
- dma_addr_t dmaphysdest2 = 0;# Y( H/ r/ z- H) |& f2 t0 k
- 5 ^& S% o% s) X' N2 g- h
- char *dmabufsrc1 = NULL;
S& Z- N% X: o' q# I: Y7 w - char *dmabufsrc2 = NULL;
$ l6 U/ e6 Z; V" y& S; b! D - char *dmabufdest1 = NULL;
! h3 t6 x4 f' F8 b1 C - char *dmabufdest2 = NULL;- J# u# |1 N/ \& b7 w3 u, e/ l' i
1 t" t c- t. R ?' j. B- static int acnt = 512;& {0 U1 k" ~' @
- static int bcnt = 8;
2 @! ]8 q0 n Z/ g5 m0 t3 W - static int ccnt = 8;
' [. m* |1 a5 r! o+ ?
7 W3 ^9 J+ T" O* ^3 c8 O- module_param(acnt, int, S_IRUGO);
: R3 O- [0 {, n* k# T/ _ - module_param(bcnt, int, S_IRUGO);* A+ |9 m+ f9 j/ T
- module_param(ccnt, int, S_IRUGO);
复制代码 ) O1 C7 d, B" ]! B5 w
+ J9 Q! O1 n; B# A8 V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ [0 W0 z9 c3 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) d" J3 T: h" M6 i4 _8 V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ W" z9 t; |4 D" E
, I# I* c7 h6 R! @
3 f/ v _( g5 ]; N7 R |
|