|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% C* m" O% H4 D# V9 P5 _- [code]EDMA sample test application
, ~$ `: |9 }( E+ i0 f! a1 f - /*% p: Q+ M1 X, X
- * edma_test.c- z- k7 s9 y, j: A; ~/ b8 J& e
- * \, y; [/ a9 K: g4 R
- * brief EDMA3 Test Application; Q7 q+ u( E9 |" M" \3 ~! P/ P, ], v
- *2 S0 a9 b+ J8 M3 `
- * This file contains EDMA3 Test code.$ h1 v% A$ I. d3 M/ B
- *
" m' e* k4 i3 s6 s+ W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# t* X% X/ p. t8 H, g4 \* F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' |$ q, @, |' }; P4 V; C6 d
- * TO CHANGE.
+ L# T! t( ^. w; Y/ F% Z |# s - *% A1 |5 T0 ]5 N. Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 l/ T" Y: _; b9 ]$ e* L
- */ c6 l% G: f. J- d2 I% G
- * This program is free software; you can redistribute it and/or
/ [+ P# e* V" N( |) {! l - * modify it under the terms of the GNU General Public License as$ Q, X/ x$ Y8 c% }3 u0 L, h
- * published by the Free Software Foundation version 2.) m, I u2 d2 t& ]7 i
- *
6 _9 k( e" B- q3 z7 E% Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 C( H* r0 T1 r$ k$ n3 d - * kind, whether express or implied; without even the implied warranty8 S. b$ B: I; r7 ~. I* e7 I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 b3 T3 I( ^# b# o& p
- * GNU General Public License for more details.' k9 F! T+ g& X, |& [
- */
/ x, Q' U) Z, t9 K, W5 v' Z( ^/ @6 t
3 T" |- x s* j+ a4 T, C- #include <linux/module.h>
/ a. [; N7 {) t0 I( P" I; X - #include <linux/init.h>/ A) K5 R- a% ?8 S7 o& q3 p3 n
- #include <linux/errno.h>( h/ f: E; X1 ?2 ]
- #include <linux/types.h>1 \4 ~* K3 ^8 _+ l+ p r
- #include <linux/interrupt.h>- T2 h% l4 d K
- #include <asm/io.h>
$ m+ i2 P3 h! }4 N( ?4 i - #include <linux/moduleparam.h>
% L4 J1 k0 q9 Y; ]% U - #include <linux/sysctl.h>0 P% D/ ~" j- O( W& {
- #include <linux/mm.h>) @+ J0 J- z9 V+ i) H! t# n7 w7 S
- #include <linux/dma-mapping.h>
; E/ P2 b* w* f! @" B1 Z - 7 a2 q4 z% r! U& `0 x+ p) B
- #include <mach/memory.h>2 s0 Z, s5 @( ^ c
- #include <mach/hardware.h>
# M8 X& r: k9 U5 q$ V9 ` - #include <mach/irqs.h>) ^5 D$ o3 C. z
- #include <asm/hardware/edma.h>
6 q- e, @. X- E" A! y: [
& ^) o; Z2 [9 b2 ~2 ^3 O6 J% Q- #undef EDMA3_DEBUG k& b! K+ {! }7 I
- /*#define EDMA3_DEBUG*/5 p. U# g @0 @2 D0 O
, L3 Y" F; r7 T/ W, l% L. i- #ifdef EDMA3_DEBUG
/ Q' Y3 |6 b; A8 u% f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% w& i U$ X: [2 M8 X3 H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 O0 ~$ i% l f* _, E( ^$ S; c( `9 e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 Z/ ?% H4 d: z5 `9 c( b - #else
* `9 U3 Y! R. a! d5 Z - #define DMA_PRINTK( x... )7 [( ~) b4 }1 K/ v: j4 P
- #define DMA_FN_IN' c7 r N- W* Q. ]* | ]
- #define DMA_FN_OUT) m+ L+ U- c# y( P5 q
- #endif) _: W& ]5 _8 b
- 6 j+ o+ ]9 B' c) w% F7 x) D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 }+ F) z- a9 q3 H# T( {0 y# _
- #define STATIC_SHIFT 3; T2 {* v5 f- ~; p% l
- #define TCINTEN_SHIFT 207 N2 x# P3 N) F% S3 D
- #define ITCINTEN_SHIFT 212 {5 b' u$ r+ U' I$ E& G% p
- #define TCCHEN_SHIFT 22( ]+ N* _) J; L+ F9 S# l! T: k
- #define ITCCHEN_SHIFT 23* _) [+ h# C0 g% X
- 5 i* ^/ f. t2 Z" A; d" R
- static volatile int irqraised1 = 0;( j& t, M) H p @, m/ p7 ~
- static volatile int irqraised2 = 0;
. p2 j/ A( v4 w; j1 X/ M - & S; r6 h( f5 s0 U9 Z& t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 s& n. O& M. z' k& d4 ]* i: \7 W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 c5 p" E; J0 _; o* @! } d/ s6 b; ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; E5 j' k. j. G6 q5 e
5 h& }7 l8 Y- ~- q/ M- dma_addr_t dmaphyssrc1 = 0;$ G1 R3 X Z) `' q9 F6 ]: ? C5 [+ D
- dma_addr_t dmaphyssrc2 = 0;
) g# ? J: j: c1 {% z - dma_addr_t dmaphysdest1 = 0;; Y, i4 k% B- N
- dma_addr_t dmaphysdest2 = 0;5 F1 B( d" M- ^# {1 i X0 o5 _
. x* d, k1 e! O1 ?, o- char *dmabufsrc1 = NULL;! A3 m/ P. V) o+ I
- char *dmabufsrc2 = NULL;
3 ~ r5 |3 A4 I ?9 x - char *dmabufdest1 = NULL;7 M4 V F" ^& H X$ J
- char *dmabufdest2 = NULL;0 v4 \1 h/ W. I5 q- p% ]
' S5 e0 ^3 J6 h% N' G2 t% m- static int acnt = 512;2 s6 `$ _2 \. z; t) D& F. [; U
- static int bcnt = 8;$ l) w G/ B# A3 o
- static int ccnt = 8;
0 g9 E0 P$ N8 B - 6 c: F) ^0 ~. {% \$ t- r
- module_param(acnt, int, S_IRUGO);
4 k# g4 n7 v- ~! _( M( Y# @ - module_param(bcnt, int, S_IRUGO);. t$ U6 f/ c8 ?, f: [- [0 d1 V
- module_param(ccnt, int, S_IRUGO);
复制代码
* |& v8 L8 i+ P9 v( k2 \7 c; c# y. `1 s5 {% [2 ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 y( O: j* x( E# Karm-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; \" U8 Q; I8 R$ g3 } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ i9 r/ ^7 z. {, x4 v' R
6 I. f/ \" r2 n* l
0 U N+ q, j: N% I
|
|