|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' u' F( h* C8 h$ J( |& |; x- [code]EDMA sample test application# q3 J( F, h# |& j) G/ H
- /*9 V+ L. I& z3 j |/ e6 v# D
- * edma_test.c6 n1 R0 E' h; C+ G
- *
( B; H2 O, S8 W& L! F - * brief EDMA3 Test Application5 u- R6 a% V1 h2 n
- *9 u$ @: z* s# f$ S7 O
- * This file contains EDMA3 Test code.
. |$ D9 B; l* X; n$ m - *% P! D$ R: x5 g, P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 W G4 \8 {! x( P f* `4 y) g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: j5 c4 C; h5 {6 o1 c( {4 M, V; w
- * TO CHANGE.
3 h$ C3 t/ R: u0 h+ h& }% K' ^, R: T - *$ P+ ]0 p, X/ s* O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; k3 k" _# q) p: ~4 C
- *' z# I0 _0 p5 I8 `" y2 b( U
- * This program is free software; you can redistribute it and/or
" y! z) z6 Z K/ {( z) i - * modify it under the terms of the GNU General Public License as
' |$ `! b7 _# c4 @7 y* J5 y5 l5 } - * published by the Free Software Foundation version 2.' X3 }" k0 {# }! X/ y5 v
- *; b, B: k" ~7 a" \; i2 D5 J; o) I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, V) `/ d" }- Y- ?7 p5 ?
- * kind, whether express or implied; without even the implied warranty
+ @( W7 Y2 E5 f" g6 \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- M) [2 L) T9 ?% ? - * GNU General Public License for more details.5 f! a2 Q+ ?6 o6 g2 s
- */
$ N- @* [8 N* O( | s u - 5 z" m; T3 B5 e9 ?. q3 B: S$ D p
- #include <linux/module.h>
$ f+ g# ^9 c) O7 d$ K0 @ - #include <linux/init.h>. h$ h/ C3 h+ Q( l/ ~( ~- a! [3 m
- #include <linux/errno.h>
* n; x" s3 ?9 V" c - #include <linux/types.h>0 p/ S, Q4 F- B; o
- #include <linux/interrupt.h>
2 Q" H* E: l8 A1 z6 O" R - #include <asm/io.h>8 l9 | i! T; m- U
- #include <linux/moduleparam.h> i# y9 X- }3 P/ z$ N
- #include <linux/sysctl.h>
, x7 s& @8 Q! z3 Q! u - #include <linux/mm.h>
& I/ X) N5 \" F - #include <linux/dma-mapping.h>
$ d8 o0 ~+ J5 W* k - 6 S9 \9 u' G% \: X3 K
- #include <mach/memory.h> Y9 G4 [1 C* Y# q$ X# e
- #include <mach/hardware.h>
% U. C, D' \+ F, _4 Y1 l6 `' Z - #include <mach/irqs.h>' G b! i* g5 o( K, f' m) W
- #include <asm/hardware/edma.h>
H! `2 L* f9 j8 Y( t; P; C% A
7 q; e4 @9 Y+ n- #undef EDMA3_DEBUG: S" N0 a6 ` d$ |. F; D
- /*#define EDMA3_DEBUG*/2 r6 I1 o% L3 P5 ~
- 0 f V. C) l% }* e
- #ifdef EDMA3_DEBUG
! x9 `: ^; q9 v! F. g" p/ n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ P5 h" U, @1 c; y) F0 }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 X+ |: W/ S4 K- M5 I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
|$ o: Y& b3 D+ C! J& q' x" h - #else
5 b% g1 M! L- |, p% Y - #define DMA_PRINTK( x... )
3 A/ }* u. R( q `+ Q$ X, N3 ~5 V - #define DMA_FN_IN
2 z% A% W3 }- ~$ |2 y6 s' T - #define DMA_FN_OUT+ I4 N4 _) Y, ]% x
- #endif) }4 [$ P5 K1 m5 Q3 g
- , p7 b) x9 i+ ]( c0 ~3 R! s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 Q! U3 I k$ y9 r- c; {3 H/ _
- #define STATIC_SHIFT 3! c! c1 d: S" Y4 u
- #define TCINTEN_SHIFT 20
{: @: d' L9 y6 i2 i( u# o5 X+ u. b - #define ITCINTEN_SHIFT 21
8 \' k* D0 L, d - #define TCCHEN_SHIFT 220 h/ q# o1 U8 ?9 R
- #define ITCCHEN_SHIFT 23
. }8 T1 U; K5 @
5 q, t; O0 f- I( i1 O" M6 O+ S- static volatile int irqraised1 = 0;- U/ P# L+ |/ f; z% }7 ^; q
- static volatile int irqraised2 = 0;
9 U' y6 [; w) ]0 F( Y - 6 ~* d( o4 S H( A% Q0 C0 C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 L p {3 z" `, ~9 H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 w! R9 V) V: i5 y- I; o4 G6 K, ~9 W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" @- A$ U9 r9 Q2 D
6 M% j" ~& S+ a8 N& f- dma_addr_t dmaphyssrc1 = 0;
9 a8 V8 d% u) d5 a - dma_addr_t dmaphyssrc2 = 0;
# \* ]0 P. V* {6 e* m& o: v - dma_addr_t dmaphysdest1 = 0;
" y; Q: E2 n ] - dma_addr_t dmaphysdest2 = 0;3 ^5 P5 W' n' Z/ m% V3 _) Z# U+ j5 L
- & F6 j, ^* ]( h3 y% c
- char *dmabufsrc1 = NULL;
- ~* h$ H E$ ~- S - char *dmabufsrc2 = NULL;1 U+ u2 C% [* ^) u
- char *dmabufdest1 = NULL;; W% {9 [8 @4 x$ O4 s- M5 h! X: \
- char *dmabufdest2 = NULL;5 G) M7 h3 [, L. `
- ' c& P: t5 T/ _6 |' }
- static int acnt = 512;; n( z- m9 l4 z% C* `: a& n( c
- static int bcnt = 8;7 x9 U/ g! H2 m/ P# i' G* D0 ?
- static int ccnt = 8;
0 A2 _3 |( v" E+ J
/ Y# N0 o# A I( d$ [- module_param(acnt, int, S_IRUGO);8 n5 x: d) G: ?! `, K- a& |
- module_param(bcnt, int, S_IRUGO);
+ [1 H% j. h# q. I' s W - module_param(ccnt, int, S_IRUGO);
复制代码
( H' t+ t( }* f. ?3 o" m2 f W0 m- t& L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ V' D5 u2 U- i1 N% E" ]. a3 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. V5 }6 e' {* O; Q S8 Y/ a) c# f, ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 v+ C, Z) _1 u0 s/ V2 g* i
1 v$ Y4 b* @2 C0 i: T+ R; h& X6 L8 K8 R( b
|
|