|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 C- h2 J/ `* f" _6 V% B |+ e: a& J
- [code]EDMA sample test application) } ?0 p8 P5 G* T5 c7 Z- Y/ K
- /*/ |7 W. R: s7 C. ]+ N
- * edma_test.c3 v% h, } o8 K9 u8 Y
- *
. w: V" ?, L9 g& ]/ I9 P - * brief EDMA3 Test Application0 a j/ O7 a+ T2 Z7 X! A
- *
4 l2 T: t. h/ i5 W6 Q - * This file contains EDMA3 Test code.& k- F4 M; r O% \9 u/ S( I
- *! R5 t( Q% M' E, h$ w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, n5 c) `) i2 q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 h9 y8 i; b: g! \! A
- * TO CHANGE." R- O7 P& _4 f3 i" l
- *8 ~, I1 V j* R. _, `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 r/ v8 R* P! Q0 ~9 C1 [ - *$ e8 G# {# W5 z4 A! N
- * This program is free software; you can redistribute it and/or6 f( m) g9 m F1 T% K1 l
- * modify it under the terms of the GNU General Public License as1 N6 I" i; {7 ^
- * published by the Free Software Foundation version 2.: J+ ?# a: z a; c$ A
- *
# b( N0 h" ~/ v3 s7 g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( i5 C& I# z+ h$ W6 I$ Z+ S" Y - * kind, whether express or implied; without even the implied warranty
/ f0 C2 a6 ~# Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 M X3 @( `/ ^2 I4 ~+ d7 B - * GNU General Public License for more details.& ~ t: Y4 ]9 U. L' y3 s
- */- A. l% [; H" _1 f- @
- 3 p: n( o% |8 S7 \7 ]% x; X- E
- #include <linux/module.h>7 B2 s2 y6 R* n c: `0 Q. T8 [
- #include <linux/init.h># G1 {% w, {+ e
- #include <linux/errno.h>
6 w5 b5 C9 T# t; H' A( Z; R2 L - #include <linux/types.h>& @7 [7 S* q+ H$ U8 }' |: S3 n
- #include <linux/interrupt.h>: p% G. c9 u- o0 _ `6 G, ?& {
- #include <asm/io.h> M& \. j# v5 M0 j( H' w, G
- #include <linux/moduleparam.h>
, w% S/ R) C" [ - #include <linux/sysctl.h>
& }4 m- ]" J3 j( X6 G3 x2 K, a - #include <linux/mm.h>
- @( b O! E4 h" S3 `! e0 S - #include <linux/dma-mapping.h>
* x0 A6 J' H; q# u" p# _ Z1 o - # C1 a2 q% j! d- A2 j( F
- #include <mach/memory.h>" t/ V2 p" ^; i4 {
- #include <mach/hardware.h>
* f$ b7 ]- [% Q; Y7 }& {: V - #include <mach/irqs.h>; B) N2 {- x7 a3 E- E! y8 t
- #include <asm/hardware/edma.h>
" N& J5 q5 a* q. G6 i( ?# y
2 P! o; X! d& r3 e) h4 R- #undef EDMA3_DEBUG
* Q& K) W& ?5 ]. T1 C, U5 d' U - /*#define EDMA3_DEBUG*/
' G" K9 z8 f5 Y6 ]+ }$ Q - 0 G! X3 y! U% f- V( |2 g( t
- #ifdef EDMA3_DEBUG
, ^4 Q8 q* H' e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% U/ q: c+ A1 Y/ b# g. g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 e# j) B4 ^0 @! Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" ~* f4 ~" A) n - #else* H* }9 @/ L' p( O j- J2 R+ W
- #define DMA_PRINTK( x... )
) ~% ~) i" ?4 I1 Y% e - #define DMA_FN_IN
, {9 O. G; _) D. }% {- B - #define DMA_FN_OUT) u9 s5 }0 L3 F# S: i, F" @
- #endif
( n! }6 ~2 z% w7 ?; Y* B0 _
! ^% K, ^8 ?, v1 r9 K, ?! E3 Z, v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ t! O# k4 I9 L1 o" N# I: g2 K8 d6 @
- #define STATIC_SHIFT 3; u* k. q- p8 L6 S3 S) n
- #define TCINTEN_SHIFT 20* A* t2 z0 c' A8 ~
- #define ITCINTEN_SHIFT 21
- B: W# H) m" E) [" [" X - #define TCCHEN_SHIFT 22
# I- F, R* u1 H4 l0 i' W! q - #define ITCCHEN_SHIFT 23. d: |2 S- R: O! |: K: u# O
- , Z; i% @/ p$ \( p3 M% u( m
- static volatile int irqraised1 = 0;
" Q) x% m+ k/ E, }# K. ]; g t - static volatile int irqraised2 = 0;8 |; D8 }2 V! V0 e# W# X
- . E6 F8 e0 } D" C) O6 Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 O( D7 X4 K, g# x- S6 z* z8 ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 L5 u4 A4 s* j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 w1 ~* r4 b9 Q& `" }" H
- # |. ~$ M2 V9 G" @- a) U/ ]
- dma_addr_t dmaphyssrc1 = 0;
z4 |7 l+ Z% ] - dma_addr_t dmaphyssrc2 = 0;) n5 I1 \8 s% B+ h4 Y
- dma_addr_t dmaphysdest1 = 0;
! w y4 G7 {0 X. |+ G, b - dma_addr_t dmaphysdest2 = 0;
2 y T) u0 u$ L, f0 z' i9 ^3 O. ^
- W. T- M$ B; d* h" ^- char *dmabufsrc1 = NULL;
( i6 P r+ Y! a# N4 _& n! y - char *dmabufsrc2 = NULL;& P0 O0 d8 e1 l7 X
- char *dmabufdest1 = NULL;7 F. x0 Z3 I- Y& k7 M2 w
- char *dmabufdest2 = NULL;
* r% h: |( H4 T4 s1 l0 e6 `9 } - ! U& C* j1 g5 O6 J( k2 g
- static int acnt = 512;: Q9 n7 q7 B# K; F) ~' R
- static int bcnt = 8;! e: I) k! @& }
- static int ccnt = 8;
1 s9 d. t: A2 u
! p1 P4 d4 w1 {) T. I+ H- module_param(acnt, int, S_IRUGO);
9 D: H+ [# ^: O' S* X - module_param(bcnt, int, S_IRUGO);* b/ M* u1 O% Y! v& k$ Q
- module_param(ccnt, int, S_IRUGO);
复制代码
# K+ ~8 C; s4 W; h+ N
! Z1 {1 P9 l2 _% v- O0 O; \ K1 l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ M. D3 J7 M }* m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 O: u5 s9 F( Q& N; [! c* n: s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 h4 t/ p! K, Y' q8 k8 o, V
) I% B. \" v; h" N' r* S9 z' F
# A& R N6 K& P0 i* o8 i+ O- S+ g% P |
|