|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# J+ h/ ~8 L, G, _/ B2 a& X' G, `# E; d- [code]EDMA sample test application
3 H9 f4 M8 I4 F. w" e - /*
8 a+ G ~, a4 h - * edma_test.c
U1 _- i Y9 U - */ j# K; ~, ]2 i$ D6 @$ Q
- * brief EDMA3 Test Application0 `! \' n2 T' B$ ` h
- *
( }! `+ H9 y$ B( Q0 ?. g# E; A6 ~ - * This file contains EDMA3 Test code.
/ {1 i& ~9 O' A - *3 @: F6 u" ]. C0 `3 `: {5 t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 T5 t8 _6 d# B% @! G3 R% N6 ~: E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 ~) X6 g6 G) R8 I- I - * TO CHANGE.
3 N- l8 P& c8 v" f - *
5 A0 `) ]8 K# f+ D I, k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 G' Y; a3 d7 s5 D
- *
$ S4 J. x3 Y8 A) u - * This program is free software; you can redistribute it and/or' Q/ u f* {2 [; M
- * modify it under the terms of the GNU General Public License as
w; g u* l J. b9 {! Z1 E - * published by the Free Software Foundation version 2.; \5 f& H' Z4 t4 e: h+ h% @
- *
8 D$ j; w' }* I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 t7 D/ V- X1 @* S# l+ `- Z1 a a - * kind, whether express or implied; without even the implied warranty1 B0 F& `/ K, h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 R4 a' v5 i% Z5 }: I/ g7 ^* `
- * GNU General Public License for more details.
2 l, ^6 A7 \9 |5 g1 ]( i; d - */3 d2 Q/ M ^; o: D/ D
- + ^3 y3 q8 J3 u' N: I
- #include <linux/module.h>1 D, c8 L2 d! d
- #include <linux/init.h>/ |& ]+ h4 t! x$ L9 p- X0 x
- #include <linux/errno.h>5 l" e8 @4 O' Z8 ?3 q5 d
- #include <linux/types.h>' ?2 Z d: e- y' i" ] ^& Q
- #include <linux/interrupt.h>
) H2 I( K! [0 K! c* [: ?, _ - #include <asm/io.h>) n$ w* l' f! b8 _
- #include <linux/moduleparam.h>( I: @3 N* \6 m' u
- #include <linux/sysctl.h>
3 R5 W5 K6 h0 u2 B - #include <linux/mm.h>4 Y6 U/ E9 n) L- w+ H% {; C
- #include <linux/dma-mapping.h>, Z/ O! h1 ^( \: B/ n: x
* \7 Z0 s3 I( y" d) B0 x- #include <mach/memory.h>" H. }" v: A, }' v! o
- #include <mach/hardware.h>6 `5 B1 H3 P; `
- #include <mach/irqs.h>
4 H7 q- v. e: Q% Q# A - #include <asm/hardware/edma.h>
% l$ ]5 W; \1 G/ ~& m
/ R; H2 R: n# s$ n3 a' X. l$ T- #undef EDMA3_DEBUG; c+ s+ \; m/ d$ a+ c: t5 X* C
- /*#define EDMA3_DEBUG*/' G% N/ S+ B8 @ `
- - p" V5 R% V8 z* \, m/ z' G
- #ifdef EDMA3_DEBUG. U, S( e' c0 V/ s% g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 _. ~8 t4 T' _: k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' [1 H5 L4 M" s- f! g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' N0 Q5 |' a/ i - #else
; _. d! b0 J8 k - #define DMA_PRINTK( x... )
' ^# g/ u& x2 \ G* G" I$ @! d - #define DMA_FN_IN/ F1 P" s) e: E+ E, G0 P3 g8 Q
- #define DMA_FN_OUT
% V& U h3 C/ M: q( o- ~# k - #endif" a4 q8 |7 L( X- E+ {4 B
& @) {2 z& O* {0 F3 J" A3 U- l& q; w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ e3 `9 i- G. v* D2 l% ` - #define STATIC_SHIFT 3
* y! _8 J9 [* l# K - #define TCINTEN_SHIFT 20. T( c9 F, D, q& g. W1 h- W
- #define ITCINTEN_SHIFT 21
( s- P4 X$ I0 _% } - #define TCCHEN_SHIFT 22
& ^1 d" p2 c5 B) A! b3 V0 [ - #define ITCCHEN_SHIFT 23- G+ s8 U! l- ?; U8 s+ g0 B) U
- p G( b: T6 v2 e. ~
- static volatile int irqraised1 = 0;/ w+ o, f) f9 k% K X: X- K
- static volatile int irqraised2 = 0;, e. |8 A* T _8 `" @# f
- ' D6 k' z0 }, w4 h9 `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 B5 Q+ C7 K# F2 ^2 Y! \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 U/ U8 J7 a1 O: Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: H9 w/ i* _; {- ^* S3 u0 }4 u
- ! n1 U; W! [: o/ @
- dma_addr_t dmaphyssrc1 = 0;/ Q2 J. d/ F$ [( m$ Z, S% p
- dma_addr_t dmaphyssrc2 = 0;3 u/ c/ ?1 S" ?: j! {
- dma_addr_t dmaphysdest1 = 0;
( l& i7 q6 ^) n; y% z# Q8 P - dma_addr_t dmaphysdest2 = 0;0 @3 M; S/ T* j" \3 q J
: u/ t3 `. u+ h" P, U" e- a. p- Q2 s- char *dmabufsrc1 = NULL;( c% t7 R$ ^, u% ]0 B- F# L1 ]
- char *dmabufsrc2 = NULL;
9 s9 K- a. v6 e: W9 H6 \+ T9 { - char *dmabufdest1 = NULL;
; J# Q7 b9 s2 P6 U9 F; N - char *dmabufdest2 = NULL;7 K( s% S+ T' \: I
- # j B' N7 e* m+ V q: G5 x
- static int acnt = 512;; N- `5 O( f3 d( J- {
- static int bcnt = 8;* j+ m I8 [& W4 G8 q
- static int ccnt = 8;* ~7 J3 ?5 D3 E$ t, t( ?
3 e4 R2 ]5 }3 A# o# |- module_param(acnt, int, S_IRUGO);
7 ^' a" G3 g* x5 O6 U4 X2 ^8 | - module_param(bcnt, int, S_IRUGO);
, P6 x* h; d @1 U - module_param(ccnt, int, S_IRUGO);
复制代码 ; K# I# ~+ }% r# F* l
7 U4 G, H+ r, f. @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 l; I2 A5 Y- R& A0 u
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 T: F! ^3 ~9 r$ Q! X8 z* `1 d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% c" i2 k! ]# ?
3 n8 }1 ~' D8 z5 D# y
% x3 \6 `( D% L0 L) P9 M |
|