|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ C" c3 a) [3 `9 u4 k1 o! }0 s; w
- [code]EDMA sample test application+ G" \7 [) [& H3 Y# {# t& @5 D! J6 ?5 O
- /*: V% M7 B# y4 s6 S2 G: O
- * edma_test.c
$ h8 O) H: ^0 w( ~) X - *! J3 T+ e( C2 \. c; C7 l& k. G4 u
- * brief EDMA3 Test Application
( g3 Y2 {# E( r6 c2 J; l - *
# b5 t4 z) l" k0 s, \9 { - * This file contains EDMA3 Test code.- I) s7 J8 H. o. o' ^2 ^
- *
% z0 a% I6 @$ r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# p' d' w) @0 N4 w! ~; F& c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ t) M: z" I& a) ~ r1 Q9 X& x+ d - * TO CHANGE.
* Q% ~$ d h: J8 [ - *
! B. O# T/ X$ v1 _$ ]) B* |% g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- E5 M, f8 _4 E. K. P: @( W - *0 M- |+ p% u) N% e2 C- r5 k
- * This program is free software; you can redistribute it and/or6 d3 r6 j1 H1 j* s# r. t
- * modify it under the terms of the GNU General Public License as* N6 ~2 O- \$ l/ K" m K# X; j
- * published by the Free Software Foundation version 2.
& U2 b$ F! ?( h0 v; k% S x - */ N4 i5 G# j6 f0 { D% |2 \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: T% R5 }" ~ a6 Z - * kind, whether express or implied; without even the implied warranty# U' I( p8 A4 D8 G' x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 X9 t# p$ {/ r4 e4 N# S# N - * GNU General Public License for more details.
, |0 q/ a0 t2 q% p5 ]8 w, ~ - */# r& T* `* \5 c
4 h0 s% ^% `& s& v- #include <linux/module.h>/ x* T+ i* w$ I
- #include <linux/init.h>
9 v$ Z2 B* t& b* J3 c$ i( l - #include <linux/errno.h>
( {- S+ G3 y% ?% s! ^ - #include <linux/types.h>
. r t- Q8 @: V% | g - #include <linux/interrupt.h>+ f' H3 i5 H% s0 E
- #include <asm/io.h>
O) A$ L( p" e2 k9 v* [& Q4 N" y - #include <linux/moduleparam.h>+ t7 T: E" h3 H- R2 I
- #include <linux/sysctl.h>0 @2 f3 X5 M9 u* p
- #include <linux/mm.h>
& x8 G, Z# Y: `1 G# F# c1 G - #include <linux/dma-mapping.h>) N" F0 m3 Y! W- r$ ^' J1 a; ]- H+ r
) n& Q" t, `. _% c0 f) r) `% i- #include <mach/memory.h>
3 q U- _ ?- t* N - #include <mach/hardware.h>7 o6 O6 ?/ ]2 Y; ^& Q D$ A/ F
- #include <mach/irqs.h>( N# a, J7 p* y! a# E
- #include <asm/hardware/edma.h>9 ?! I C$ R% k: B$ G
) ]& }* q4 c/ O3 _% z& U r- #undef EDMA3_DEBUG
7 f- I# D6 I. v- ~! E - /*#define EDMA3_DEBUG*/
6 U* `# \, u6 y: a7 x- [
1 S1 r9 X5 T( ?% I4 S% M- #ifdef EDMA3_DEBUG6 A2 N; _: e4 ]4 ~7 X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ s& w$ B4 \) z+ c6 U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% }. J! I( _ j2 Z* b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 F# U) i, B9 s- a" L6 e; L: N7 _3 L - #else
# Z& [0 ^( |: ?, A* N! D - #define DMA_PRINTK( x... )
* S g% ?. M; T - #define DMA_FN_IN
' @9 [5 @5 E; K5 b, d/ O - #define DMA_FN_OUT
, D% o6 r8 X9 c' h4 h8 i$ J1 e - #endif
3 O( d4 e; r% {% z# F u" T - 2 T/ c2 z* ~8 D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 ]/ O" G( s3 @, J! N7 F) z$ F - #define STATIC_SHIFT 3% b! ]0 H. f' U0 g: |" ^+ x
- #define TCINTEN_SHIFT 20
2 Q; o, j1 B- d; \+ b7 k - #define ITCINTEN_SHIFT 21
" i" l9 g3 J8 a4 F, L - #define TCCHEN_SHIFT 227 \/ d0 I1 Z9 b) R
- #define ITCCHEN_SHIFT 23( ]6 Y+ v7 W9 \8 E/ |. ~9 c
+ J8 `! }; m1 R I" S% ]- static volatile int irqraised1 = 0;7 x; K3 F6 j; I+ T+ b+ X/ E6 U
- static volatile int irqraised2 = 0; v, m) o; _0 q5 _7 C0 h! K
- ; O* x9 G0 l: U3 D2 I. o3 h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 y+ Z* W3 s F& G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* v+ K+ {+ A6 a7 x" B) c# R8 H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, I* n k; Q4 v* A! @ - 9 b. a: q& o) V
- dma_addr_t dmaphyssrc1 = 0;
( z K( M Z, E1 k8 N9 _/ H - dma_addr_t dmaphyssrc2 = 0;
8 a9 u) H4 P( v - dma_addr_t dmaphysdest1 = 0;
x" [. \! H* T& t6 W" \$ Z; P/ f - dma_addr_t dmaphysdest2 = 0;' c F# T% q' I+ [/ }! f; K- A
- @3 T/ D9 N( X$ J6 ?- char *dmabufsrc1 = NULL;( f U, Y& g1 @, ?5 p8 }) h
- char *dmabufsrc2 = NULL;' A9 G1 @ E( R6 F! n
- char *dmabufdest1 = NULL;, x9 K, M! K8 ?0 V' L4 h
- char *dmabufdest2 = NULL;& O: U x2 v* V+ g, D. h7 P
! f( C9 j5 G/ O* m- static int acnt = 512;. T4 R$ U: d+ r8 Q! O* v: Q6 o
- static int bcnt = 8;( K! o" L" b# l5 P6 a
- static int ccnt = 8;: \+ C4 P* _+ x+ {2 f% _5 @
- ! e6 g; }: y" ~! W
- module_param(acnt, int, S_IRUGO);+ A% y: s( S, x
- module_param(bcnt, int, S_IRUGO);$ `1 C' V6 D& r |
- module_param(ccnt, int, S_IRUGO);
复制代码 + e" \# X8 n! C$ b9 c
1 o- g' l) Q( K* M7 U8 b# d7 c4 A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 \1 q# @& V9 }6 @4 a! I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( p0 b: W- g M+ p. N0 m* s1 ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- g, A" r" F" J7 n/ U/ t9 k8 E3 _4 U K9 l3 z4 P
# j- Z8 ]& w4 M1 H* |( m
|
|