|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # X' k0 T G1 [! t$ O' t
- [code]EDMA sample test application
: W% h$ Y) `6 X; g" ?. l - /*4 W p' k6 p9 B! T
- * edma_test.c; W4 Z+ h! J7 Q" a
- *
, y# z" ^; e- ?' J. `9 a9 d; [ - * brief EDMA3 Test Application
' |$ E1 O# a3 \. K7 W - *6 y. w7 _9 {- k$ C' ~* k' V0 D8 F3 ]
- * This file contains EDMA3 Test code.
3 @2 E+ J3 y* I, c - *
1 o' j* ~* O/ m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! K# [( H9 }! \9 t, `4 g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* W8 Q6 h; I* j7 P6 B
- * TO CHANGE.+ l7 j1 C+ D+ `& L- {. I. i
- *
, K$ C% _% c+ G0 {& r4 J, J6 V, W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ q$ }% S3 V3 z6 g9 O2 Q - *
* N6 y+ v0 f2 p- T# @ - * This program is free software; you can redistribute it and/or
* s6 Z' \8 e) |7 E' X% t, P - * modify it under the terms of the GNU General Public License as' s _$ [4 p( F- [! f
- * published by the Free Software Foundation version 2.4 ?5 z9 F& U6 V
- *
' c7 g+ s3 W' f- K+ \4 Y9 x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 k, Q* T' |! k8 L - * kind, whether express or implied; without even the implied warranty
* C, {0 ]/ C4 S0 N E6 M) ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 A! Y1 B+ }, W& i) d0 J4 f - * GNU General Public License for more details.: \/ P ]5 A0 {) J Y0 Y: n0 ^, N
- */1 b' d6 V# u9 E9 _" R% R7 Z% V# S
' w; i0 }, } E6 _- #include <linux/module.h>
' w* q- u! F, i - #include <linux/init.h>" c* A& l, ?' L9 y% j0 u a
- #include <linux/errno.h>3 \, q! r2 E! d9 v
- #include <linux/types.h>
; k, _ }1 l4 v+ O8 ~1 l/ ` - #include <linux/interrupt.h>& A0 F# o. @8 }4 T3 s
- #include <asm/io.h>
6 L9 y# i/ j- P; c( h - #include <linux/moduleparam.h>
3 p' Y! U* i- V M - #include <linux/sysctl.h>; S0 E. {: E; s% t" W5 j
- #include <linux/mm.h>
! ?( X* U9 a" R$ K$ [* a. x, Q - #include <linux/dma-mapping.h>
+ w' d# j: P) j9 j5 o6 D3 F/ d. k
d' @7 {( I% e4 @+ g- #include <mach/memory.h>8 k% m- b2 P8 A: |
- #include <mach/hardware.h>
4 l4 F" P/ A7 i$ u8 p - #include <mach/irqs.h>2 Y! ? X# F5 e' c& J
- #include <asm/hardware/edma.h>
: A* Q+ D% z3 ~3 |( R/ I% d. m
7 z( ^2 F/ B- j* h' X" |- #undef EDMA3_DEBUG) n% |5 `# x+ l3 P, Q
- /*#define EDMA3_DEBUG*/
% Q t$ x% R: X - , h" D1 i+ c, s' s
- #ifdef EDMA3_DEBUG* R: W k5 `- ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 ^/ W* H b/ H* E5 D/ K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 M& [7 o N* \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ `( X A. q& {9 n2 t - #else
0 y% U9 o e5 U: }: h - #define DMA_PRINTK( x... )! J. Z! H( a7 a; c! D
- #define DMA_FN_IN6 X6 s0 C, x2 a" D
- #define DMA_FN_OUT' Y: Z( `1 F- C- B6 z4 ~
- #endif
! g% p: \! K2 H: W0 e - 8 t5 z" W$ w5 R: g7 N2 }6 s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ [: l9 d+ J1 ]4 g
- #define STATIC_SHIFT 39 _$ V! k8 ?; A3 m
- #define TCINTEN_SHIFT 20
# m' d$ a. J/ {- u& e - #define ITCINTEN_SHIFT 21
) h1 k6 N! t' L4 i/ f( o - #define TCCHEN_SHIFT 22
( {$ h8 a) k3 X7 R( f& ? - #define ITCCHEN_SHIFT 23
* B- H- W9 b6 m$ I - , o( m. b7 t. p2 w
- static volatile int irqraised1 = 0;
5 G" v# _. F/ B- v. h5 [ - static volatile int irqraised2 = 0;
" x# t1 g% p* ]. g6 D/ R - + X- n6 N: [& S8 g( {8 w8 o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) ?, I9 b' Y" d1 N* A" n8 }5 r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 g( k* q# `6 q3 o. x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( H5 d* z6 `% S: D% \: I
- 4 a" R9 q4 O( \5 U2 Z* W
- dma_addr_t dmaphyssrc1 = 0;
7 A5 F: M d! j3 c% `3 @ - dma_addr_t dmaphyssrc2 = 0;
( T4 K4 v% \; x2 L - dma_addr_t dmaphysdest1 = 0;. b' T% O! U; A6 W7 V( a
- dma_addr_t dmaphysdest2 = 0;* ]! |" G. ?' z; m* g8 v0 z
) G1 }$ w2 b8 M7 z- char *dmabufsrc1 = NULL;2 [2 i5 V. B8 `& E
- char *dmabufsrc2 = NULL;; d+ N4 H! Q+ h( d8 |' o5 A1 T
- char *dmabufdest1 = NULL;+ u3 X1 ?& V$ `. c2 Y' M" f5 T
- char *dmabufdest2 = NULL;, `5 ^4 d. Q9 I2 B" g
! V" |- A$ M0 Y- static int acnt = 512;# H. m/ B4 Q" ^
- static int bcnt = 8;
6 j' Z% z1 D. K5 T' r - static int ccnt = 8;) ?) `6 d8 \$ G1 } o( W) }
- / e5 ^. Z9 S% J: D2 E
- module_param(acnt, int, S_IRUGO);
$ |* [6 L/ g/ {% } - module_param(bcnt, int, S_IRUGO);2 o9 V' S5 k: O4 O+ b( u( L! D: y
- module_param(ccnt, int, S_IRUGO);
复制代码 , w' [8 c' f* @
$ ~8 D3 q8 @$ h6 m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' w5 V6 N# S G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 O% m. k& Z: q" |$ ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 U$ P; T8 B# u1 K I
( C8 }. e! L( k8 q$ |3 h2 t$ r* K" }* \. T
|
|