|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! ?* r% A# H" P: {8 @- X
- [code]EDMA sample test application
( N* w ]" j) ]/ | - /*
' ~: g$ I5 A7 _4 [6 Z' ~. ]) i - * edma_test.c: v( H7 V/ _8 T9 }( l) @
- *0 h5 i: g# ~& P8 p
- * brief EDMA3 Test Application
, C1 j$ m" [. M3 s& k4 L1 Z& v - *2 J. V$ g1 Y. W$ S8 Y
- * This file contains EDMA3 Test code.
: f! j) n3 u! r" ] n$ W/ J* F- v' f - *) C7 L1 x. T7 Z4 A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
@1 k4 t# P2 z# B6 r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; k+ v6 R* j2 S/ C; X- X9 t - * TO CHANGE.+ Q5 j9 t' g8 m9 e/ P8 x
- ** d2 z& ?4 Q0 x \& E( D. f: [( L1 t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 |; x) c! x* S; S9 [ - *
8 d! m% Q% H, k- q; x- F9 `! L - * This program is free software; you can redistribute it and/or
8 C. B$ S _( C0 ^- H# x - * modify it under the terms of the GNU General Public License as
! j& a# K5 }! ` - * published by the Free Software Foundation version 2.: T7 |, | j) Z/ D& y$ r: h5 U
- *) ]5 \$ Z S0 s9 a3 o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" [8 {1 x# ^5 v, b. d. ~ - * kind, whether express or implied; without even the implied warranty8 y- Y' M6 S$ v1 K: w1 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. ?" |0 W$ N( T! G7 D
- * GNU General Public License for more details.& N9 a' v; ~+ d0 g! r- [
- */. Z. ^. C1 A }: t, v/ Q
3 |9 K, K" X& t: ]. f, F- x- D- #include <linux/module.h>4 {: U' d- T/ U4 k$ {/ H
- #include <linux/init.h>+ }* V6 z/ r5 ? Q% D+ k
- #include <linux/errno.h>( v0 x3 x- D6 v# y6 D: G0 o. ]
- #include <linux/types.h>2 P6 ~. g4 I# a2 t% T8 n
- #include <linux/interrupt.h>" T+ [/ N# q! G X: ?( |
- #include <asm/io.h>
6 k4 Q! Z0 f' m0 Z - #include <linux/moduleparam.h>) v4 | r# H7 V1 u' p( Q
- #include <linux/sysctl.h>
3 w8 r5 D" ]2 R* X - #include <linux/mm.h>
# M' l3 i2 o* b8 V( d# Y# z( O8 f9 W% c - #include <linux/dma-mapping.h>
# E7 q* g' l& W+ i# v0 D5 S - . ^+ e9 I6 c L/ t( g& D
- #include <mach/memory.h>
' B( Q3 ? |" w* |2 @+ K% i0 G p - #include <mach/hardware.h>% w9 r: l' V; K5 c; h9 `8 F1 F
- #include <mach/irqs.h>
3 C3 V+ v( J# t; W - #include <asm/hardware/edma.h>
l5 P0 F2 ^2 l# n' l9 u - ( c2 H! I7 i, M( L% y
- #undef EDMA3_DEBUG
1 H% I" q- T" d - /*#define EDMA3_DEBUG*/
% t+ F8 p5 Y$ N+ r$ `% B8 v4 ] - ' i+ f# n, J$ g2 a6 i4 S# R
- #ifdef EDMA3_DEBUG
5 W1 p3 V1 J! Z# A' Y- f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 o0 N. n! q; I4 [3 d+ k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. E, _& ~; G ~1 R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: W R) i8 A/ `( f9 v: n - #else
! i4 m- _+ H0 d: g3 l A - #define DMA_PRINTK( x... )
3 J& u- T# l: ?* a7 R: B6 I - #define DMA_FN_IN
( G3 S# i& O3 f1 X( k5 | - #define DMA_FN_OUT
% R1 m+ v, ^$ p- | - #endif) j. L A) m) i; b$ M% n# f
$ R. ]; t0 T! W, ^' L* h. L- #define MAX_DMA_TRANSFER_IN_BYTES (32768). U! _. ^8 ~3 w, ]7 u0 w/ r
- #define STATIC_SHIFT 3) H4 A" I, v. ^$ }) d/ X7 \
- #define TCINTEN_SHIFT 20, t- \5 w% p1 t# J
- #define ITCINTEN_SHIFT 21
0 H5 x. G+ A; @8 L- z - #define TCCHEN_SHIFT 22
% f- p. ?( I+ h - #define ITCCHEN_SHIFT 23
/ J1 s) E! i& J" v* r
v* X9 D U8 j. c, v2 a- static volatile int irqraised1 = 0;( E. z! A+ K( N4 J. v2 V" M ]
- static volatile int irqraised2 = 0;
6 D7 m3 l5 `( z+ k2 O: Y
, @' Q9 T" k& h8 d0 s" v Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- o/ z4 W1 n" e+ L7 F0 R6 | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 k/ H+ {" I7 T- b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! k+ ~4 f$ b' J) ?% L3 d - 1 l/ k: n8 _0 L& Q# N2 Y- y2 @
- dma_addr_t dmaphyssrc1 = 0;
3 ~" ?1 C( J$ t p0 c8 p' }3 U: L& S - dma_addr_t dmaphyssrc2 = 0;, k- l1 |8 j' N% Q
- dma_addr_t dmaphysdest1 = 0;8 [7 k( D7 d% ?7 K! e
- dma_addr_t dmaphysdest2 = 0;
( w- {6 T b7 G! h4 d- }5 P0 @4 }( Y+ c - 5 _7 a8 N4 t$ ?$ {8 n
- char *dmabufsrc1 = NULL;
8 E! | z2 p8 [+ |* `7 Q - char *dmabufsrc2 = NULL;
K- p( u! C5 s5 f! G. K- ? - char *dmabufdest1 = NULL;
2 a& E" M+ E8 W- p* B - char *dmabufdest2 = NULL;
" K! Z8 S) V3 @% I - $ N: g4 t2 }+ W7 {! q# e& w/ j
- static int acnt = 512;5 E( Y: B {/ ^, ~
- static int bcnt = 8;* C! g7 o) E: p! }
- static int ccnt = 8;0 u. X/ ~0 R3 _: X
- + G6 j, c+ q/ b+ T6 h9 O2 V
- module_param(acnt, int, S_IRUGO);4 `4 k$ M8 n8 o* w' ^" {& ~
- module_param(bcnt, int, S_IRUGO);
: ^ l+ D* T8 t- ] - module_param(ccnt, int, S_IRUGO);
复制代码 $ Y1 {: y9 m. r* D! m% }
* p3 j( X% ?* J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* M% k; Y" |# {. k& A& Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& j7 J6 D/ g6 m2 E- v4 K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% w" b3 R. v1 K" Y2 N4 x- r$ F2 n# h
' d4 ~( ~' ^* @' A* x1 |7 t3 ?; B. `
|
|