|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , B* x$ s( ^7 L6 z
- [code]EDMA sample test application
5 z7 _3 q4 V" [" S - /*3 r3 U' f- L ~9 I+ \7 `5 ?1 r
- * edma_test.c
" @; i/ c; @" W7 |* K, I4 J - *# A- i% N6 y8 {; j% _8 \8 G
- * brief EDMA3 Test Application
. U: E" F/ T) `7 K0 v - */ p/ B+ ?2 o9 X- Y
- * This file contains EDMA3 Test code.* O3 j) B1 P- S) H6 J( O
- *
: b& O# j! [) \' P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# Z' n$ P$ i" q8 W- s! B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- O' H& V7 v8 n - * TO CHANGE.0 w# A/ }! f3 d/ p
- *
$ g; O5 ~# ~$ [# N9 G: Q' J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 n( x# P8 Q& }9 ]1 S" b& U/ R. A - *1 m. ~. R; q/ S& X
- * This program is free software; you can redistribute it and/or% O" \/ P2 c5 u1 T0 F) y
- * modify it under the terms of the GNU General Public License as
! l9 @* e+ J& y F - * published by the Free Software Foundation version 2.8 D% }. {. w8 L2 N f4 j
- *
- c3 x" G; ~) U' t3 u# H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ `9 N5 |% _% b7 E4 s. ^9 D2 u - * kind, whether express or implied; without even the implied warranty) B9 G" F1 e! d+ n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ o$ I9 j1 l* R) L - * GNU General Public License for more details.1 C& @( ~, Y$ D2 t: y( `5 C
- */
+ T& H! u3 ~3 R0 `+ y - ) t- d# W. k) A4 Z0 ^" k
- #include <linux/module.h>
7 ~' O3 r% r+ m9 C - #include <linux/init.h>
, x6 [, g/ L- o' P* M - #include <linux/errno.h>
* o& Z1 p/ V5 ~* e8 g+ p/ H - #include <linux/types.h>3 j% E2 Q0 o' m9 G! S, a3 z v0 f
- #include <linux/interrupt.h># ~& x. t* U1 b! [' V+ e" M
- #include <asm/io.h>
. u) Y5 k: L5 l) z( ]0 S# ? - #include <linux/moduleparam.h>" G( |( Y* a6 D9 l+ H+ L
- #include <linux/sysctl.h>
6 q& A; L; w1 R& L6 ]" M- P& \: r, } - #include <linux/mm.h>
& t0 |, @6 H8 W, K! Z1 }1 R - #include <linux/dma-mapping.h>$ P& o9 g5 h8 ^# S
- 7 y0 [" S+ i1 g2 H- I) F
- #include <mach/memory.h>
0 T5 B |) o+ I9 F7 ?$ ? - #include <mach/hardware.h>
0 O `5 k5 x J5 K - #include <mach/irqs.h>* s. Z3 G: s. q! p4 D
- #include <asm/hardware/edma.h>
" A# v4 \0 }: a8 P9 T' o' G
+ f% M- H K6 m2 I. i9 C {- #undef EDMA3_DEBUG6 q" r) J, O+ j) F( o
- /*#define EDMA3_DEBUG*/
9 D# I& r, {+ R, C% T/ Z
- D% z" I0 \! [3 d: \/ e/ M- #ifdef EDMA3_DEBUG& D# k" j! T7 C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 D4 I7 h. o( H0 C9 ?$ m- m/ u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 y5 G2 }% G& Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) z4 E! z+ Y; \2 N2 r
- #else+ u$ a8 ^( ~! t% Y
- #define DMA_PRINTK( x... )- `& ?& c+ n& G7 @
- #define DMA_FN_IN1 V: Y6 P/ i; D! [) t8 ]
- #define DMA_FN_OUT5 O. [* O) i$ P2 \" U' Y: M/ ^
- #endif5 ^! k. _+ v1 j6 r8 c5 Z
- 1 z2 l) P& D1 z) Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; ?. \. [9 p8 S5 C+ }1 ]1 Y - #define STATIC_SHIFT 30 D: A n4 E" a2 Z# ~; D$ Z
- #define TCINTEN_SHIFT 20- A1 x. K8 q7 K% A7 b" S
- #define ITCINTEN_SHIFT 21
1 G# H% t F" ` - #define TCCHEN_SHIFT 22
, V9 C4 v y. u% f - #define ITCCHEN_SHIFT 23- F, u# i7 r7 X# w! t; q
4 V2 F! @0 D) K, n9 w- static volatile int irqraised1 = 0;
# k- Q* F, R; N, I' ^4 `3 Y: f# w - static volatile int irqraised2 = 0;
% Z# p/ H8 f j: N# B - + ~& F1 t- Y7 w) g0 F f9 z' x0 A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ^* A" {7 |6 Y3 k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 P* A$ V9 O1 Y$ a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); ^3 V) d- P M7 b7 d$ T) i" I! R
- 4 I& h3 M M* a( L$ d
- dma_addr_t dmaphyssrc1 = 0;
+ I6 F5 p: t y- K5 A5 x: I: i2 b - dma_addr_t dmaphyssrc2 = 0;3 ` O' v# D3 U$ ~' g: @( g
- dma_addr_t dmaphysdest1 = 0;
6 T) o, K5 T/ y+ w+ f - dma_addr_t dmaphysdest2 = 0;
) u7 ~$ _$ h! f9 d# l& Z/ }; x - " Q3 [! r+ @: ~( t" f2 G8 F
- char *dmabufsrc1 = NULL;! E: o7 B l7 @$ p
- char *dmabufsrc2 = NULL;+ Y) F3 U1 m( m% ?8 T
- char *dmabufdest1 = NULL;( U" r1 `9 e9 o/ l" @
- char *dmabufdest2 = NULL;6 I' j0 O. C' M D3 D7 D0 r
+ n2 e$ R0 R# o0 ~: g- static int acnt = 512;
' {* s1 s) _: a ^" w& r$ M* ~ - static int bcnt = 8;. Q% z/ _& b8 B0 m. l
- static int ccnt = 8;
1 w- c1 m3 _4 \9 @% u' x+ w* Y
2 p, G/ C t9 ^( t8 ^. U& ]1 \+ L: b0 {- ^- module_param(acnt, int, S_IRUGO);
. a3 C G) q p6 U: J# R - module_param(bcnt, int, S_IRUGO);
9 r8 e: ?0 \7 a/ h% P2 L - module_param(ccnt, int, S_IRUGO);
复制代码
" b8 A* N) j* Q2 ~& T" J* `7 n: \: W- ?+ B0 Y- N0 I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 U# t7 p& n+ z. X5 t* ^8 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- R! U* \1 y5 A+ W2 z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 Q+ ^, b% d8 W7 G9 o
* ^5 H9 U' [+ [: v
# Q: x2 c7 Y, H" m |
|