|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, Q0 o! K% T7 \8 U' Q# {- [code]EDMA sample test application
% j) a$ H {- l' e3 | - /*& Q# H8 p+ r5 S' I6 ?
- * edma_test.c8 K2 ?7 e, z; s" G
- *" H+ p0 U6 s2 t6 z2 T$ Z3 k
- * brief EDMA3 Test Application! B r" X Q' ^' n: V. C1 O
- *- v% ]9 f/ B7 L! ^$ @, n) c
- * This file contains EDMA3 Test code.
* ?- d1 j7 o* ?5 G7 a* d6 X. o - *
" P8 C& f: G- C2 _: _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( a6 ]3 D1 s) ^0 h5 q& K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ ?8 b4 M3 ?* s- } - * TO CHANGE.
; i8 J& G F j: e( i6 T9 Z, e3 h* } - *
! K& \6 h+ z1 n7 X& b5 C R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 h, D/ j" c0 o( f. v8 }7 V - *3 p! |$ M+ g ]2 A" R! P
- * This program is free software; you can redistribute it and/or
% z8 T% h' G# m$ e" O' ?/ N: Q - * modify it under the terms of the GNU General Public License as9 p- Q) l- H1 E; T
- * published by the Free Software Foundation version 2.
& x# N7 d$ d9 |; x - *
% K- e5 ]) y. i3 f0 u1 k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' v: Q7 H5 F5 ]2 E0 I7 Z. | - * kind, whether express or implied; without even the implied warranty
* T& b/ A. h- V! ~+ B1 x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; ^' S/ K" [% x2 @' Z' D a/ \) D; I - * GNU General Public License for more details.0 \9 D5 g' b6 t; n+ e
- */
Y9 [' l% P" i& ?
+ d& S+ {. T. B' r& b- #include <linux/module.h>
+ R4 y7 T! N. N2 _( U; Y - #include <linux/init.h>/ `* V* T9 ]$ U4 X( S# f9 E
- #include <linux/errno.h>
6 C2 E3 X. f- u, l/ d - #include <linux/types.h>
1 b: ]0 I% T+ A3 P3 @ - #include <linux/interrupt.h>
q: ~, A" b, y - #include <asm/io.h>0 z# v& A7 g" I/ O- V
- #include <linux/moduleparam.h>
& w+ c7 u% k$ h0 L. D - #include <linux/sysctl.h>
# ~. F9 C1 j. p& | - #include <linux/mm.h>
# m' @5 A! b5 L0 X) f' D - #include <linux/dma-mapping.h>, l/ @( r( j. d/ c7 ?, @
- * t- G6 s* H k* m
- #include <mach/memory.h>* u6 c! v7 J- r$ ]5 B, o
- #include <mach/hardware.h>$ N5 C& y) X" }2 @2 l$ T1 x! s; q* z
- #include <mach/irqs.h>4 y; L$ ~/ a" E, p0 y8 x' n, M
- #include <asm/hardware/edma.h>/ u7 c/ E }1 c& s
- 4 s' u5 o# b8 }! k% l
- #undef EDMA3_DEBUG
4 D/ d2 N* a- y/ @2 Z - /*#define EDMA3_DEBUG*/! G( r( l7 }; Q6 e
& _- Z+ y* K6 u0 a; n; {- #ifdef EDMA3_DEBUG
" o; x2 g C0 S2 N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 T2 `8 B9 Z2 E( `7 T% v: j* [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 U8 i! i" w. z1 I- F8 g9 o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
F" v/ B9 {1 @# Y - #else
: F7 Z/ b' Z- I5 q - #define DMA_PRINTK( x... )9 p: f; j; F2 a
- #define DMA_FN_IN
4 ]5 c7 F/ N: B" F - #define DMA_FN_OUT
* A/ l5 Z) H! G& C1 g - #endif# h) W& e: ^& o$ ?" `. y* J7 i
- / f+ N8 z S) X1 D. Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ f$ e3 M$ s7 k# @2 T4 J/ w - #define STATIC_SHIFT 3
3 k7 `4 ?- _9 d+ \ - #define TCINTEN_SHIFT 20
m2 A0 J6 m' j3 N& F - #define ITCINTEN_SHIFT 21* y5 v- ~$ a* ]
- #define TCCHEN_SHIFT 22
3 m" F/ o5 L" N& G; p' n( C - #define ITCCHEN_SHIFT 23
M( a' U8 v k0 ^ E - d- L& b0 }/ D, q( K2 Z
- static volatile int irqraised1 = 0;0 q& Y* `4 d! f$ ^# `
- static volatile int irqraised2 = 0;
2 M% q3 j3 F) G5 k4 T - & C+ j" `7 T9 T h, {6 j4 P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- S, ^- ]# l6 P2 N: U Y8 b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, J2 C0 E. H( V: z9 x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 Y4 @4 G! t4 R5 Z$ j. {$ _4 I - # R0 b6 F7 R5 @; s/ G7 l1 l. d
- dma_addr_t dmaphyssrc1 = 0;
9 C6 S6 t1 g" y5 h- } - dma_addr_t dmaphyssrc2 = 0;
% e( w# @! {' a - dma_addr_t dmaphysdest1 = 0;
# P( {4 Y, @. {6 ?, s1 u/ U - dma_addr_t dmaphysdest2 = 0;
7 Z5 ~& X* N y; w; C6 V
; q+ c$ u2 q @/ d) @- char *dmabufsrc1 = NULL;
/ r0 w) f9 x7 H# e5 q9 } - char *dmabufsrc2 = NULL;8 {# f( A/ R; E0 Z3 |& U
- char *dmabufdest1 = NULL;- ~$ K7 l0 a6 G" o
- char *dmabufdest2 = NULL;& Y g1 K X8 Q- ^6 q+ J& E" L
- 8 S! R2 Q0 W4 e) f @" F
- static int acnt = 512;
, o3 \1 _0 x4 N4 R2 V7 | - static int bcnt = 8;7 m% R {9 q3 @+ t
- static int ccnt = 8;
+ M! Y+ t- C- K
, D2 @5 {; Y) H1 @/ o2 u# d3 V+ X- module_param(acnt, int, S_IRUGO);
3 f2 D" B& O4 M+ ] - module_param(bcnt, int, S_IRUGO);8 c6 T8 {, |, q- b5 q& @8 Q
- module_param(ccnt, int, S_IRUGO);
复制代码 % c) I! L4 ^$ w! ~ C8 r
) u1 S& q! K# n) F* D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# c. p# }4 I, C$ U: f) Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; I+ |( c6 J% l. {$ N6 @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" v9 N: t% M5 w1 s( a/ g# c8 N: G
6 |2 E/ D: _* ^$ v
5 Z* U9 e" T; e. W
|
|