|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' S% F' ^7 T& g3 z* n) ^
- [code]EDMA sample test application
& o3 P; g F2 J' R, W2 g - /*& P* r A6 g5 n* [" f! U& Q
- * edma_test.c) Q- J8 V2 R* x) \: e1 H7 `
- *
; F W& G, O. u- G0 e - * brief EDMA3 Test Application7 L7 L1 S0 I ~- K" {9 ?% y
- *& {% G/ d9 u k& P
- * This file contains EDMA3 Test code.' s; ~0 N u% x H# x; a _1 q
- *; y" a. A* p- P- m/ C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 \( J/ R! Z% b2 W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 G1 r( }6 d5 L# j* J - * TO CHANGE.2 e$ `/ L$ P3 c/ K5 r3 ^
- */ S' W0 O( v8 ~, g7 b* b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( Q1 O* @, \$ p, a! C - *
; |! B& ?( y! L - * This program is free software; you can redistribute it and/or
I$ C1 }$ A) ^* A3 M - * modify it under the terms of the GNU General Public License as' d+ |# k# O7 B. v9 C
- * published by the Free Software Foundation version 2.2 R& S: \3 T; N, o y/ Q9 B
- *$ T; v+ x# v' r9 Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# ]1 w3 A9 |5 V+ r
- * kind, whether express or implied; without even the implied warranty6 Z4 a' F; F& k% j* A+ L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Q- @4 P; K% c! B8 x$ n
- * GNU General Public License for more details.; b/ ]1 }( X9 o8 W* P% Z+ g
- */- L# y6 ~. v: K$ ]& [3 c6 z) _- `, I
- # }* n6 {. a+ v0 @+ q+ `) _" i3 @5 i
- #include <linux/module.h>
% C+ q8 U) g3 n1 ]- z! i d - #include <linux/init.h>
$ t3 h( E7 p9 R2 v" i - #include <linux/errno.h>
6 B# \9 x2 E9 C8 b$ [2 U - #include <linux/types.h>$ w5 Z: I/ ?, ?9 X! {5 `
- #include <linux/interrupt.h>
1 j! `: F/ k; }. {. Z+ F - #include <asm/io.h>7 [, G/ N+ u8 N" R5 A' R1 j4 ~
- #include <linux/moduleparam.h>
: \9 g+ y0 \% a$ \7 @ - #include <linux/sysctl.h>9 F# e" l0 J& V, @$ e+ v% u. Q* S
- #include <linux/mm.h>
9 x6 U/ K& ]1 j# S - #include <linux/dma-mapping.h>
9 H! i# q2 G! h; J; m - 0 F$ {6 E% S4 r( y: V+ v
- #include <mach/memory.h>
) H) t; ]5 D4 T# s2 e" Y5 M - #include <mach/hardware.h>
) w3 X' \2 A3 C# K/ m' j, a# ~ - #include <mach/irqs.h>0 [/ t/ r; b7 c1 y$ a. g
- #include <asm/hardware/edma.h>
7 ^3 L3 b3 q1 S" u - 5 J8 ^! o8 m t# E& `
- #undef EDMA3_DEBUG
# d( e! H4 F4 d, }6 s - /*#define EDMA3_DEBUG*/6 ~) T9 i/ P2 A6 s% i
- 4 P* T+ }7 N& m4 R
- #ifdef EDMA3_DEBUG
$ a" h0 t0 m# t. x" ~- x$ \9 f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 F4 {% ]# N6 C, |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- S: R1 @0 r8 l7 h1 M7 g' U2 ^8 b: ^2 M5 c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 x- V! k, f. ^' l: t
- #else! J% q2 n0 ?8 e" Q7 K' e
- #define DMA_PRINTK( x... )% N& |+ W/ K6 H% G6 l7 y
- #define DMA_FN_IN
; `8 e3 c+ f0 b, R5 v2 ] - #define DMA_FN_OUT
$ I* A' i, {7 A' k& G - #endif
# E1 c$ ~; _( s6 }+ T
* f; T& d* [0 d1 _) V. ~. o0 @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
@0 v% J# M0 V2 c7 B - #define STATIC_SHIFT 3
. h/ L" }( O# _ - #define TCINTEN_SHIFT 20' x* G- a$ _* r
- #define ITCINTEN_SHIFT 21" R" |% _$ o% ]* W
- #define TCCHEN_SHIFT 22
; `$ W( K( y( p" x4 e6 h - #define ITCCHEN_SHIFT 23
7 x) W4 p6 C! S+ v8 f
6 M& [# N) e9 E+ } d& ]4 Q; s1 D- static volatile int irqraised1 = 0;8 c+ a4 G$ e, F; _- {( {* |
- static volatile int irqraised2 = 0;
8 {/ |8 {+ t( X6 R }6 J n
3 t! B* _1 Y/ q; e$ Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 p$ C1 ]' }8 n; J% x3 M# M0 a6 v0 } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 v, B1 {+ l8 y: [/ ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: v, h: O9 v2 L4 _ - 4 H4 X# H7 F% ^9 Q
- dma_addr_t dmaphyssrc1 = 0;
/ t- O" c& y/ M4 v) e$ M# x - dma_addr_t dmaphyssrc2 = 0;! U# a) J4 ], N+ b; ]1 X
- dma_addr_t dmaphysdest1 = 0;
" m+ S' W' \' @ A2 g4 p( T$ r- H - dma_addr_t dmaphysdest2 = 0;
, d7 {7 Q0 N/ E8 x* ]/ I
/ h& e6 F; S% _' Q; |5 b3 V' j, C- char *dmabufsrc1 = NULL;
; ~" }. d! j* a' g - char *dmabufsrc2 = NULL;: O0 U; _8 B- j1 h. j: a
- char *dmabufdest1 = NULL;9 Z j7 A) f5 D2 ~* h
- char *dmabufdest2 = NULL;
6 p. T8 u% ^( q! Y8 U
( T. u/ x1 y3 n; S" y9 R- static int acnt = 512;
( j& p+ z& {- m$ t! D1 s( j, ] - static int bcnt = 8;
0 `2 s. J; f. [& w7 R" Q - static int ccnt = 8;
; J I% c" T9 P! t - ! U5 q4 C/ T) e0 P3 s/ H
- module_param(acnt, int, S_IRUGO);: m0 N; B2 E( h$ S" o- A! p6 r% [
- module_param(bcnt, int, S_IRUGO);
" |0 u% b- g3 `0 Y9 q - module_param(ccnt, int, S_IRUGO);
复制代码
|. k- U1 s6 _! Z0 ^ O& @ S& Q% ]$ f4 [9 g* ]0 q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ K# A. e7 M6 ^6 W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. {' L8 y+ k. U) h5 ^2 R( Z1 V8 N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! b# m0 q% C8 T- x4 I& v
3 G9 A3 a2 }' J, |4 Y6 ?: _& {
' B. `7 W0 J9 j; w* M1 b$ |
|
|