|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- D$ Z: w7 P4 w0 F- [code]EDMA sample test application
; D, S u, f8 q# Q2 r - /*
7 f5 ?; q; w: d+ X6 F, g - * edma_test.c# ]) F* ]- @5 s% _( a* d
- *4 k, i" m( X- B$ Q( N
- * brief EDMA3 Test Application
9 Y3 R5 b2 x! C" R9 W& K" |! o5 l - *
3 f7 j& {' ^2 Y- P - * This file contains EDMA3 Test code.* r' [& Y$ R: U# ^. U1 ]
- *
8 n9 W4 D- ]; Q5 B! f- O& P/ s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 t9 o( W+ K: e" e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 Y/ F; J3 ^# {0 Q# |4 j7 k& F - * TO CHANGE.
5 y7 z0 t& U9 I' j6 j0 Z# A6 B% X - */ g6 q1 h! z& C# N* b I. o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! H+ m7 G1 C& n; o
- *$ G a! y8 E- D! ^/ L( K+ \
- * This program is free software; you can redistribute it and/or0 F; h2 z/ d' R) H
- * modify it under the terms of the GNU General Public License as
/ W5 K9 R* m! z+ |4 S3 l - * published by the Free Software Foundation version 2.& T1 Z3 ~# {4 e. g6 r" c- I
- *
* t {) P4 v6 ? - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 i8 ^: }0 s9 b+ j n# p& H" i! e% R8 h - * kind, whether express or implied; without even the implied warranty0 q/ C" g# y% l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 f+ |+ P' G3 U# t
- * GNU General Public License for more details.) t3 |9 q$ Y6 v
- */
( d& j" w7 O) A N" S: C+ e2 n
( R, o8 q# @ `3 a, J% K- l- #include <linux/module.h>9 a$ Q0 F% S w1 T# Y
- #include <linux/init.h>( M# D! f' x( ]; R
- #include <linux/errno.h>
% a8 h c' x& E! J - #include <linux/types.h>/ e$ H& j! Y; U
- #include <linux/interrupt.h>
# S! s# ~" y9 [- X) ` - #include <asm/io.h>
- Q2 ~+ B" ?& h1 B) s - #include <linux/moduleparam.h>
# D9 `+ N- p3 i5 h; e: V/ D. s - #include <linux/sysctl.h>
( z! [# H4 t( L! i3 s& \, | - #include <linux/mm.h>( p- o( ?4 z6 g' p6 L& l
- #include <linux/dma-mapping.h>
4 r0 z" c, @8 n1 M, ^, n' E
1 k1 A# h( N' y% P. k8 S$ w& j- #include <mach/memory.h>% G$ p) ~& N6 s) @5 x
- #include <mach/hardware.h># n& u! Q$ ?% Z( N+ r% U" O# |
- #include <mach/irqs.h>
) K0 B$ E% R' [) d1 } - #include <asm/hardware/edma.h>
2 @% U: |* O+ G! m/ _4 z5 q - " j+ m! y/ }$ y6 H) N' E& M! u
- #undef EDMA3_DEBUG
; m& D% Q8 q( ?3 ]6 C+ D$ Z - /*#define EDMA3_DEBUG*/
, G7 P9 J! g9 P$ a0 w, z- W
# |+ j# a& _8 r; \( r) g- #ifdef EDMA3_DEBUG* i# ^' M% V* S: L6 Z. E+ \5 o* @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" x; x! s z9 X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ B" C4 i; R, v8 V% w5 B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" P/ ~1 N6 t. y$ L6 r( S - #else
X7 h# x0 n9 B1 W1 j' T* S; \9 ~( ]9 y - #define DMA_PRINTK( x... )
1 b' b1 V" L% D% `1 g - #define DMA_FN_IN: o. A& a8 R$ q( O
- #define DMA_FN_OUT
8 |. g; c; }0 [! q# o5 i - #endif# J0 s* W# Y; I J( o8 s
- " H* ?% W6 I' `1 d( K+ p, h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" i M7 |. K% e$ ` - #define STATIC_SHIFT 33 U- {$ W) H% \
- #define TCINTEN_SHIFT 20! G0 w5 ~) A0 \, o/ e# I5 @' @; R6 S0 M
- #define ITCINTEN_SHIFT 21
% y/ D x0 Q! Y, _8 v3 Z - #define TCCHEN_SHIFT 221 T; N6 e4 n' w9 N5 {- `! e% s
- #define ITCCHEN_SHIFT 23
3 U7 A% l' g" R9 W - " v2 o& B {, l; C- I
- static volatile int irqraised1 = 0;
$ g; k" }4 X. N0 C; G0 Y - static volatile int irqraised2 = 0;
2 k" X6 G: W3 ]! m - 6 X( @4 @, W2 l( i! w$ N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 C6 A$ b }6 T! A$ W- `7 Q+ [! T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* Q+ j: d+ u' {2 o" q3 l$ e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; s" b+ Y( t# n8 f* c
7 x+ \, w' W3 H$ u( \. X/ g& G/ N- dma_addr_t dmaphyssrc1 = 0;2 w, G( n# V* r! Y$ W
- dma_addr_t dmaphyssrc2 = 0;
% m8 S+ N! [+ P! J; {5 w# f4 }$ e9 A - dma_addr_t dmaphysdest1 = 0;
, v v7 W0 n8 r - dma_addr_t dmaphysdest2 = 0;
, [( k3 m( n" A U( I, O8 H - % g+ q! r3 S# U$ l1 L
- char *dmabufsrc1 = NULL;
' k6 u0 x1 @$ a! H - char *dmabufsrc2 = NULL;
0 U. n0 P z$ h, K! o; r - char *dmabufdest1 = NULL;8 k j* G. U/ y4 u C) v
- char *dmabufdest2 = NULL;
1 t) R3 E) ]# P- [; m - 6 u/ J" G& O$ E3 e
- static int acnt = 512;
; ^) U _' n1 n* o: @ - static int bcnt = 8;2 u" W# g' k8 k# i1 O4 ?
- static int ccnt = 8;
5 {, ]6 I/ N9 _ - % | \2 O- o. S3 z
- module_param(acnt, int, S_IRUGO);
" X. x5 m$ I0 n- Q - module_param(bcnt, int, S_IRUGO);
, p9 g0 ?5 {/ ?" D1 P1 n - module_param(ccnt, int, S_IRUGO);
复制代码 " Z6 t7 Z) O' |8 z
6 f0 h, c" X9 t0 O: C6 @/ G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 p) R7 b2 C! v& P, f9 ^% e5 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 s+ Y5 e1 V* p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. k8 J7 L0 B- [2 e) E* Y7 O( j
( O' N1 P( E1 d
. R' e- e9 P0 [ i3 [0 x0 N |
|