|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 J6 N! _; u$ s5 s) T8 r" r- [code]EDMA sample test application
0 Z7 z2 h! |1 X0 P - /*/ G9 R, h) g# d Z* ?8 w B; ?) d
- * edma_test.c
0 S# T7 [+ E8 D9 } |7 q - *( z% `6 V2 f8 U
- * brief EDMA3 Test Application
$ E% L% { d5 r- A x - *
4 E2 {6 a- _) L6 v" p3 }# S - * This file contains EDMA3 Test code.
! c6 N L- l+ O2 F& m( @6 e - *8 ^2 p9 K; e( c' L) t' N$ j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ E; L! k5 W* ^4 v8 d1 ~& Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# U* J9 d, g" [% U1 O8 T1 @ - * TO CHANGE.
h" v9 d& v2 ?1 |! Y- Y& V6 n - *
9 }- ?# {9 g* f6 O! D, f2 H; C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& d4 U' E, I$ q4 H% R' n
- *+ V! H( A# L) F9 L0 s5 p' F) }
- * This program is free software; you can redistribute it and/or
3 ^6 u0 z. M( N" k+ p. o3 O - * modify it under the terms of the GNU General Public License as
$ y5 D, _, O( ]8 g8 P& x: } - * published by the Free Software Foundation version 2.
0 f) L; m# _4 z G - *
! s1 @/ i$ S# P0 ^' A" y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! @' S. P# q* i# Q
- * kind, whether express or implied; without even the implied warranty
& T" a; p4 }1 L7 e; F& V+ w! Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 d- a9 |2 e6 `8 H. [ U - * GNU General Public License for more details. H0 Y7 O% Z6 i! v. S4 c
- */6 u1 P; w" t7 M( N# e% N i! _
, i9 u. t `) j, O8 h X% g" w- #include <linux/module.h>" t+ z: g7 i! M& e
- #include <linux/init.h>
4 t% f }: \3 ]; o, K" x4 I7 v - #include <linux/errno.h>9 x \; E( Y0 P1 {" U
- #include <linux/types.h>9 f: t5 [% r/ w: W
- #include <linux/interrupt.h>
5 c1 M, `3 V9 G - #include <asm/io.h>& D2 C9 x$ ~; i* h, t( F* h( L
- #include <linux/moduleparam.h>1 j' r! `. [9 Y4 k+ u
- #include <linux/sysctl.h>
' @9 Q2 V6 O* A+ {# J- V - #include <linux/mm.h>
+ y- _% o* I+ W6 _/ ]6 n2 Q- E0 x - #include <linux/dma-mapping.h>% j; |0 g9 r0 q
% T! j K0 d/ L% ]5 g, x- #include <mach/memory.h>3 ^& X4 |$ o G7 [6 N& d7 r
- #include <mach/hardware.h>
6 v f$ C( H0 ?$ T' J - #include <mach/irqs.h>
r6 l! x! `0 a. H - #include <asm/hardware/edma.h>
\2 {" }9 j/ P* |$ \* ^
: Z; |3 @9 V+ Y) ~9 B- #undef EDMA3_DEBUG
3 C5 U! ?' p# l# u; ]3 w ^1 { - /*#define EDMA3_DEBUG*/8 i' B( X7 [: c5 S" q$ O
- ( z) r1 ]/ j; K/ o
- #ifdef EDMA3_DEBUG
$ L1 m: f9 D6 C& m! [ { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ O1 R0 f- D! q4 E# ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- s# }2 ~/ ~6 l0 `4 Z1 ?8 K( q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 z- Z1 O8 G4 J d l" U# u0 f - #else
; e7 _; z; {! [5 ^- K3 } - #define DMA_PRINTK( x... )
9 a- G* U1 f+ w N: w - #define DMA_FN_IN
2 N- I A; K* F4 r4 z - #define DMA_FN_OUT
- L" D, w+ n6 }1 n8 q# B8 b - #endif
: f5 s+ \) c+ E% W
) @+ f( ` B1 |/ ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 o$ ^+ d6 F$ X8 \6 @" ~ - #define STATIC_SHIFT 39 g$ U, Z7 v2 g9 V
- #define TCINTEN_SHIFT 206 l+ S6 i" G H: m' m
- #define ITCINTEN_SHIFT 21
. y/ O# k S* Z6 r6 Z1 ], a z - #define TCCHEN_SHIFT 22
1 J; j6 l" M" q& Q( O: w1 k - #define ITCCHEN_SHIFT 239 _0 D. C3 @2 E7 F3 b
- ( [: A0 v9 m" R- \; T# q( l! r, Q
- static volatile int irqraised1 = 0;2 F- O8 x4 R, F' v
- static volatile int irqraised2 = 0;/ \- g) q8 ~& X0 D( W: B7 K+ t: K
* u* w8 B& w! X' K& ^; W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! E2 ~! O& T- }1 u& \- k# a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% b& Z3 v" h( i1 j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& s8 v$ e) V: B- x1 b; w
: i, G+ m" X1 U- dma_addr_t dmaphyssrc1 = 0;
1 a; d; t$ C0 r, T, [' \ - dma_addr_t dmaphyssrc2 = 0;6 F, F1 c+ X1 r; y
- dma_addr_t dmaphysdest1 = 0;% Q9 W( C3 r2 m
- dma_addr_t dmaphysdest2 = 0;
; s& T8 ?9 b) k$ \ - / s6 i% }2 n3 C0 a6 H, t3 Z
- char *dmabufsrc1 = NULL;: L3 P( \6 K3 |: q7 }0 \
- char *dmabufsrc2 = NULL;/ o1 ?# U' Q8 o' n
- char *dmabufdest1 = NULL;% V1 y u4 E, n7 @. ?! ?
- char *dmabufdest2 = NULL;
$ {4 b7 l4 |' v3 F. \9 q) }, \1 s4 T
6 e7 K- Z2 `" ~; i4 j- static int acnt = 512;
$ Y) k, D9 l* y6 U6 k3 l S. ?) S - static int bcnt = 8;
: H, T. D: A1 F - static int ccnt = 8; q ]% b+ V& B: `. B6 u* X: b/ A c
- 4 e5 x' S% D$ A# H. m9 Q! f
- module_param(acnt, int, S_IRUGO);& S6 A) g: S0 @( X
- module_param(bcnt, int, S_IRUGO);
9 k C0 {; i4 ^$ Z% d% I - module_param(ccnt, int, S_IRUGO);
复制代码 ( t { S! Z6 U! d! N. I
/ t) y- n2 c4 k! v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 [& w9 H: q5 oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- w9 K) x* x4 T" S W4 E7 Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ A7 N* b0 E: H, @8 w1 x( G3 C8 D# K
9 v( l K/ L: z7 @, K1 D: p' t" J! w* ]( Z) d9 h3 @ _
|
|