|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 g0 ?" W% t1 }- [- [code]EDMA sample test application, R0 j. f& l9 [7 `
- /*; E, |; Y/ Z) O, P3 M
- * edma_test.c
% t: p8 A3 Z' b7 X7 A' E3 k5 p - *
2 v# w4 q' \1 u V% L - * brief EDMA3 Test Application; K; q# d& q4 u. u
- *$ Z4 W4 l, j+ [1 j, {
- * This file contains EDMA3 Test code.3 G: S7 m/ d$ [* E+ G: [6 F
- *
2 M; Q( o% a1 |7 ?0 A9 t6 @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ c9 ^8 ]# q6 h6 d: I G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 D2 g8 Q, a0 ^' Q
- * TO CHANGE.
: m/ r `( P' M( W k6 I - *
4 [: p, X+ |& g# R R+ q0 ^% [# f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 u2 K" i$ T3 D0 m
- *
( p* \2 `. h1 e; ~* _" g - * This program is free software; you can redistribute it and/or
' z6 S# u+ i; }& f* x" D2 U# z" Q - * modify it under the terms of the GNU General Public License as
3 g% f/ w. ], r2 J9 k. f - * published by the Free Software Foundation version 2.
1 I( b7 y( v4 B# j2 H0 K0 u - *: T0 ]/ w# h& i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 V( q' |, Y0 |9 }2 w
- * kind, whether express or implied; without even the implied warranty% U2 h/ [1 e' ~& k* ]) h9 W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* y7 [% O, G# i8 O7 z9 W
- * GNU General Public License for more details.
: V% r5 ], O- e b. U - */8 a0 N! `. c X
; @1 d) L1 ^: a' K- #include <linux/module.h>
8 |. {% D5 Y- Y- ~ - #include <linux/init.h>
( \4 |5 q! U+ J! v0 I5 } w - #include <linux/errno.h>2 z2 a g# M/ N4 u0 Y
- #include <linux/types.h>9 f2 Q0 O( y/ e7 i. b0 ]
- #include <linux/interrupt.h>
& n$ m$ r- S2 u c, ]- O - #include <asm/io.h>) z7 g4 d" Q' r3 r9 M, J3 U
- #include <linux/moduleparam.h>" N# }5 `; u! v" S5 \5 ~
- #include <linux/sysctl.h>" l1 I$ Z& [1 W, N) p% d% ?8 z, I H0 Q
- #include <linux/mm.h>+ v4 {$ u! W+ t: a
- #include <linux/dma-mapping.h>0 m/ O0 q3 s% R6 N: R
- * d& l+ b# d1 k- y; G
- #include <mach/memory.h>
. A* b& y3 H$ [1 z- U - #include <mach/hardware.h>
# T1 _& q4 X5 \3 h$ ]1 ] - #include <mach/irqs.h>
. q% g. Q8 G- Y3 ^9 f - #include <asm/hardware/edma.h>9 g% ]/ w0 ~* U- r/ u$ k
- 8 Z2 s, K) K! i; J7 N
- #undef EDMA3_DEBUG
- Y( {3 J1 n( ^- x - /*#define EDMA3_DEBUG*/# E* v! y( Q: u" z' Q
. w% R Y, F3 ?: }- #ifdef EDMA3_DEBUG8 d0 q6 ]1 K$ M; A: G5 g+ K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 _6 U/ D* Z0 y- D8 N- U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 ^: A, }$ o0 I6 L6 x! j. M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# t. a9 w* H' r) O5 Z* M9 W
- #else
, _. w7 a% }0 H* D; g& u2 {7 q - #define DMA_PRINTK( x... )
; _3 ?9 o2 ~- [, k- D- y- Q9 ~3 I - #define DMA_FN_IN
5 q5 K9 N6 t7 e - #define DMA_FN_OUT
! Z4 O( q$ r8 a4 u - #endif2 t- }2 N0 y+ S0 ^
6 Z; d7 L% S4 O. \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) i& T; h2 t: o: S
- #define STATIC_SHIFT 3) f9 ]4 ^0 _9 q; S# M0 E
- #define TCINTEN_SHIFT 20- {' k; e* e/ q) S, S, s4 I2 p4 d! D. S
- #define ITCINTEN_SHIFT 21
3 _3 [ P6 Q+ {. z$ {# B3 N M8 \1 O* B - #define TCCHEN_SHIFT 223 ?, _6 @, J5 _0 p
- #define ITCCHEN_SHIFT 238 w6 |) z5 n1 j3 a0 P+ h, C/ x4 k
- 8 I% [* X' x0 {- X
- static volatile int irqraised1 = 0;
) M$ m2 q' l1 E3 t' T2 a( N% T" y - static volatile int irqraised2 = 0;
- @ U' Y8 J3 N, x- A5 ~2 Z; ?$ N - ; p3 L7 I% N3 [0 e; k H9 O+ M: S1 t; c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 i" D. \4 s* J. x8 h' | w( \! e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 b$ x5 R' s8 `3 e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) C; l4 y- M- z. o" Z5 i4 ?. `
9 x# ?" f0 |: F- dma_addr_t dmaphyssrc1 = 0;
3 y m1 q ?" f0 I- W - dma_addr_t dmaphyssrc2 = 0;
5 ]3 N" C& P6 | - dma_addr_t dmaphysdest1 = 0;
5 q# K6 `( ^) n; Y, ^ - dma_addr_t dmaphysdest2 = 0;
]2 j. D0 R) J; F& ?; P( _8 v: Q: i# \6 D - ; d" @8 F. n1 a2 n( d
- char *dmabufsrc1 = NULL;. L7 s, I+ k( H- N2 q5 r
- char *dmabufsrc2 = NULL;
0 b, h/ H0 h9 g6 t6 q9 r% S O - char *dmabufdest1 = NULL;
8 Y% e M* ]" q" ? - char *dmabufdest2 = NULL;. o! M7 x) K5 W; E' x
- ; }4 \3 y8 i }2 N6 j# G: b
- static int acnt = 512;! ~/ z1 L7 W) c! i& r* ^; n6 v
- static int bcnt = 8;* A" l+ q3 f! f% ?# y- @6 S8 ?
- static int ccnt = 8;
. s u; W* d5 q# Y: w6 ?8 W
X, W8 K! A- q7 V& V- module_param(acnt, int, S_IRUGO);# e. ]6 k, j) ^0 c+ X c1 w
- module_param(bcnt, int, S_IRUGO);3 U2 Z! I; U |2 r9 p$ B
- module_param(ccnt, int, S_IRUGO);
复制代码
# r# ~$ C6 R1 }/ F) H, U* _* P+ x: w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- b @% N# q2 Y( _6 r: R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 z6 [& k6 u4 t6 L! h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& k+ n% e( T/ S% N1 W# b* \4 |2 ?
6 D2 `( \) G x! D0 b+ i
+ I4 t, n% X. H) W4 G( O8 h
|
|