|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( E- `2 x$ }- v. K2 V+ `
- [code]EDMA sample test application
+ I7 E2 o) c' N' I& g, w% @ - /*
# E- w4 M0 K9 Y7 [6 B# P, S) J - * edma_test.c
* ?( Y* p, S% L, e0 H: @/ O - *
/ u L, J; O# \/ l! q$ ~* Z - * brief EDMA3 Test Application" R, r: t/ \3 J. T; C, M; x
- *
. s$ ^6 f8 Q3 J- Y Y! F* } - * This file contains EDMA3 Test code.. x9 k' K0 q, c' c7 N1 v+ x# {
- *' [& t+ K- Y7 n% _3 {7 `3 F2 K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: P& b0 u( G3 g. ~, [1 E3 j" \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 [1 R* ]) [- }% e; O4 l
- * TO CHANGE.
- c. E; \, L0 ^ - *0 p; L; h* Z/ i4 P6 w; k, ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" n: U+ c7 T4 F% R! P* `) o - *
& Z" D0 }! n; e) @. I - * This program is free software; you can redistribute it and/or
& _: x7 L3 u5 N. O+ H' x - * modify it under the terms of the GNU General Public License as
3 {& V1 ^3 B0 t1 t - * published by the Free Software Foundation version 2.
8 a$ `6 B& e$ _2 l - *
2 P/ |8 w, ` Y: _) _- q2 ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, {* I9 c/ F* J/ t+ v" ~1 b/ O
- * kind, whether express or implied; without even the implied warranty
/ _; q S, f9 W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ n* r+ x* r7 E! G
- * GNU General Public License for more details. [. I& _0 d* d. I; `1 Q
- */
7 J/ l. P( l* D - 1 o0 ~5 S( _$ k. n$ b# f
- #include <linux/module.h>
) P- h: I- |& X6 o6 S9 a - #include <linux/init.h>
0 K$ Y4 P4 Y% |" A$ P; c4 }8 u: T - #include <linux/errno.h># X" Y2 z" B; l- ?
- #include <linux/types.h>' A: A5 y# ], D* y" `
- #include <linux/interrupt.h>
! a: o$ \$ s1 B0 S; { - #include <asm/io.h>
! p' S- G$ f: B. m - #include <linux/moduleparam.h>
( g; e4 j- }0 Q' d) d - #include <linux/sysctl.h>
/ y' J; V; }- z5 ^ g) B - #include <linux/mm.h>
: l" j3 ~4 } z+ `; {: O - #include <linux/dma-mapping.h>
" k2 G5 O+ ^; n6 g
) u' c5 d/ C% z) C7 C- #include <mach/memory.h>
/ {6 b; p* [+ q- x+ D, ]/ [5 w3 ^ - #include <mach/hardware.h>
# s# D" a/ X2 G D% o9 n - #include <mach/irqs.h> ^4 `% D; i0 D# _) w
- #include <asm/hardware/edma.h>
3 `8 X; }2 U6 h7 ]+ T9 M6 P
; z" v% o" {+ ~+ ~3 b# I9 z- r- #undef EDMA3_DEBUG: A3 q5 Y( X' l9 B2 I
- /*#define EDMA3_DEBUG*/- {: b# ^! }4 h5 I' s/ F
- % {; j6 Q7 z! u* p; Y! b* [
- #ifdef EDMA3_DEBUG( ^* z: _5 ?( n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) b8 r2 S! i0 ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 F* g. s& `& e* f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" {0 @% s( {' t6 h1 h1 s r7 b
- #else
/ \: i/ L* i1 w2 ~% X - #define DMA_PRINTK( x... )
& f: K" \% V1 v6 \$ [- T - #define DMA_FN_IN
* g1 L7 [/ L! J - #define DMA_FN_OUT7 t- ?. A. M! f9 E- t
- #endif
+ i5 I& N) J3 m& i8 W( k3 T - * ^9 T. C9 @6 h( P( ?. T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 R3 i2 H1 U2 _& z
- #define STATIC_SHIFT 3
% o7 I4 P, T6 Z6 l4 y+ U - #define TCINTEN_SHIFT 200 V' L0 |, _+ c) ]2 @
- #define ITCINTEN_SHIFT 21) e5 @0 {3 r% C8 o5 X0 E2 T' c
- #define TCCHEN_SHIFT 22
}/ |6 E- ]$ Y. V Z! s9 r/ f - #define ITCCHEN_SHIFT 23( K6 G# }' v; P0 A7 y
- e' [( F, J; P( ^
- static volatile int irqraised1 = 0;
% V; K: e$ S8 z( V) y3 t - static volatile int irqraised2 = 0;+ S( H* l6 Z- g$ T/ _
" T g0 g0 B) p6 h# |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" F4 `7 }% p3 y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 q& b' N0 m$ Q8 j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ W& f" n# U# L; g9 ^: { - ( r* g- p/ z# {' U X' ~( N3 q9 f
- dma_addr_t dmaphyssrc1 = 0;- N0 n" v/ O6 n6 X
- dma_addr_t dmaphyssrc2 = 0;5 p4 k& a5 [4 h# g5 p( _! {
- dma_addr_t dmaphysdest1 = 0;
2 E, r5 d/ P) E5 {4 I# i - dma_addr_t dmaphysdest2 = 0;
; k& I! R; G& g' v, S0 ?- s - - z0 ]; I2 f: \* z' c$ G
- char *dmabufsrc1 = NULL;* n7 F7 r- E/ s: u. D
- char *dmabufsrc2 = NULL;
8 V& G8 [+ P9 |7 V) }: P - char *dmabufdest1 = NULL;/ P+ e" U& @( W0 ]3 h0 ]
- char *dmabufdest2 = NULL;/ r5 s' B9 Z; R& Z7 c
- 9 y4 Q+ H y$ L+ j, B
- static int acnt = 512;
6 F& A2 t s4 |6 W - static int bcnt = 8;
, r3 N# b7 K1 J9 A b& I - static int ccnt = 8;3 w% [2 z* m+ C6 t7 |
! f2 G+ q% ]+ x& R- module_param(acnt, int, S_IRUGO);
" d# a6 w- i: L3 M7 w - module_param(bcnt, int, S_IRUGO);
! x, k1 k8 I6 h+ o X( c$ K - module_param(ccnt, int, S_IRUGO);
复制代码
& M" A5 {" k* X, y8 @
( A2 B# e+ Z7 j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 {. J% ~( m7 r, y( y6 carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 M- K: O4 @# f3 ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 ]7 _+ U) T) u
4 V9 d: A4 x: Y7 F/ r8 s
5 w! U) p+ `: k; ?( h |
|