|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, E( v6 @' W) r& d- r) j; w3 @- [code]EDMA sample test application5 I, Q* B* X( I8 ~2 {
- /*
; H+ q1 l/ H" _* p, Q: j - * edma_test.c9 I7 T+ O, f: g/ `- U O m" Q
- *- d9 u6 I) ~$ i7 T/ @
- * brief EDMA3 Test Application4 j+ G/ s8 K F. B/ P% o+ w
- *' g# w" ^/ }6 W! k5 G1 ^0 U: r3 U
- * This file contains EDMA3 Test code.
. q. e5 B$ q- h, O* \ - *& r( x# N- _; T7 | t+ p- S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- |, W4 c% n; t! | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 t: Y8 g( D9 v
- * TO CHANGE.
m( d. V3 l8 K9 C! E0 c2 f - *
* ]6 G" }- v1 h l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! z4 X- k4 z& l+ Q g% _/ K - *1 D' N# q* E: W) q: P/ M
- * This program is free software; you can redistribute it and/or) A2 {# F7 k% z( q8 v" n
- * modify it under the terms of the GNU General Public License as
+ B: _$ `* D& R+ {! f - * published by the Free Software Foundation version 2.
: s7 _6 x: E* n6 A8 E5 [% I - *5 T0 J. H4 G$ n5 } V- ]$ T5 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 ?, |/ }! h- C. _& K" D - * kind, whether express or implied; without even the implied warranty
8 W. K$ G; e3 X: I3 N& [# R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ b9 `* q+ V* m t7 ? - * GNU General Public License for more details.3 ?. a% R" {; b+ Y. a
- */- N0 H' [& h% z
- ! q* f# b4 O- i
- #include <linux/module.h>+ { `9 M2 E; E. E6 j8 M' V+ K) \
- #include <linux/init.h>/ W( B1 C! w+ G0 F+ s4 P. i5 I" d
- #include <linux/errno.h>
/ g* i/ F+ K6 E/ Y4 ?) S# ` - #include <linux/types.h># T5 h4 |5 t/ r0 j. J6 D5 W5 z+ R
- #include <linux/interrupt.h>
, q4 g, T, p- T - #include <asm/io.h>) w7 J4 I7 O* ?( t; }8 H9 }- [! M% P3 X/ ^
- #include <linux/moduleparam.h>0 J( E* |1 l3 T
- #include <linux/sysctl.h>
# [/ m' M: X o- `% v- M - #include <linux/mm.h>
! k f% _: H* B. G. [8 o3 i - #include <linux/dma-mapping.h>( M3 p3 M7 T! [8 [! ~ z" x. N
- * Z8 `4 q' B7 j% Y
- #include <mach/memory.h>& k: Z2 Z8 M0 e8 n A& x
- #include <mach/hardware.h>- U7 _1 ^- k& f0 R% d/ @
- #include <mach/irqs.h>7 p7 h$ u, v; P7 g" i9 |( W
- #include <asm/hardware/edma.h>
6 g! U/ |$ S d3 \: P) R; S - % S8 I; ], N' \1 L+ ?5 R% y F8 Y
- #undef EDMA3_DEBUG# N. Y, D- z' d7 T" B1 Q0 g
- /*#define EDMA3_DEBUG*/2 h0 h6 C8 S$ m
# H0 @. b' q9 T5 Q( }- #ifdef EDMA3_DEBUG- o/ Q- {( ^/ S! h. Z7 Q/ `* `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; |8 A! z4 s- j8 G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 a: Y- b, l+ L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' A4 ^! p1 `7 ` U- }, R& ]% W
- #else5 M# y: {7 q1 q, }9 r5 V7 r
- #define DMA_PRINTK( x... )
% v) a8 u& \+ b8 s1 N1 Y" S8 } - #define DMA_FN_IN* z- P% ?' \# U: y9 M/ s
- #define DMA_FN_OUT, {! w7 u2 L2 G- h$ p9 y ?
- #endif
' T: F* v6 g( ~% k% \1 w; N( S
! A/ o8 e* s2 F4 A# E3 p& e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ ~% _4 y: I2 t- h z
- #define STATIC_SHIFT 3
0 q9 O& o, W# W o* V4 F5 r - #define TCINTEN_SHIFT 20- I4 U% z6 ~5 C) i2 M
- #define ITCINTEN_SHIFT 21
, I; J# ^& c, A9 t' n# ^/ x+ t7 P9 o. u - #define TCCHEN_SHIFT 22
$ j2 F' ? q# G - #define ITCCHEN_SHIFT 23
/ R/ A& D9 ]& C" h- A! r - $ `. n. {7 S) P- K% n4 M6 C1 c7 R
- static volatile int irqraised1 = 0;
7 k& t9 h# P! B: A/ b$ l' `! K - static volatile int irqraised2 = 0;6 L0 W; V0 H. D5 y3 s
- 6 F$ T. n3 Z7 u( I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 \$ p. q% M; Z+ ?- _1 Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ]2 a6 `1 d- b, i% H5 I4 N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 G c5 e* ?3 S6 K7 i$ c
- 5 s7 k7 a2 {. n( N
- dma_addr_t dmaphyssrc1 = 0;& z$ j6 y# B# V" \ V( u
- dma_addr_t dmaphyssrc2 = 0;! Q. O! k; F; h. p6 E
- dma_addr_t dmaphysdest1 = 0;
9 a6 |1 H. b/ d& N) Z; U3 u - dma_addr_t dmaphysdest2 = 0;2 i% k" D6 \7 Q! N
- " R1 |# K' @1 [3 ~
- char *dmabufsrc1 = NULL;( s. @, U* |) j. e9 ^
- char *dmabufsrc2 = NULL;8 G9 D; o3 W, [
- char *dmabufdest1 = NULL;
% c1 ]( D' \4 h& F - char *dmabufdest2 = NULL;. V% I, f9 \2 p3 I6 u2 ?0 L
- $ V6 c2 R! k ~, k# U4 C7 o( f S, [
- static int acnt = 512;
% _& ]" _' [# `, ^& ?! n% g: u8 X3 j - static int bcnt = 8;4 r8 d0 w5 `$ ?' f# {; I. B1 ^
- static int ccnt = 8;
3 ^. v% x# u1 \ - 4 w6 ]( `. K$ p. [$ n
- module_param(acnt, int, S_IRUGO);
+ k8 S1 h7 u6 v- j; D( S. c - module_param(bcnt, int, S_IRUGO);2 }) ]* g5 w$ y' P4 W1 A
- module_param(ccnt, int, S_IRUGO);
复制代码 ! X) F3 s. O+ |1 q0 b
: p. m# i. R O7 l( N" r6 g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 G3 R& H" w$ Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 G$ R+ y, _# i$ U0 ~, v. c8 o5 u% K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ Y; W5 j- D( X1 @9 J' W
3 S: n0 b! f9 n6 I0 e. ~
# p. E! }- C/ t. U7 O
|
|