|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* B& z1 ]! B5 D* c( M) V4 n3 J- [code]EDMA sample test application
: K! z' d4 x( o7 H+ H- x - /*& r9 |( I$ e1 k3 T! a
- * edma_test.c$ h/ L' M1 W8 e: `% }" v
- *$ c1 z' Z- X1 b$ T* b
- * brief EDMA3 Test Application0 ~/ ]; R$ W* G+ p* i9 x
- *
4 j+ i* f) g7 ^) O; D, Q - * This file contains EDMA3 Test code.7 L9 \/ Z# |* A. o
- *
" c' i4 O/ R$ Y6 k# N2 T. A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 I+ {7 e i; l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 e6 M- Z% \$ J1 D; K
- * TO CHANGE.
2 o o; U$ z1 O' i X5 s+ } - *
- I/ e |8 S0 u* p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, \, |* x! y) C" g$ B - *
6 n8 O. z& x# Q- R$ Y9 l# `# { - * This program is free software; you can redistribute it and/or
; Y" N! b6 f3 W& f+ S - * modify it under the terms of the GNU General Public License as
" E ?3 T; c2 E! x- N8 v5 U. g8 w# c - * published by the Free Software Foundation version 2.
9 C! l1 t: p3 E- I) r - *0 Y. K; B; o. _! ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' J ^/ U5 v8 v0 e0 C1 \ - * kind, whether express or implied; without even the implied warranty4 V: C! m& o6 y! P! e1 ^ l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the F9 x% R+ w: W8 u7 |
- * GNU General Public License for more details.
* o: l. Y/ }( |! L: r* @. G - */
$ E. P# x0 H0 A) b9 G - ' f: {* c9 ?0 a( `
- #include <linux/module.h>% @ J" c+ ^8 C
- #include <linux/init.h>7 a9 H1 {7 a, b- o
- #include <linux/errno.h>
: e+ I; z( v! u$ p* j, H+ P - #include <linux/types.h>
- O" C* l8 X% y2 B - #include <linux/interrupt.h>* i) ?% Q: e3 K, b& j& R; {% y- t
- #include <asm/io.h>, }2 y5 q, x; J7 [. Q
- #include <linux/moduleparam.h>
; r, t" A( M& X* B0 S ^ - #include <linux/sysctl.h>
, `+ U( e- o" W! Q, _& L - #include <linux/mm.h>
3 v* z& B& Y+ L - #include <linux/dma-mapping.h>
7 l2 S- i, l1 x5 r- s/ r - 1 x& X7 P1 F0 ]2 M, W- C
- #include <mach/memory.h>
) x8 O2 b3 f; o0 _4 D# V - #include <mach/hardware.h>" p, [) N" g/ T7 @! @' K
- #include <mach/irqs.h>
' h2 o' r8 W! K2 m l3 B2 ~ - #include <asm/hardware/edma.h>7 f1 M; f5 S1 o5 n3 B
- : m1 B( o4 `0 O0 T) {
- #undef EDMA3_DEBUG
# [3 l1 T4 k8 g - /*#define EDMA3_DEBUG*/( B1 F8 z, r0 s/ `
5 i" b: f" F& i! E, Q1 x- #ifdef EDMA3_DEBUG
( N6 C2 z. N$ _ _# ]% c4 J+ h. ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 D3 e, x: Q4 I5 u5 A* ^2 N S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& p+ M, Q9 l/ {" h8 B- V4 J - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' [8 o. d7 ?) u( R/ b' p
- #else0 e; b: L8 i$ Y( a7 b
- #define DMA_PRINTK( x... )- p3 Z) R$ x% q! d- ?; c
- #define DMA_FN_IN% c* {- H, |- n, B
- #define DMA_FN_OUT
1 |5 n& g; E3 o! g& ` - #endif
; ]- U. S. T; f& x! z: f
4 j9 \) Z0 ]) q& L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
a+ l, Z, Q. Q: ]' K: V - #define STATIC_SHIFT 3" X2 q- `2 u, _9 N( b" b
- #define TCINTEN_SHIFT 20
# {* g, E5 {3 J9 t- y& @ - #define ITCINTEN_SHIFT 21/ x4 l4 Q- i2 A1 O1 y
- #define TCCHEN_SHIFT 22
% J; I ^. m- z/ @ - #define ITCCHEN_SHIFT 23" t+ Z- D9 c6 m6 j
7 H9 A4 I" |; q, b, g- static volatile int irqraised1 = 0;5 U7 D4 n' l: R1 N% |, j
- static volatile int irqraised2 = 0;
4 ], [- s, d( \ - G) [2 l! q- {7 \/ [! T& p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 j. O. R) E! P7 ~3 s+ N5 m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! n X% S" Q+ \; c# d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: K$ x; P5 j' \# {3 `2 b/ ?
' M/ X/ k. H3 B# D: w6 Q- dma_addr_t dmaphyssrc1 = 0;' S. W% e) Y- d: L# Y6 }
- dma_addr_t dmaphyssrc2 = 0;
& U' Q+ _' m, ^3 J+ {- F" J - dma_addr_t dmaphysdest1 = 0;4 I- k( v" ^! l* _# \
- dma_addr_t dmaphysdest2 = 0;- \# c+ f, y4 e
- 8 \7 _5 e# J7 i' ` j0 J. A
- char *dmabufsrc1 = NULL;" j' m& e) a; p4 X+ V- S
- char *dmabufsrc2 = NULL;8 S" {. D* G/ m8 z# O/ D7 R, U3 v
- char *dmabufdest1 = NULL;: r! Z+ {$ w- N
- char *dmabufdest2 = NULL;, P1 q, q# |/ [- l5 Y" ]& a0 U3 C
- 7 _) f0 B& S! D
- static int acnt = 512;4 X9 L3 T4 h: p
- static int bcnt = 8;
9 t' @& P! C% t3 z0 k# U/ E - static int ccnt = 8;
C* w# s0 [; j" |9 \+ ^1 @ - 2 O! r0 P/ q L8 C: l9 ~- e
- module_param(acnt, int, S_IRUGO);0 P' G4 Z9 p+ P3 y U9 D' a
- module_param(bcnt, int, S_IRUGO);1 o6 L. Q$ o9 B& r. g% }
- module_param(ccnt, int, S_IRUGO);
复制代码
- a6 A) x4 T1 I$ `
0 o4 c P8 z4 s2 Q9 A" G4 w ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, I& M3 G$ ]% G5 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 K% i3 ?: j1 @, B( S! y; G6 q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 R" l+ k- d" B7 n: H# a( Z
: b5 T0 e( ?# S: |' E3 g, K' A1 g$ z3 G/ n. x) H
|
|