|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 }# |& s+ [3 \- [code]EDMA sample test application
- t3 t4 \; y/ ]0 s7 W6 P1 D2 l - /*
2 c" L' p9 }& e' a$ F/ a- S - * edma_test.c
K* B' o3 g+ R* ^" y. Q) e - *' W& `: ]4 A$ M U# l: `4 w5 l
- * brief EDMA3 Test Application
3 ~* K* _5 E* M* H4 c, y7 R" F) w - *
) f3 F5 p* W7 I" r7 W1 u8 c1 j+ a - * This file contains EDMA3 Test code.
1 s8 ?. D. B" O% I7 \. y - *1 i, m/ X5 F% X$ X8 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 w4 ~ X1 J2 S& q% ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ v+ b$ n0 i; e- `
- * TO CHANGE.7 r1 w7 g4 S4 k! |9 ]) q% n4 H
- *1 O2 T0 |$ F4 w: z5 D* m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: K) [ C8 w" k# D - *
: u: D; m8 G \" o - * This program is free software; you can redistribute it and/or
5 g# b6 a- Q* l0 M# r1 D - * modify it under the terms of the GNU General Public License as
6 o$ S. G/ a1 @3 F8 U2 j# Z - * published by the Free Software Foundation version 2.# M# G+ o. ]/ J4 h3 h
- *) \1 c# Y/ G: C- s; b- }1 R2 W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any l4 [7 C2 p w, E# U" N3 G6 N
- * kind, whether express or implied; without even the implied warranty
# v: M( A, g( p3 v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: s s( \$ I6 T - * GNU General Public License for more details.
; }3 E3 R; C! ] O0 q0 [ - */
3 A- F/ ?# Z6 Q* U4 C6 O# A - : e0 Z4 h* }- O* _6 C6 X& @, n
- #include <linux/module.h>
4 t* h: h; @! _- ~( X - #include <linux/init.h>' r. N o8 m# A4 m) V4 ^$ q
- #include <linux/errno.h>% V8 |; \ g3 {3 Y' u: e
- #include <linux/types.h>5 R- r5 r% b1 r. Y3 \0 s. m
- #include <linux/interrupt.h>$ x' ~' ~: {4 E: y" l: {
- #include <asm/io.h>
5 r+ s- | I; o8 k. S0 M, U/ N - #include <linux/moduleparam.h>
* }+ r+ c; \* {; I4 @ - #include <linux/sysctl.h>
( S: X+ I6 ?8 v1 T+ ^" a1 N - #include <linux/mm.h>
3 m4 B" O5 e- h$ Z6 A - #include <linux/dma-mapping.h>
& D/ U& r0 K6 J2 I$ l - + k+ ]" o/ z! ?8 S9 t2 E
- #include <mach/memory.h>
& D) h2 L; i; d; B - #include <mach/hardware.h>
* P+ n9 C- X: q' ~: _ - #include <mach/irqs.h>
0 S; f0 l+ u! ~3 t! H7 p - #include <asm/hardware/edma.h>
/ G' ^( v% c% ^3 Z# p
1 { I2 T3 ]3 _0 x; C$ v- #undef EDMA3_DEBUG
# L0 W& _9 f% y% u - /*#define EDMA3_DEBUG*/
% ~& o! b& k/ W8 L0 X; r! j - u0 s0 }- S9 d- u" P
- #ifdef EDMA3_DEBUG S& o, u% c- e9 A b) o% N0 s7 \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! o) P2 r w9 K" ]* t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 e1 r; V2 q/ p3 R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ X! X- b) ?) x" M2 z% z: H! w" }
- #else
! G+ Q8 s/ ]. J G, u0 a" [( v) v$ C - #define DMA_PRINTK( x... )" Z/ ?: a* D7 E# M. k4 p
- #define DMA_FN_IN; }- E! Z- Q& x8 ]
- #define DMA_FN_OUT
$ u7 h$ o! l+ N7 r7 ?6 X - #endif6 k" a' d, A7 ^1 Z; o# }
- T8 W# j- }5 H' m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) f! [; w$ O$ _9 N1 M6 }
- #define STATIC_SHIFT 3( |, a! A3 j- k0 B0 J* u4 z- n- N# c
- #define TCINTEN_SHIFT 20
, w- n' a0 k& F" X. V1 B P* v9 m - #define ITCINTEN_SHIFT 21
& r/ ?$ p3 j# e9 x) i' f - #define TCCHEN_SHIFT 22
6 D: x/ Z. j; ^% D9 ` - #define ITCCHEN_SHIFT 23
1 [) o5 s5 r5 v7 p1 d
5 Q! x2 K: E" z! ~" b- static volatile int irqraised1 = 0;
P5 X0 C( g' t9 W/ _7 l1 g - static volatile int irqraised2 = 0;! K/ p7 ]* h, o8 ]* K S
- - L& D0 i9 i, j) x$ @, a8 @2 K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 |9 D; `3 x1 g* Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 Z4 K3 A3 K' v+ S, F$ g6 x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ~2 Y! Z( P3 q' ~3 e/ ] - / c& l0 Y; q/ C
- dma_addr_t dmaphyssrc1 = 0;5 E: ~8 b2 x) j( L" ~& V( z: M
- dma_addr_t dmaphyssrc2 = 0;# e2 x& p( Q: r
- dma_addr_t dmaphysdest1 = 0;
+ L: B- B$ e. D) u% U) | - dma_addr_t dmaphysdest2 = 0;
" m" b9 V' J, y4 d0 \* @ - , {; x4 v# F+ }* r! Q& F
- char *dmabufsrc1 = NULL;
: b* _2 v& X" n( L - char *dmabufsrc2 = NULL;4 E/ Y% L, m, L7 l6 i; L4 }, G
- char *dmabufdest1 = NULL;
3 ], a& k U- Y2 n# ?1 o - char *dmabufdest2 = NULL;; ^6 ~- u7 z" z. c
- 0 r z" A6 v4 {; B/ e1 Y7 |9 r! V
- static int acnt = 512;, z! S! r; c; D3 W8 n: Y. }
- static int bcnt = 8;: G0 A P- k& C% ?
- static int ccnt = 8;
+ z0 O5 E1 J9 p# X - # c# ~9 \' `+ B0 Q
- module_param(acnt, int, S_IRUGO);
# K1 a' C h y3 S$ n) m- ~ - module_param(bcnt, int, S_IRUGO);
. T5 C3 t: N. M2 |$ h% x/ a9 ~ - module_param(ccnt, int, S_IRUGO);
复制代码 , c6 K4 T- h) f, W8 \: k
" @4 ?- |, u5 ]2 I7 Q. R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, [6 f# H6 P; }! K9 a0 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ B) B( p. v# @0 ^5 u+ g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 j' Z3 `" k) H }
6 @! L- ^* `0 K( D" E9 z$ ]- X; U$ M# I) m! F
|
|