|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, u) ]; | w$ x+ [: }* z- [code]EDMA sample test application
7 ?+ @, ]# u# g( y( \ - /*
) V- j% h9 h- }( ?+ z - * edma_test.c) ]% j7 R0 J6 {2 N5 O6 @
- *. p) U" X' v4 T
- * brief EDMA3 Test Application3 T4 C- G6 C" j; U8 u
- *
5 o3 k% j' [: f- ] - * This file contains EDMA3 Test code.
9 g' V% b+ O4 z7 Q- D5 C - *
# F+ b4 Y- s" N2 w- }2 @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: l, L9 g( }8 V8 u: j7 K& f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 R9 t: s `% w a( ?% w% ?
- * TO CHANGE.& O5 ]3 N% |$ M6 A; y
- *
! N3 I( ]. ~, F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ _$ D) Z3 v2 _
- *9 m! B% L1 m+ j& k9 N+ ^$ O. y
- * This program is free software; you can redistribute it and/or
+ x7 N8 g- B. H Q8 ] - * modify it under the terms of the GNU General Public License as" n8 c, ~8 u6 X1 T m7 t4 d$ Q* A' i
- * published by the Free Software Foundation version 2.3 [/ L5 X; t" M7 _$ A" c
- *& {3 S3 x R+ U7 M" R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; v F5 E; T3 L; y) a9 o - * kind, whether express or implied; without even the implied warranty
4 M3 a$ b: x" U! B. B1 Z' a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 H; t0 G% s% i$ y- c - * GNU General Public License for more details.
- S: H+ b, K; Z3 I - */
: l3 I0 I+ Y" J3 t8 ~ U' G - , w9 n7 h0 g! g: O2 [
- #include <linux/module.h>. o5 x5 R M9 R; _- B
- #include <linux/init.h>
: M0 M% ^; n( i) R7 y: @& X; P* Q - #include <linux/errno.h>
3 r; v& g7 Z5 T1 F& R - #include <linux/types.h>9 D4 h! F8 y D. @8 T$ [, M
- #include <linux/interrupt.h>
- k( b8 R# o' V6 I* F5 f - #include <asm/io.h>$ \( A9 s3 V2 ^$ } L& R
- #include <linux/moduleparam.h>
" l& k! {/ {8 Y7 I& k - #include <linux/sysctl.h> [; z7 j0 L, d
- #include <linux/mm.h>
6 ]! `+ x0 r% t1 o8 W" K( x+ U - #include <linux/dma-mapping.h># G3 C( l% I1 F
0 P* I+ Z7 J9 m# C0 H6 f8 w- #include <mach/memory.h>
0 f6 Z$ W O' t F8 g2 j - #include <mach/hardware.h>- w9 F6 _" V s: ?8 Y# w
- #include <mach/irqs.h>% K; j U$ W( X% {" [
- #include <asm/hardware/edma.h>7 @1 x7 X( S" D5 L
- ; Z. \: P1 z* m* C6 @' j6 w6 ?
- #undef EDMA3_DEBUG
( n8 L! W1 D) T6 C1 v1 x9 }8 W - /*#define EDMA3_DEBUG*/0 q: c) s" [$ I [
! U8 g8 @0 o3 G) ^& I, r& c* P; @- #ifdef EDMA3_DEBUG$ G; ?6 K6 U% R) }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ @( }9 f/ x" a2 _/ ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- U8 w# }/ f" ~& f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* C G3 D) C( i! o3 _6 T - #else
2 b. h8 j8 h5 `/ A" I& ~ - #define DMA_PRINTK( x... )# B# W: ?: p2 x
- #define DMA_FN_IN# w% X2 r. r o9 F9 a
- #define DMA_FN_OUT
; A- k! W! b8 _; T' Y+ h) n - #endif+ Y* R4 X1 _/ @8 J& J5 Q" O
T, p X, t! D, |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 w k5 ]' p6 Y+ M
- #define STATIC_SHIFT 3
1 s8 V6 K+ |4 j+ c( E9 O - #define TCINTEN_SHIFT 20
: o0 R8 V" R. u; E& W* C - #define ITCINTEN_SHIFT 21/ M1 u- n! I5 \9 G) q; g
- #define TCCHEN_SHIFT 22
7 P) E8 l$ \ E. o - #define ITCCHEN_SHIFT 23
: q n; V9 e. b' S+ i - 1 w- d3 {: Z* `7 [3 S4 @
- static volatile int irqraised1 = 0;
. s: M4 i; N/ a4 r8 I - static volatile int irqraised2 = 0;! C! \9 \/ B2 e- H
- % {% k& n/ z3 S& j- Z- k$ `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- F: |2 r/ T G, Z$ \, i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 u1 n; `; N7 I2 M6 l' ~, h0 p' M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ h6 [6 y8 g" E9 C& ^
- ) R/ Q0 P( ~9 v" i
- dma_addr_t dmaphyssrc1 = 0;0 I2 j1 Q3 F' t L. F8 q# Y
- dma_addr_t dmaphyssrc2 = 0;
* k: _* D' m6 ?5 p0 z% r - dma_addr_t dmaphysdest1 = 0;7 @! B( x" s. S
- dma_addr_t dmaphysdest2 = 0;
) i6 o- d3 A0 I; X - 1 }$ l: u: O5 Y, Q
- char *dmabufsrc1 = NULL;
) g' e! h( A2 j/ m - char *dmabufsrc2 = NULL;5 {/ R# @+ D. l, T" n
- char *dmabufdest1 = NULL;& S9 ]! ~! m+ l, u% d' u: X
- char *dmabufdest2 = NULL;
1 K6 h2 s6 U) E* D' n
# d. f! N+ a6 y0 t5 R- static int acnt = 512;+ }9 P* F7 T6 A+ F
- static int bcnt = 8;4 ]! X3 Q& T' Z9 T3 _! W
- static int ccnt = 8;& i7 N6 S/ } I3 Z3 H6 R6 T
- % B. x/ ^/ a1 j" j
- module_param(acnt, int, S_IRUGO);( F, ~% b& G; B$ v' ^& W" P# h
- module_param(bcnt, int, S_IRUGO);
3 N4 Z9 K/ k; r+ c% B* l - module_param(ccnt, int, S_IRUGO);
复制代码
9 L/ F- h: t- }7 e3 i2 z: }3 L8 E2 m# u/ I9 m8 ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 i" ^' V( }) b5 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- m* U2 t7 G" p% A+ T1 v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 ]! ]* E! w$ ` H; ` l% z
, \. Q) C+ ^, S& w- S& B% o
: K F$ M1 G# \2 K& R) w5 R |
|