|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 S. ?. [9 A) E- [code]EDMA sample test application
8 q. ~; T* _9 W. f - /*
: |( y% d: \- Z! r* V - * edma_test.c6 C% u# A# l! ^# r; U
- *: z7 ]- m" W# [: k
- * brief EDMA3 Test Application9 p1 _( }- ~+ V
- *. L0 Q/ Y- h- G3 r
- * This file contains EDMA3 Test code.
' W6 a9 O C& |( K - *4 k6 Z2 I# P( B& x1 ?) x0 q9 a) e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; c4 d* ? |, r0 t% R5 n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' N/ y' J0 E! V7 C; o( x. m - * TO CHANGE.8 [. G, Y/ `) o6 a* I& y8 F2 o& }
- *% @- T6 K% X1 w# ~: E- t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 H" E7 {) V9 V' e/ G0 v
- *
% D& Q3 m7 d$ ^. O, J8 F/ i/ @; ] - * This program is free software; you can redistribute it and/or3 @9 C$ G2 J0 R5 G- a9 V$ F
- * modify it under the terms of the GNU General Public License as
3 p( E j# P S3 n - * published by the Free Software Foundation version 2.) c+ ?4 J' L$ d' S; K: q. d% n
- *
2 I3 _7 s3 K" I& \% }* y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any A& w' P4 p7 K4 s0 r6 _8 D
- * kind, whether express or implied; without even the implied warranty0 ?9 H' i9 c0 X* i3 M: X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the v3 z* S3 S: T( N( a
- * GNU General Public License for more details.
2 C! i5 \: o0 f$ X2 z - */' O4 {7 ] @1 b/ k% w/ n8 S" d% e
- # t1 v8 D( u' D# i4 ]
- #include <linux/module.h>
7 H; a$ F' g. F6 h4 D - #include <linux/init.h>
2 s5 D2 R# E0 h$ Q( Y1 s - #include <linux/errno.h>9 g& B7 Z) g; l' C! c, Q2 `
- #include <linux/types.h>9 R, o, j# A! s+ [6 l& l
- #include <linux/interrupt.h>
& n) ~: B3 ~% _0 G% V3 R - #include <asm/io.h>; T+ s/ n6 t7 @2 s" S
- #include <linux/moduleparam.h>
, x4 r# U, o$ T+ P, ~ - #include <linux/sysctl.h>, `) Q" R+ n: j) c
- #include <linux/mm.h>
, [9 Q: ?' M, U - #include <linux/dma-mapping.h>. n d- }% c) H( ?6 g2 y' Q
- 9 x U+ `3 {3 o
- #include <mach/memory.h>8 S: F. F0 M* A" O
- #include <mach/hardware.h> `6 _. f/ o$ `) v# i9 \
- #include <mach/irqs.h>* @5 p; c: k9 F
- #include <asm/hardware/edma.h> x: o" T* v k: |2 x
- , I$ q' X5 u$ w# I6 `( V
- #undef EDMA3_DEBUG
0 ?$ A% b; `0 H( P6 N+ X* R j - /*#define EDMA3_DEBUG*/$ ]- {! ~' ^# e9 w, k. `
+ I9 d3 h' q* A' P- #ifdef EDMA3_DEBUG2 o+ k. \" q4 v# }+ w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- }8 A* @' g3 z& a6 u+ W# k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" ]0 P: S; `% s5 D$ f: }0 H) z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 s! \5 J( i! @( b: G3 o _6 m
- #else# [% m2 w- n0 Q- [
- #define DMA_PRINTK( x... )
7 h! \, k6 Z6 T5 q - #define DMA_FN_IN8 }; b0 w4 t* ~5 I# R) k) Z" Q# \
- #define DMA_FN_OUT4 o" O7 c, l. ^. R
- #endif
G* m0 d( Y, |" @7 k5 z+ j* _
% f4 n: S# \3 R' ^2 @5 Y& K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; l) Z: ~7 t9 t l- A - #define STATIC_SHIFT 3
; M, B1 E, E. q6 J+ E1 } - #define TCINTEN_SHIFT 20
7 g' W" N! {' q4 @1 I G - #define ITCINTEN_SHIFT 219 p% E( a' W3 X% A
- #define TCCHEN_SHIFT 22
! F5 o, U% } w, x" y - #define ITCCHEN_SHIFT 23! S& M2 }% K" N* j
- : E; |6 D }7 ~
- static volatile int irqraised1 = 0;: f$ ] B2 P% a6 k
- static volatile int irqraised2 = 0;
! S- Q( {8 W1 U- w G
- h1 `/ _ c7 R; k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. h& n$ K8 K: p; J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, H2 ~4 K5 H& {2 t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 p4 K1 D$ ?. C: I. W9 y - 7 V% H- @; g7 t. \5 H1 @1 h
- dma_addr_t dmaphyssrc1 = 0;
% u4 l8 } D- ~' c8 ?' S. W - dma_addr_t dmaphyssrc2 = 0;
3 R+ ?6 G! ~- i6 n- D( \ - dma_addr_t dmaphysdest1 = 0;
8 e& S6 o* w- c# Y* F9 V - dma_addr_t dmaphysdest2 = 0;
. M) T; g3 ?& M0 N+ p5 w( e$ `
9 C7 o- c/ |9 B/ X' W- char *dmabufsrc1 = NULL;
1 Z' {& J# H- `! |4 o - char *dmabufsrc2 = NULL;
6 V5 [0 y& }/ q5 ? - char *dmabufdest1 = NULL;& q6 e) S& ~0 t( C
- char *dmabufdest2 = NULL;8 J- G. r6 ]( J; v
* g( g; a2 ]- [* Q% |8 T- static int acnt = 512;4 I6 Y7 L+ k( E" I- y4 T0 ?9 U4 Q
- static int bcnt = 8;
7 R, ]6 |0 A- ^- v% v - static int ccnt = 8;) L3 i. T, n) W" H: X
- , H4 F9 r0 N. z5 ^1 S; r3 s7 F
- module_param(acnt, int, S_IRUGO);
; m1 J- g1 a! b. V, c- u - module_param(bcnt, int, S_IRUGO);
+ I; P$ ~5 G1 K; u- Y( x, {5 N- \, S - module_param(ccnt, int, S_IRUGO);
复制代码
) J6 ?, r- M% k9 @) d# v6 ^" E, ~, ?( q1 [1 ?8 D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% O. k* @. @( s3 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 J0 o& j% p5 u0 ~# ^' ], _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; V% r, r# T% U: ?! C, @" q; y
# `$ i7 q& G* t& v" ~# g# L* ?$ @3 ~8 U' V. D2 s( ?# Z
|
|