|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" r+ k$ ?0 d+ ]% Z! W- [code]EDMA sample test application& M- Z! \5 |7 Q. u) q
- /*/ l9 C Z. R! O3 A- P7 q
- * edma_test.c+ G+ E# I6 Z) e, K) c. }
- *% F/ U5 @1 X( F. J
- * brief EDMA3 Test Application8 G0 H6 I1 K& U# F" Y9 ^3 t
- *
9 j$ s9 \. z( d Z/ u0 z - * This file contains EDMA3 Test code.
; E! f9 ~1 w z! w5 D% e - *# X$ }4 ^: X6 {
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 z4 l, `9 R2 o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- Q9 l, u. O+ p' Q" t* F, j
- * TO CHANGE.
( a, ~' y z) b( J( r - ** `: ~9 x$ f; ^& d2 D1 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& J+ @6 p8 J* L& D/ A" }: I
- *
5 {9 l! k0 J/ ~5 K! m - * This program is free software; you can redistribute it and/or9 L; s% v3 a" ^5 i3 o: y
- * modify it under the terms of the GNU General Public License as2 B/ M$ s+ L& J" K& ?! ?
- * published by the Free Software Foundation version 2.6 j' j, ^0 J& U: s, i$ n7 p+ T
- *- T: T4 R- R1 T" H' o* u, [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 b% T' Q3 z. q7 L: o - * kind, whether express or implied; without even the implied warranty* i. i2 }8 X! @: }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! V. q1 U( a" U1 R+ k1 L, g8 J - * GNU General Public License for more details.6 t: O+ ?# ~4 C* b( C
- */8 m8 j" b* G7 \7 c) K x5 T5 k
- $ `! I8 \) M9 u% X8 |9 s
- #include <linux/module.h>
$ d+ j+ ]# f" N# F# T) O - #include <linux/init.h>
- ~9 k4 u: W& L! A+ d7 m - #include <linux/errno.h>% j0 D/ |* C% q4 X( t" I5 p3 A
- #include <linux/types.h>2 q. ~$ o$ Y% D8 q& m% n) y! {
- #include <linux/interrupt.h>
- p5 ?+ x4 _: l; R( t( U - #include <asm/io.h>
- f- n7 o: E) [ - #include <linux/moduleparam.h>1 @4 S5 \, g$ Q/ j8 `* m1 |
- #include <linux/sysctl.h>
, x U r1 h7 Q2 U9 w' [ - #include <linux/mm.h>
5 o# q6 x# }1 C+ w. \4 k - #include <linux/dma-mapping.h>
' d! t/ d$ r1 I5 E) Q8 J
* ^1 i8 d: [( Z2 m4 }- #include <mach/memory.h>, F! |6 ^# _ D8 D# @7 v
- #include <mach/hardware.h>0 F9 d8 P* o# B/ o# R
- #include <mach/irqs.h>
& E, ~4 H- K- k: L F - #include <asm/hardware/edma.h>
+ t& ]7 U( b( Z6 G: S' l. M" v% X - ; n O1 \9 [5 b6 e/ K+ E; [
- #undef EDMA3_DEBUG
8 q' D" a- v& m - /*#define EDMA3_DEBUG*/0 J/ p& x9 Q0 a
. H k5 i# P5 N; X* v0 h& Q- #ifdef EDMA3_DEBUG
3 t! p7 K7 B* z. {2 L }% n0 J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 n7 b# @* P4 k( J5 t, l& D! I# ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). G* \4 N& G9 X4 @ r/ y. x/ c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( r; n! p2 M# }& j7 y& c# F) S
- #else0 E; @! g# Z9 Y5 A/ D0 f9 f h
- #define DMA_PRINTK( x... )
l R) X2 B5 z, ^9 \ - #define DMA_FN_IN) v t- l2 H, h! z& W/ m
- #define DMA_FN_OUT4 l9 a" n' `! L% o
- #endif+ ?4 _4 ]4 g5 h! y, o
6 s0 Q ]( y4 V4 Z5 c4 A* t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 J6 P9 Y6 s3 ^+ V, ~ - #define STATIC_SHIFT 3
% y; c4 ~3 x+ W' | - #define TCINTEN_SHIFT 20
1 ~/ ]: F* Y' _. k - #define ITCINTEN_SHIFT 21, {8 |- R- {$ }
- #define TCCHEN_SHIFT 22( o3 y- T2 C+ k
- #define ITCCHEN_SHIFT 23
# U' H9 q! L* o. S6 X( `2 V: x. d - 0 m6 C9 ^( d7 g6 P0 t0 x5 g3 u
- static volatile int irqraised1 = 0;9 z% k1 B1 ^9 V5 C$ w* V8 } t4 ^
- static volatile int irqraised2 = 0;' | L" w) z3 P5 c
- ! O y3 x o1 v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ Y2 r; m8 L* u7 r `' J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 Y' r9 j* m! Z" |+ t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ e4 A4 X1 C9 F: V) `) @' g
1 z) ?, y6 z% }( g) v- dma_addr_t dmaphyssrc1 = 0; g0 N1 y& z! q6 `
- dma_addr_t dmaphyssrc2 = 0;/ P- K! z4 J$ ?8 b* f
- dma_addr_t dmaphysdest1 = 0;! z( [; r5 u3 O) a2 P7 ]$ E
- dma_addr_t dmaphysdest2 = 0;. K* i5 j: c+ a. G
3 d; ]! z( j4 w# j0 {% i! B+ B- char *dmabufsrc1 = NULL;
- s: l8 Y5 M, o6 x" | - char *dmabufsrc2 = NULL;
- }8 }. W1 B5 V5 \+ I - char *dmabufdest1 = NULL;& w5 z- K6 [4 K; J$ Y( N8 q4 b
- char *dmabufdest2 = NULL;
$ t; m$ d/ W' y3 E, Z6 T* U - 4 D2 w6 j" W& q3 O8 B
- static int acnt = 512;, N0 @ Z8 M/ T. V
- static int bcnt = 8; Y. _8 Z8 e/ U9 q- a, N) l
- static int ccnt = 8;2 c) T+ Q8 P! B0 Y; K" d1 d
?: c, W# z" P, c& t: b; Z& [, {- module_param(acnt, int, S_IRUGO);
) n' k2 @, K) T" M+ [2 Z; p( v - module_param(bcnt, int, S_IRUGO);- D+ p ], G9 p! \( W* h' b
- module_param(ccnt, int, S_IRUGO);
复制代码
! ]: L3 @! A- H
1 I) d6 R) `. r, H7 e, y' _/ _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 _! \ j. M% G( _/ P. darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# }! L* r) J7 t$ ?6 N( _6 {4 b8 E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 o% O% r! U' X8 N- f( E' t9 ^' w) w0 G2 _0 o: X
' x( b5 Q' n' \
|
|