|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : j# X+ B& w" ^( t* S# d: u) a: Z7 M7 t
- [code]EDMA sample test application
, `/ F) n* @; F7 v4 [ - /*2 g* N, k j' R: R/ f. @, I
- * edma_test.c2 @' j1 P5 o2 A, S4 h! ~
- *- D& ^# k- s, N/ Z, @2 b
- * brief EDMA3 Test Application
) W2 a& K6 w" P8 K/ f0 a" P( h' @ - *' p ?. s. K0 r2 \* x# S; d! r# d
- * This file contains EDMA3 Test code.
( @, C( Z" a8 p. T' v - *
7 W4 {/ N& x5 T. K2 }# E7 R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 N; c+ [* P! q/ Z' F7 p) h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 \1 R( d5 e3 g9 e- E+ p7 y - * TO CHANGE.
! {2 I" v! n' A+ J0 w% F - *1 ~( {; q7 ?( D4 ?- i* S# [8 Z* O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 ?* @5 y5 s* Q y2 ?) t
- *
- X; A+ X$ |1 T; z% S* R+ W6 a - * This program is free software; you can redistribute it and/or
5 J" f2 M7 J; D - * modify it under the terms of the GNU General Public License as$ t) I# z a" P. ^: \
- * published by the Free Software Foundation version 2.
3 [. c' Q) \& I I. q0 i - *
$ L* g: i5 x3 z) Z) O1 `5 @4 x$ H4 H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 p0 M" U5 i& A- t' m4 c( T3 N - * kind, whether express or implied; without even the implied warranty( C9 g- }1 W e* i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 g; C, h3 X7 |5 }6 C! A+ V8 G* O* j
- * GNU General Public License for more details.
1 C; B3 ]/ H3 N7 E" [! p2 \( p. h - */
/ d) q/ F9 P+ K- q8 K. m - ( G2 C1 x6 z' X; V9 ]! S' t
- #include <linux/module.h>
0 l8 t+ f2 X2 g$ L - #include <linux/init.h>
" G* N' ?$ M* \2 f' e& F7 H; i - #include <linux/errno.h>
; p) A; ~! X' D# D - #include <linux/types.h>
' T" q& C& \6 r S% V - #include <linux/interrupt.h>
; ~6 r- j1 W8 y$ q9 q+ { - #include <asm/io.h>
& o+ t+ o& N9 P; }4 W/ b6 } - #include <linux/moduleparam.h>9 t4 q, [8 y, {0 Z- j9 E* S
- #include <linux/sysctl.h>
1 e: Z5 d( L1 U - #include <linux/mm.h>
7 O0 L: A: ~ c+ S& }3 q - #include <linux/dma-mapping.h>
# ?. P' }0 X5 p% z% p - 4 G ?/ Y6 ?" G0 D
- #include <mach/memory.h>: c$ `2 `$ T. \
- #include <mach/hardware.h>7 R# }- R" s7 T" v. m
- #include <mach/irqs.h>
5 @* p/ ^; H( A+ w8 c. y - #include <asm/hardware/edma.h>
' b* Q( [ H) o' k x7 `3 \ - & r7 Y0 Y. b! m2 I% a+ I6 j( }3 ]
- #undef EDMA3_DEBUG4 N' b: M, [8 M+ B8 j$ h) P. w
- /*#define EDMA3_DEBUG*/. ]: k$ I8 S& q# y+ U
- + C* u* H! p) ~0 S0 ?0 r
- #ifdef EDMA3_DEBUG
# m7 j2 w5 V$ G- R B8 m* U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& H+ U# | k" m9 P+ u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& `, q3 ]! h, }; g4 W: C7 B; @# \$ w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 [3 C4 z' R5 p+ W& Z% V - #else3 j J) w3 B* d! _
- #define DMA_PRINTK( x... )8 E h5 A1 u' m! Z" b
- #define DMA_FN_IN. m9 @0 V2 \, |* n/ C
- #define DMA_FN_OUT
4 B% G0 t: r: D7 F5 H { - #endif" u: n1 B5 f7 }8 N. I, e- |" U3 F
- 9 `% \5 Y- ~9 \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 d$ {( w. `7 q
- #define STATIC_SHIFT 3
) l% p2 B, `# {; p7 ` - #define TCINTEN_SHIFT 202 _3 d0 [) A" s2 `8 s
- #define ITCINTEN_SHIFT 21
/ p$ P% P% C2 U0 Z+ B - #define TCCHEN_SHIFT 22
2 y4 v. B5 \6 c1 ? - #define ITCCHEN_SHIFT 23
' O) P9 t8 F1 s- Z3 X. b2 D
3 J% Z$ W5 y* y A% Y- static volatile int irqraised1 = 0;/ M; c: ] }1 ~. N! M, ?
- static volatile int irqraised2 = 0;5 d( L; {3 @1 E& J( m
- 9 K0 q% G! U) u: E; R$ r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ y4 P% l8 o4 D9 @( ?8 y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ~$ ~/ _5 k3 }1 Z2 E% ~# x& N8 |. @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 A3 n: T5 J4 U/ h+ [: s - 8 Y4 `' u L6 \6 b+ P: X2 a+ W2 G
- dma_addr_t dmaphyssrc1 = 0;
+ N9 v: Q7 Q( T5 M - dma_addr_t dmaphyssrc2 = 0;
7 q% b6 `3 S: I g* d( P) v - dma_addr_t dmaphysdest1 = 0;2 g! z U' Q3 Y+ q' G2 F
- dma_addr_t dmaphysdest2 = 0;4 D$ F$ N8 k( `: T, I
0 g& l {- n3 x) j* H, N( U' r! ?- char *dmabufsrc1 = NULL;# b( E1 ]0 m/ E- [* _' A8 w( W
- char *dmabufsrc2 = NULL;+ |" z3 _8 H7 d5 ] u# w2 d# Y4 [
- char *dmabufdest1 = NULL;; X/ [. a- J% Z$ Z% I
- char *dmabufdest2 = NULL;) ] c: ]- k* A# q
3 [4 z6 l+ n: n# ~6 j& N- static int acnt = 512;2 ~: T8 {8 @2 Z0 u0 u: s# r
- static int bcnt = 8;
/ d; T7 V5 D; C% s4 p4 |+ J$ d1 ^& d - static int ccnt = 8;1 P0 C) |9 b% i: K! ~1 o/ _
. T' @+ [1 G7 [; ~; D5 d- module_param(acnt, int, S_IRUGO);
5 x" V- v- t8 V/ C& p, I# F' R - module_param(bcnt, int, S_IRUGO);
9 j+ f6 Y! S: V3 ]! ^( b5 t7 Z$ w, d - module_param(ccnt, int, S_IRUGO);
复制代码
B: J$ n5 i1 f- T; x) \) p9 c ?3 s6 _) m; e; Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# p5 }9 I' c: [2 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 F0 {& z" k3 u, N# f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" y/ x) [* i/ z0 u2 e
' u! W6 |/ L m3 i; n8 K0 I9 W% U+ n0 N- K
|
|