|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) a# r0 S' W& T2 u( o' {- [code]EDMA sample test application+ o8 [* I: M* y& l: y( w% ]
- /*
6 `' C }! O/ b0 D3 G! o' c, L1 Z - * edma_test.c0 H; E' [3 `% m$ R$ O c4 V/ U
- *7 A i; ^4 Z, |+ U- ^8 ?0 m& j, n' b
- * brief EDMA3 Test Application
6 K( I8 k( Y+ E% o2 t0 n8 p0 Z1 K - *
0 Z; f, p" E: a# T/ p: s - * This file contains EDMA3 Test code./ t$ v5 k% D2 |' y' Q
- *: F- n3 a" o- Z( W; m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! a' b$ G1 d9 e; ^# T( r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 F' |" q2 s- H& ]. L+ w$ Q6 B
- * TO CHANGE.- |( \3 y0 [! M0 ~) `& H3 @
- *9 Y1 F8 ~& {8 B( L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# I/ G0 P1 Y" I; Y - *
4 l) D [( g' {4 c, y/ Y5 X - * This program is free software; you can redistribute it and/or s: z: O, S w. m+ C
- * modify it under the terms of the GNU General Public License as
0 o( S0 F# ^7 J- Z6 \ - * published by the Free Software Foundation version 2.* h2 S. e3 J, w0 i# R8 S
- *5 o/ w8 f1 X3 N% Z1 A* I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: O+ }2 u2 _# \. d. A' M+ F& x7 i - * kind, whether express or implied; without even the implied warranty3 f4 \8 f8 a, c& g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' z- N8 r2 c. X
- * GNU General Public License for more details.
# N! {3 B* |) J6 Z* y0 c1 ~* ]. r - */6 u, V0 P9 |1 {9 c- S
- - C3 S l/ B3 B$ f
- #include <linux/module.h>
& R) m9 \3 G1 W% i - #include <linux/init.h>
/ j+ Q4 _& m# B! Y! x- q6 s - #include <linux/errno.h>3 h. j g" j/ H0 i% ^( }/ Y
- #include <linux/types.h>
: J4 \$ o+ L/ s, I - #include <linux/interrupt.h>% l4 b7 j# j! z4 T8 ^' S
- #include <asm/io.h>
/ a6 Q) i# Z) q$ q% Y, a: I - #include <linux/moduleparam.h>* |" g4 G& X7 |6 g8 Y1 T
- #include <linux/sysctl.h>& e. M4 |8 i4 B0 @0 u' h ^( m6 P& ?
- #include <linux/mm.h>7 W/ A9 |* k4 ~6 g- S
- #include <linux/dma-mapping.h>
3 b; }+ a8 w+ V: d$ F8 b5 {; z
+ y$ g8 G; B7 p* E5 c" h2 l% A- #include <mach/memory.h>; V% y: S( j1 E2 A$ Z" ?2 Z8 U
- #include <mach/hardware.h>% l% L, Q& v( |7 Y" Q5 ]) I
- #include <mach/irqs.h>9 Z; L- y8 q7 }2 Z/ Q; R
- #include <asm/hardware/edma.h>$ s: F6 J8 F) ^4 l- u: Q* [9 W
- - ?+ K8 j0 i8 j2 U( Y$ w( R- u
- #undef EDMA3_DEBUG9 [9 g& l' D! p1 L1 T
- /*#define EDMA3_DEBUG*/
8 Y- R2 A! Z; ]- Z8 h% d' e6 Q+ f( B, B) y - # V6 |- ~" U9 ~, I: q5 s5 Q
- #ifdef EDMA3_DEBUG' |9 R; j0 O2 L& t9 L, s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ ~3 [5 l0 V* E! ~* G# k- a" [# O7 ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( b% ~) k$ T: j: a% B" w" N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) p% I9 z i% n( Y# S
- #else
* S4 S) I8 J: g4 r { - #define DMA_PRINTK( x... )
. O* |* L* S; \2 D# T# g& u* [; R - #define DMA_FN_IN3 A+ s( p6 u' j% C3 p) i
- #define DMA_FN_OUT+ E/ g, r e: O0 T8 v
- #endif, J+ [4 x7 I0 }4 L; p4 t4 J: O$ V* J
- . I; z6 ~* g! C0 a, i0 g1 s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) c& Z2 b+ W6 U( f, k P4 m
- #define STATIC_SHIFT 38 m* I) l. R2 E: E
- #define TCINTEN_SHIFT 20' e9 P' D0 r" O) _, w$ r) W$ C+ s
- #define ITCINTEN_SHIFT 21/ R+ B ]8 y. F4 a8 C
- #define TCCHEN_SHIFT 22
& M0 s4 u# g' s2 V1 y# M$ ~ - #define ITCCHEN_SHIFT 23
! D* h- Q8 Y$ l9 ~7 ?8 v$ Q8 y
/ r; R J: X$ S3 Y C- _1 |8 e- static volatile int irqraised1 = 0;
) Q( J5 U: @" [. { M - static volatile int irqraised2 = 0;
: P$ G$ n. T. N$ r' I - ; h. p) F! n/ p% b3 p( c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* H; g3 A6 j% G$ c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ _# \, P/ h! ~; E" U: i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) o, L; M1 T, L) L
, t( J1 d. p, v- dma_addr_t dmaphyssrc1 = 0;: c0 ]1 e O7 W( _5 o& f ?4 f
- dma_addr_t dmaphyssrc2 = 0;3 o( n" a( ^5 y) |8 t# r7 a: a
- dma_addr_t dmaphysdest1 = 0;
% X9 k# g' P2 {5 G% ~! b/ ?/ U$ Q - dma_addr_t dmaphysdest2 = 0;* f0 J8 s( R0 b' \5 n; h0 s6 J
- 8 b, [7 k! Y8 N/ k& j) U
- char *dmabufsrc1 = NULL;
1 q1 r3 f D! B" D' V: m6 n, r - char *dmabufsrc2 = NULL;
2 b2 V& i: G* A/ x# o3 g+ O% ]9 f - char *dmabufdest1 = NULL;3 ~) A, E( a) Q: N! r6 h Q
- char *dmabufdest2 = NULL;
6 ^# ^; y3 C5 T9 W - 2 |" N3 B* J; f# O- @5 q1 F; g
- static int acnt = 512;, }5 ]0 F+ u. V( H; R2 u9 A5 X
- static int bcnt = 8;
* f7 v( ?0 V$ z% L - static int ccnt = 8;/ n% q1 `0 n ?+ |3 R8 _
- . I( [2 y. ]. ^+ k8 D! C
- module_param(acnt, int, S_IRUGO);
0 W* d; x' d0 y v3 s - module_param(bcnt, int, S_IRUGO);
" u t; v: Q0 s5 ^4 X5 j% x, | - module_param(ccnt, int, S_IRUGO);
复制代码
! _5 A: `" Z% T1 u. P6 y. c0 y' a; N7 {. i( Q: V7 d, k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 L ^9 m5 i1 |+ B/ ~( D! Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 m+ M5 ` }: W- l7 k! C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 [# l3 K; K1 Z) V: y
' @5 }: ~$ b, g* I& e
! A, b1 I6 f1 \, V- s+ v/ a |
|