|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ t3 @0 Y$ p; |4 h
- [code]EDMA sample test application; H% ~: a$ u* K3 H7 Q
- /*
. B9 Q9 R d- c - * edma_test.c4 H( _: g; n7 F: @) A& ]( P
- *# s3 E1 Z( x6 W: o
- * brief EDMA3 Test Application4 ^# m" b# |. y7 t1 d% Y
- *
, o4 A3 O/ e' A- ^ - * This file contains EDMA3 Test code. K( \8 P. J$ P8 g% t
- *( t3 [2 _! o6 O% R, B3 E! O* \& M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! I7 v! J o, y# {! ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 x* \( R- U& E( N. H - * TO CHANGE.
* a5 ` `) P, S9 j5 u& W6 W - *
- s+ g' W3 e! b% P6 q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 Y+ r' ^( n) e2 A8 J
- *3 |# t' d& e5 r9 q% C/ N
- * This program is free software; you can redistribute it and/or
, N) Z% x* @$ Y( c& @# h; a - * modify it under the terms of the GNU General Public License as
6 v4 u8 ^, D; Z& V- p. U - * published by the Free Software Foundation version 2.
. b+ c' \, x+ j - *
) U* z6 l& e9 d% _3 u0 @. K, s" T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" w6 ]# L, t: r0 M0 Q - * kind, whether express or implied; without even the implied warranty! A, t! |* K. [/ O2 m5 g0 r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 y6 J( m! }5 R# S$ R9 _
- * GNU General Public License for more details.
/ g' C, X/ }4 B. o+ j; w - */
" y7 g- w1 b" _% v1 L
" K' s% y2 m* A" w# ?& a- #include <linux/module.h>& j4 X$ ~% t& S1 G
- #include <linux/init.h>
3 E( ~4 ^* g" {: [: e) @( n5 c3 { - #include <linux/errno.h>9 v4 [9 K: |" {/ Z4 {, l. l x
- #include <linux/types.h>2 a! |, @6 l2 e/ q" o4 i$ m
- #include <linux/interrupt.h>
0 T6 T% G$ a( T* ] - #include <asm/io.h>2 `; @, S1 o& a
- #include <linux/moduleparam.h>
1 e* m& p% a; | V+ i. Q! Y - #include <linux/sysctl.h>
7 @" Q7 p6 R5 b) |# A& ` - #include <linux/mm.h>
X1 u" @7 _7 z8 s) q - #include <linux/dma-mapping.h>
, S, C, c% ?' C. j2 k
: f- j2 A, s( z) w1 r7 g- #include <mach/memory.h>
: ^+ A$ c* G7 t3 c" d/ f - #include <mach/hardware.h>. {3 ~& E7 m/ @' d
- #include <mach/irqs.h>* S' w9 ?/ _% x/ D) m
- #include <asm/hardware/edma.h>
1 K& x1 w! \! M9 Y* m6 v$ e
. X, }$ A9 q+ h, |- #undef EDMA3_DEBUG
6 |+ v9 m; F& m3 p5 z$ }7 D - /*#define EDMA3_DEBUG*/; w, q/ Z1 r9 H% \" V! t3 i
- G0 `8 P3 T" W9 }4 v9 \, c- #ifdef EDMA3_DEBUG
( e; u! T& d8 h7 ~5 q) y: f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% v& g4 b! @! b/ d2 f( `7 N0 X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ c4 h; A, X% R& b) p+ p& p3 n ?% s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! _7 \! y2 S& h7 |7 s# m2 {
- #else
5 Y# a! i: P6 N9 f - #define DMA_PRINTK( x... )* F. v4 X5 W0 \) ^6 ?2 q' P
- #define DMA_FN_IN6 v, F0 g9 `8 a9 \. Z4 O6 Z
- #define DMA_FN_OUT" ~% T. `( k, x' k+ p/ d5 C+ C, @
- #endif
, U V0 [" O* Z: B! o, O6 q - # b# ^2 X$ Y( i9 O/ b' o$ A+ }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); U6 B$ |; v: O7 l. g
- #define STATIC_SHIFT 3
6 t+ d" Z9 j$ a1 L - #define TCINTEN_SHIFT 20' o3 D. h/ Z7 |% x/ |8 P! w- a
- #define ITCINTEN_SHIFT 21
# B2 T3 e/ a: G* q, g% H - #define TCCHEN_SHIFT 222 x2 W3 x+ k8 {) I% P
- #define ITCCHEN_SHIFT 23
% K7 W: J: c, ~3 s7 N# D
- J9 y% Q1 M! @0 H7 w- static volatile int irqraised1 = 0;
' ^! t' _0 C/ v. s9 u! r& X - static volatile int irqraised2 = 0;
( r, ^+ i- {$ t( P- {$ L - $ S. _! ^% y2 t* Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); R- o* S% c% R: ?! n: J) F# S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 x5 B/ s2 ?1 a( u. R, V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ [$ U4 g: P4 f
- ! x, a* J2 {4 z5 H: u4 H& y
- dma_addr_t dmaphyssrc1 = 0;
5 `# b2 ^" x' r- S5 R1 E - dma_addr_t dmaphyssrc2 = 0;1 |8 x3 f6 J( A: w n: _4 r! N
- dma_addr_t dmaphysdest1 = 0;% s1 |: M: W# Q
- dma_addr_t dmaphysdest2 = 0;
9 |# c7 m" q9 I1 u D! M: n# h - ' O' o- @9 e3 C+ j
- char *dmabufsrc1 = NULL;1 Z* G% U: T0 b# o4 F
- char *dmabufsrc2 = NULL;" t4 u4 s3 H( G: x4 j: U
- char *dmabufdest1 = NULL;
1 F% i; I0 k) ?8 l; p; l9 I/ [ - char *dmabufdest2 = NULL;+ I u7 U5 C1 {/ s2 e1 K" I/ R
- ' v8 m% N% Q: y6 F) r
- static int acnt = 512;
! r9 v& n; N7 U) @8 q1 Q5 e - static int bcnt = 8;1 S! h# F# d# Y# x3 c
- static int ccnt = 8;
- |# ^! o5 v; t4 f; D3 f( `1 |2 _ - 6 N7 Y A% Z6 w( O2 Q9 c
- module_param(acnt, int, S_IRUGO);
: [* m( L. n1 A9 e - module_param(bcnt, int, S_IRUGO);
! f, R6 N6 N4 i* ]: N - module_param(ccnt, int, S_IRUGO);
复制代码
+ C! S- c1 b* z1 P" W
4 `5 ]4 n. P0 j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, ]8 H1 [$ _2 B8 Y
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 ?3 u g, b2 X6 h9 d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 I; y+ {) q0 O: u
" e2 u2 t9 B2 ]" T) s) g; u0 V g( L; [/ }, l/ g0 O. t# g z3 \+ T
|
|