|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: T$ x/ j/ |) t* n: M- [code]EDMA sample test application8 ^ m0 z: ?" p5 h' j" H
- /*! V/ z0 s* t6 d7 q
- * edma_test.c
; Y( i5 \: q4 q" l9 c4 c - *! P6 B3 m7 x, s* E! E1 a( S" K
- * brief EDMA3 Test Application
5 U8 f% d& _- Q# b( b - *2 S7 k0 k5 B* D6 z0 B3 R
- * This file contains EDMA3 Test code.4 h8 j% f9 a) g4 Y p
- *' S3 ~$ _" \& Z6 }% U3 h3 J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: A, a( C$ P' I# H! x: B( i$ k% u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, o2 ]; b- l' ^5 `) Y6 i - * TO CHANGE.: u, |3 P/ C% M! U4 l
- ** d% P, L, y0 N* d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) L% W( _! L Y$ ?* r$ \) ?
- *. m' ] V: ]2 w( _7 v$ x* _
- * This program is free software; you can redistribute it and/or2 r& E2 J5 J+ q* L
- * modify it under the terms of the GNU General Public License as
6 S8 L7 @. E, u6 o8 K* U( l - * published by the Free Software Foundation version 2.
3 n3 j$ y' N- O* R2 j - *
4 E9 @: g3 y% ?1 s3 p& w2 J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" o: p; |2 }$ d8 K2 p L1 M: i! U - * kind, whether express or implied; without even the implied warranty J% y! a( N5 P5 m8 w/ }8 E8 [; x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 C3 ]6 `) I; `0 _3 k) u - * GNU General Public License for more details.
) j" {$ b* O" |# ` - */
7 }* B4 a6 Y; g) S" Q1 O; `6 k - 8 s# ] D" f" X" q3 n
- #include <linux/module.h>
8 s! u9 i. @& E7 V ] - #include <linux/init.h>
6 ~- ? r3 d6 z* @ - #include <linux/errno.h>/ Y/ V# K& v2 |9 e% R. I. i- o
- #include <linux/types.h>4 k; Y3 E$ B1 H! [3 Q
- #include <linux/interrupt.h>
, @ b' h+ @! ^$ c- d4 D - #include <asm/io.h>( {" k2 r* y0 r$ s1 q
- #include <linux/moduleparam.h>* Q' c6 P0 ], [8 P" n% O6 @1 |( F- K
- #include <linux/sysctl.h>/ c6 q( I7 F) Y; R1 t& L; b
- #include <linux/mm.h>7 y( [( E7 r% n& H
- #include <linux/dma-mapping.h>( _8 x: l0 c7 [. ^
- " i; _$ O. s+ d! p$ q3 ]: i4 v
- #include <mach/memory.h>8 N1 L0 g- y$ a; v
- #include <mach/hardware.h>. b0 m6 C0 d- E1 ]
- #include <mach/irqs.h>
0 `4 N: p$ H; M3 O$ x8 J - #include <asm/hardware/edma.h>$ ~2 Z: i n& k( R6 E$ V* T
7 I) A9 V3 v4 z- #undef EDMA3_DEBUG
8 t" E9 q4 p% ~0 Y% B) y - /*#define EDMA3_DEBUG*/
9 I8 A, I4 `4 |# B R% }9 Y1 o - ( R3 e1 |6 o' N
- #ifdef EDMA3_DEBUG5 Z9 g( S1 D9 E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): D* p0 n8 ^! r v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* F/ C! S8 M1 [$ c+ C5 K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: u7 |" ^+ X8 e, D( V - #else. t/ X3 b/ b. H* B* H
- #define DMA_PRINTK( x... )
. r3 Z+ G4 ?% `# U1 q - #define DMA_FN_IN
: z6 W) F" P2 M7 K - #define DMA_FN_OUT" Z! s! M$ X. d6 ~) P
- #endif
0 ~) p+ `3 t* K$ T8 }# R, A( W" T0 ?
& ~) N! R' o0 v0 {% S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- ^, g/ m, o, g8 U. t) ?
- #define STATIC_SHIFT 3
6 r$ l/ [: b+ | - #define TCINTEN_SHIFT 20
# X# c5 G; ?0 E1 h& Y - #define ITCINTEN_SHIFT 21
0 @+ ~9 G% Y8 a6 [, Y& d - #define TCCHEN_SHIFT 22$ ? {1 h& f$ l! ^3 ?* B
- #define ITCCHEN_SHIFT 23& w: Z3 i, x9 _: q: ]
- " O T d7 Q: @( G) D9 k9 Y' F
- static volatile int irqraised1 = 0;
9 c" P" c u8 a0 q - static volatile int irqraised2 = 0;* }% A3 h( {0 B; ^
7 s" k% X' o6 j/ ]- ?: l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, q, n: H0 @: z! y0 |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( ^- Y0 D* H- T0 I; c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ j! `2 ~8 ]) a9 N$ `
0 a7 ]' O- i& {+ {% X9 u; ~! R+ r- dma_addr_t dmaphyssrc1 = 0;
2 _1 K. b! }6 L4 S - dma_addr_t dmaphyssrc2 = 0;
& |* Z' O& k" z. v# u# } - dma_addr_t dmaphysdest1 = 0;
% M0 _3 b5 C& f2 c3 K! f - dma_addr_t dmaphysdest2 = 0;, s: Z" k, r* I% V3 G7 ], y
& x6 p8 G' m7 C. e( E8 y- char *dmabufsrc1 = NULL;
8 J+ ?, S3 N3 Q3 V% m8 J6 A - char *dmabufsrc2 = NULL;
t+ m( O/ H) H2 |2 T& e - char *dmabufdest1 = NULL;5 A# [8 s Z0 ]
- char *dmabufdest2 = NULL;/ c% w+ k/ X2 Y. w
) E! w- p+ _7 u7 J# K0 q9 N- static int acnt = 512;
* Y1 Y0 U* f5 o( G# d - static int bcnt = 8;8 q8 }- v) p j' s' w( E0 v9 g
- static int ccnt = 8;
2 w& w- ^7 x7 V4 D: ^
( c9 l4 U3 F" r1 L% Y7 V5 I8 v- module_param(acnt, int, S_IRUGO);9 r9 ]3 ?1 _) e7 S: L- j5 a
- module_param(bcnt, int, S_IRUGO);& e- x. F" S' O- d
- module_param(ccnt, int, S_IRUGO);
复制代码
! S) u" P, @2 P9 ]) N! w {0 i/ g, R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, i( o$ t% V( Y$ Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ g1 H2 ~3 J7 h0 ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( n# S! Z' R" ~. _9 E* k, f$ p3 J( e
9 g, l b3 V' u/ L6 d
& v1 w: |7 k' V$ L0 I
|
|