|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ E% H/ Z3 T1 P$ L9 `6 C- [code]EDMA sample test application
3 z# c _3 Q0 H" ?0 x& U# j' y - /*( _3 [, }; [$ W$ a) N s8 N( X. e
- * edma_test.c
6 p. Q% B7 M- g* P+ J - *
9 H# }# ~1 z) }8 I0 n7 Q z) w - * brief EDMA3 Test Application4 S( ~ e5 M4 g
- *+ F: f) L' g. K; d$ S3 u
- * This file contains EDMA3 Test code.9 M2 O3 [5 A1 S: Q' N$ T# X
- *
! |" h+ u4 r' M9 ?: v6 z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) H. n5 F6 g' t/ |- w v5 j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 `9 T- H; J8 I# E) G+ m) t - * TO CHANGE.
( N' a, H: U5 _' R0 J. } - *
0 E: s) M# y. A( J! u+ e3 k; d" d/ t& @0 g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) v1 C X( c; A3 w! d- ~% Y - *
4 `( r' t" x7 N; S. p - * This program is free software; you can redistribute it and/or
8 Z+ T( v# g/ F, \+ ]- [7 Q! d - * modify it under the terms of the GNU General Public License as
2 }% r, r. K. C. g: U" N# F - * published by the Free Software Foundation version 2.! V5 v: a# h" p# M; q+ f7 U) B
- *5 I# ?9 M: c6 \8 C" P a; \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 c3 A( G3 e7 A7 }% p - * kind, whether express or implied; without even the implied warranty
1 n M8 x$ Q4 ^( j! y1 x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: `8 Z1 J+ z/ Z0 N3 }5 T$ t
- * GNU General Public License for more details.
, L& Y! z( t d0 m - */
, G0 M# k7 j: m# W! t - 0 K! ?% ]$ ?. ^) k- O/ S# L
- #include <linux/module.h>5 P0 I. z, q: Q; m0 R
- #include <linux/init.h>6 y6 [: `1 w4 T% n0 ?% w( k$ N
- #include <linux/errno.h>
4 w; _9 x6 \. H' t" l- }: N - #include <linux/types.h>4 Z$ e* W9 x0 y+ p( l. L8 B. S# H
- #include <linux/interrupt.h>. V' I! T w4 N# q3 J% v
- #include <asm/io.h>( ^# O( w. ~7 ^
- #include <linux/moduleparam.h> k7 y Q. x7 z3 }3 v
- #include <linux/sysctl.h>, {. |; `6 s% o: p0 | E% L
- #include <linux/mm.h>
4 [ L6 z* Y k- U - #include <linux/dma-mapping.h># J4 ?' P# _4 s( ^
( ?& x0 S/ L$ r% m7 Z3 B- #include <mach/memory.h>
( v/ Q2 s! X5 |. K0 c8 ?9 Y - #include <mach/hardware.h>6 j1 B+ `0 S% i) I( ^- }
- #include <mach/irqs.h>' V, J; O1 R8 x# j( T4 c
- #include <asm/hardware/edma.h>
* h+ C( B; ^# Z! P+ ~- ` - 8 {$ ^0 H* |1 W: ~8 ]* u% ?7 @
- #undef EDMA3_DEBUG
0 W2 x# N9 X/ t+ D+ @( ]6 x - /*#define EDMA3_DEBUG*/
' W$ a8 |0 w' |/ v5 Z
" e: X( A. `% \% K {- #ifdef EDMA3_DEBUG9 `( {; c6 S/ G( R8 v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): A$ d: [* U: i1 P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 p% X5 V( ?7 f+ ?$ |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 S# j' t! ^4 w# E9 O7 ?/ q - #else( ~! E0 t' M# s$ x' x: a% F
- #define DMA_PRINTK( x... )% e: `2 r3 R0 u" a
- #define DMA_FN_IN
6 L9 P# ^2 t; |- m1 d - #define DMA_FN_OUT
6 p/ ]" O' ]! ` - #endif9 p% z& `$ b, R1 U+ A [4 b2 f+ l3 F
- * k6 U( g$ d" x, ?; Q, e8 J& g( h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 j# Q! X% ]4 D5 }
- #define STATIC_SHIFT 3' i: `, H/ t4 e" f+ D& f
- #define TCINTEN_SHIFT 209 m" {: x- T1 V/ ]
- #define ITCINTEN_SHIFT 217 Q5 _' V5 `) ?
- #define TCCHEN_SHIFT 229 l. v2 L( q5 _9 }& l' b! [
- #define ITCCHEN_SHIFT 23
' c3 N- Z7 G7 P7 d
( K; M! F3 V* o. U% p+ `+ Q. K' G- static volatile int irqraised1 = 0;! X: S+ ^8 d! O6 r) C; a/ f5 J
- static volatile int irqraised2 = 0;8 z Y3 @" h9 @
- w) M4 P, |# f7 w9 h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 m7 F7 p' V5 X% [' ~! C6 \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 f- q6 b' G1 M W+ ?" H( b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* G1 d* M' p, T" w5 f8 B
* i3 t8 y9 ?7 M4 q; ~! P- dma_addr_t dmaphyssrc1 = 0;
8 t9 U/ x7 }/ j( Q% n - dma_addr_t dmaphyssrc2 = 0;
8 C7 P( p, u# }5 R0 t - dma_addr_t dmaphysdest1 = 0;
, Q+ G* |: s, x( L# h - dma_addr_t dmaphysdest2 = 0;
: T) Z0 B, [( N. O: i' W7 W
+ H* i+ Q& F. A, }0 Y- char *dmabufsrc1 = NULL;
4 c% B6 A% a7 h! a* s& P+ o4 |6 i% \ - char *dmabufsrc2 = NULL;: n* T3 o$ F# o0 R9 G
- char *dmabufdest1 = NULL;
& H$ |8 ~3 F% k1 q; C; _ - char *dmabufdest2 = NULL;& Q0 D& V6 C% c& Z
3 n) M, I1 }- l* Y- static int acnt = 512;
* ~+ a% z2 u: A+ F0 X - static int bcnt = 8;* ]# u, P- q& M9 \5 j1 L3 o4 T
- static int ccnt = 8;4 B" `5 g$ _( N$ |; c7 t
5 H: b( r7 z+ H; I3 g/ i) H' z: a- module_param(acnt, int, S_IRUGO);
5 l Z7 c: r4 Y7 n: |7 q/ H3 m# V( \ - module_param(bcnt, int, S_IRUGO);* {0 P9 _: n6 ]" G. R; l
- module_param(ccnt, int, S_IRUGO);
复制代码 3 ?2 M6 h1 q/ Q
f$ U* T0 p' \1 L( X# L+ Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; l, U. F4 g" _9 t W8 ^1 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. R' ]" c! I! f- |6 j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" | F6 _% m/ x: R q; q- O6 q% N
2 {5 T4 h+ J1 L2 t5 @
0 Y8 i- j" B/ y: G; y9 i" C G
|
|