|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! `/ S7 H2 w3 A$ G% ~! I- [code]EDMA sample test application$ `3 x. X( v G! g
- /*5 q1 |9 P7 R- R- d
- * edma_test.c
# \' E1 N% n( w' K1 \ - *
5 b( t, F3 ~1 C6 _8 N - * brief EDMA3 Test Application+ v. q6 |. B0 Z( e
- *
: G5 b2 D5 W4 }- ~; x - * This file contains EDMA3 Test code.
, }& ^8 G# }& k0 f+ T6 C - *9 D+ B+ k4 o, N; f! @# r% E4 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 r+ N8 l# s2 J) N. k1 o0 f8 F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 ^$ J6 H% K! l! T - * TO CHANGE.
0 ?' J9 {+ B. _# O# ^/ E# ` - *' A* f, ^. p+ [+ P9 F" j( q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* M+ Q# g: w6 [ - *
5 D- V& j% q. H0 k - * This program is free software; you can redistribute it and/or! Z* Z0 y- n- }1 K+ i
- * modify it under the terms of the GNU General Public License as
$ Q1 N& u) }6 _1 p$ ~' ^ - * published by the Free Software Foundation version 2.4 H9 y8 S- R# c% w
- *" [/ C: n4 I" L( O5 L0 E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& o0 l* G% j/ c2 |' R0 ]+ U8 }' T& t - * kind, whether express or implied; without even the implied warranty) _! @, E7 ^# w+ Z4 x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. ` M+ k3 v0 f5 e$ E+ H2 c: V9 B2 u+ a
- * GNU General Public License for more details.2 j# }& J, }/ u7 @) y) E' M
- */
" P" U( [2 ^: |: {) \$ ~3 o. T - 5 Z s5 ~& k% L$ z8 ?
- #include <linux/module.h> n4 t; x3 U, [; r; ~
- #include <linux/init.h>
. H1 I; h1 {1 X) Z - #include <linux/errno.h>
r$ ]* @5 @ G6 W; V - #include <linux/types.h>
5 b2 N4 C2 u \% v - #include <linux/interrupt.h>
. l: f4 ^" {$ b - #include <asm/io.h>
( ^- P4 V( { l - #include <linux/moduleparam.h>& p$ S8 f# H) d' h/ g
- #include <linux/sysctl.h>! W2 Z" F, w0 A6 d
- #include <linux/mm.h>- b& X9 P. P/ T) \3 U
- #include <linux/dma-mapping.h>
5 B) D& a; C$ [, X8 P0 ^' x& f5 }
+ l; `: V5 z* q& t. J$ R0 D- #include <mach/memory.h>
# b+ j; l5 |# H9 D- { - #include <mach/hardware.h>
7 n+ S4 @1 Q! S4 F; I- @ - #include <mach/irqs.h>" D/ Q1 { S0 x, v1 x- N+ |
- #include <asm/hardware/edma.h>
4 h2 a( `$ N% F8 ~
& R& H, \5 s; f& c7 b& T4 o- #undef EDMA3_DEBUG; r4 ` Q; ]( Z7 B8 E1 q B
- /*#define EDMA3_DEBUG*/) V- h, L. w3 ?5 H) @/ ^
q" u$ w0 y7 {, q- #ifdef EDMA3_DEBUG# W* Y" G2 }! w! ~$ {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ r" }! I! B+ W/ ~) k! H/ L4 a( n+ C! ^" k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ j2 c5 L7 N# d* z8 |/ n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). s& Q2 c+ k, x. \2 k& s3 `$ V
- #else+ C6 i9 G: S0 \7 j+ S
- #define DMA_PRINTK( x... )
: @; A" i7 m, H7 l$ W6 c( w - #define DMA_FN_IN
- P9 c4 b/ P8 C: z - #define DMA_FN_OUT; r# T& l" F% w' j! S3 A" v: ?/ z
- #endif3 }7 h; ~& J/ x9 z2 p3 w' q, D
8 Z2 W* ]5 L! T! V0 b# f c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 O4 @) y, Y) U5 H# y' u6 i# r - #define STATIC_SHIFT 3* T+ U) V8 p& {8 t: r
- #define TCINTEN_SHIFT 207 ^; r3 [: W9 t3 G7 \2 N
- #define ITCINTEN_SHIFT 21# a5 ?2 t) w% A$ \& H
- #define TCCHEN_SHIFT 22
1 N; r$ C2 Q) b' s3 v5 A( U - #define ITCCHEN_SHIFT 23* H/ |. f8 ~3 E4 S) L6 B
- % N; ?% u) p6 I+ f2 S, I
- static volatile int irqraised1 = 0;( U7 q) r8 P: V `4 Q1 Q4 n+ `
- static volatile int irqraised2 = 0;& K" y l u9 n$ _ q8 ?& ^
- # m* o- k3 f" U2 R ]2 N; m0 _+ F7 j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 n: j' Y9 I7 a5 [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 I/ ]" L8 F- X3 G: A: X7 i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* l5 T% l+ g1 u8 J - 4 c2 _8 h# y& y' h/ @
- dma_addr_t dmaphyssrc1 = 0;) y( i4 |* J5 F! e- _( W! F1 U5 E
- dma_addr_t dmaphyssrc2 = 0;
/ ]' t- q2 Y6 x0 C9 s" X - dma_addr_t dmaphysdest1 = 0;+ v. W% d' ?2 j, T: V7 ~
- dma_addr_t dmaphysdest2 = 0; x/ z5 C' g1 }" Q+ C
, u5 o! u* L' ~/ S- char *dmabufsrc1 = NULL;, m: N5 D8 g0 L% z0 v* n4 Y
- char *dmabufsrc2 = NULL;
" I$ j& Q2 E) [) y7 h - char *dmabufdest1 = NULL;( z+ O9 i8 Z! h7 v- C( f- C
- char *dmabufdest2 = NULL;
/ O; I" i1 [" a& U! {
( }" g+ x( r. L- static int acnt = 512;6 Q" F: w5 A! T0 H7 ^. x8 [4 l6 h
- static int bcnt = 8;
G; Q# Q% q3 @9 { - static int ccnt = 8;' G; u% j& E- g+ C: i; W2 D
- 4 g9 D& H+ c5 B) C% @. K; B/ [
- module_param(acnt, int, S_IRUGO);9 {/ @! `( K" Y+ c( \! t Q
- module_param(bcnt, int, S_IRUGO);
* A8 e( T- ~' B- C* @; I) w - module_param(ccnt, int, S_IRUGO);
复制代码 9 [: H: c( h! _
+ H& ~: x- m: k& I" E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
]3 X* T1 \1 c5 x2 n K0 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ B8 |+ V* X6 L. H1 q: z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 E" o+ }* O& h/ h; o2 H6 W8 Q$ T) t0 v
4 @- v; ~1 p$ v, d4 Z
|
|