|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) Y& A8 e2 P7 H [4 L- I w# V$ D- [code]EDMA sample test application
; ~0 J7 e7 K" w# p8 Q9 A$ n m - /*
$ I" T) C- Z: T" V: t0 H4 _! I4 S - * edma_test.c
/ C- V. H( E; m - *: z( q# J$ E' C$ N; I$ |7 q
- * brief EDMA3 Test Application% @/ U2 m/ e& ?
- *9 e( e) Z+ q: N; y- i$ h
- * This file contains EDMA3 Test code.
' N1 }1 W% c! p7 q( Z7 T - * P9 \/ R$ Y& H5 c7 S# ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' |7 n$ |5 j! |6 O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* F, U* B5 ^1 x2 e# U, i/ X
- * TO CHANGE.
4 J! `+ e9 p" x$ [; f# @# r. E - *
' W! N% D' \* j& f% z" S- p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 B3 p8 J o5 H5 W% ?9 d, s; O" i. b - *6 c5 P" {/ \. |4 A
- * This program is free software; you can redistribute it and/or- M- ~' \. w' u0 h, \) K) a: ~
- * modify it under the terms of the GNU General Public License as1 V6 |1 Y8 A; ?. K' Z
- * published by the Free Software Foundation version 2.
! P0 b$ r& X/ C6 Z2 Q' U - *
4 D/ R( g* I4 }) m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 V% m z/ i' T8 x( k
- * kind, whether express or implied; without even the implied warranty
7 S' d% s! T- t4 q1 l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 C8 v- V, i c$ _2 O
- * GNU General Public License for more details.3 X0 J# s7 z' p
- */
( i' U$ l* A8 N - . i5 l+ Y6 a/ V8 v7 M% O; r
- #include <linux/module.h>9 g5 O3 b( v: S; W% V, i
- #include <linux/init.h>
$ ~( ^0 x& U8 Q6 |) o8 G - #include <linux/errno.h>
7 u T$ ?3 b- e2 `1 `' j. ]' B2 w - #include <linux/types.h>% Q% ]6 P. u! C0 L+ X2 G
- #include <linux/interrupt.h>+ [, E/ o/ M- F3 U( Y
- #include <asm/io.h>6 t) Q9 C |& ?$ q2 g) J
- #include <linux/moduleparam.h>
# [5 }8 _. p I+ j0 J) | - #include <linux/sysctl.h># |: E1 X6 x) ]: C @% c
- #include <linux/mm.h>8 j7 ?! x5 d. f
- #include <linux/dma-mapping.h>( y) W, S* ]* O4 x( B
+ ~' ~: I" i8 x1 v. ]- #include <mach/memory.h>
; ?- O+ X; G; f- F9 ] - #include <mach/hardware.h>2 J1 W& i' i: a& f! Z* z3 a( x
- #include <mach/irqs.h>
. k, i5 X& h c: U% q - #include <asm/hardware/edma.h>3 c1 L3 B, E7 X1 C
& H. c/ }' C9 n$ D( `$ D/ _9 i- #undef EDMA3_DEBUG! l5 F' A% E# U. K/ U( i
- /*#define EDMA3_DEBUG*/
2 |1 ~& O. y& C7 F4 A/ X7 a
! O. y3 n: U; N- #ifdef EDMA3_DEBUG+ X5 _* w8 d, n; f$ e( c0 P6 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: Q0 v, |% g. i8 g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 S" j& r& x h$ ~# b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 R4 H6 L* n9 R* a - #else3 S# X. L6 r& }: Y
- #define DMA_PRINTK( x... )
9 H: _ u4 F1 H( Q# g6 v - #define DMA_FN_IN
5 k; v4 Y( y! h& B - #define DMA_FN_OUT
$ T, A$ b C, Q% h, v - #endif
- s9 [8 g2 x) h* f7 r# ` - ) B* R, \4 J& R5 s4 Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
X! C! w7 M+ x$ b* v' h9 V8 _ - #define STATIC_SHIFT 3. h# z3 C; P% C& O9 p
- #define TCINTEN_SHIFT 20; d7 C5 n; y- {
- #define ITCINTEN_SHIFT 21
; v7 x5 ^! Z1 S9 R" d# T - #define TCCHEN_SHIFT 22
* x, ^9 m; p+ A. ^ - #define ITCCHEN_SHIFT 23" Y% s7 J6 b# H- ]1 W* q
; p( @5 h+ |: E# U" Z9 s9 t- static volatile int irqraised1 = 0;8 e7 ^% q" O* N
- static volatile int irqraised2 = 0;
0 a2 o$ W9 n: D) k7 e. b4 C& f
: L4 {9 Q3 a+ E9 D7 D9 W0 u, O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, r+ }+ \4 `( l, _& g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 K( U( O g! W$ X+ {( b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 b9 W) C1 }/ s( ?' I - 7 H; J s2 t, @* K. H" Q7 |# x
- dma_addr_t dmaphyssrc1 = 0;
* i' B& q8 J( _0 q2 d9 [! }7 } - dma_addr_t dmaphyssrc2 = 0;
" |/ B& V% p9 v5 o - dma_addr_t dmaphysdest1 = 0;0 ?" c* S; G3 o2 O8 v3 x
- dma_addr_t dmaphysdest2 = 0;
# }: ] g! o% u/ f& m; t( f, m: G - 5 [# J# M B) o/ U
- char *dmabufsrc1 = NULL;
0 S. y, R4 L0 ^0 y3 O+ _. ?4 @ - char *dmabufsrc2 = NULL;8 s ~1 b& [: s2 Q. p9 m
- char *dmabufdest1 = NULL;7 N P2 I3 Y$ E2 |1 A( q
- char *dmabufdest2 = NULL;+ C8 }6 X2 {* U* _9 O- Z6 G
- , C) z w3 w- Y, j# x( B
- static int acnt = 512;
7 j3 @9 m! N% g% ]2 ?4 v; p - static int bcnt = 8;
* g) b: A d, t( t# o2 c+ M1 g - static int ccnt = 8;6 X+ K5 ^0 Z& _0 r& N* @! D
- Q9 l1 P& _: l4 }- module_param(acnt, int, S_IRUGO);
( o+ Q" M3 i# O1 b - module_param(bcnt, int, S_IRUGO);
1 X3 Y. b3 m( t - module_param(ccnt, int, S_IRUGO);
复制代码
' |/ ~% e' _& k! E) [ N0 f# _+ `9 `! n! n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# p5 w3 t$ O- ~) B+ R. `: X+ H/ t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* R4 h" ?. s) _3 [3 I* | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 M/ C; D" D# {
* H0 ]3 e- {+ e
2 y, s0 k% \+ n* k% e |
|