|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 R' c" E9 [- ~! p4 B9 w
- [code]EDMA sample test application6 z8 y- L1 H: \2 z4 w' o9 u- ?5 u' Q
- /*
0 q7 F% W& S; ]* P$ ~ - * edma_test.c
6 g, v, ?* j7 P+ o1 [# S! V3 v - *' A; Y1 j4 q$ y3 f! |( c) ^0 w8 g
- * brief EDMA3 Test Application. E) _( i1 H& i0 X# }5 @3 i
- *
& H% a5 Q6 G/ Y - * This file contains EDMA3 Test code.
) |2 L% ~6 |/ S - *
4 w- U* s! E9 R" a) [, M) J: B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: }- Q4 [4 J0 `# A+ G4 }7 p& | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: M6 z1 D0 {! J% N$ V - * TO CHANGE.3 r! T, Z4 p7 ^) D* B; [
- *
5 `2 n5 N# [8 i. n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ ^6 Q k# l! N# B6 w' @
- *
+ U0 d& o5 I0 y$ h2 N/ y w. S' _ - * This program is free software; you can redistribute it and/or
0 c H0 C; v# r S - * modify it under the terms of the GNU General Public License as& `6 [! W2 e0 r$ H3 A
- * published by the Free Software Foundation version 2.* S) A' M5 ~$ f* i: [! z( A
- *
9 g& u# `: _ s z* W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ {5 o, d5 B) B! U" |1 p
- * kind, whether express or implied; without even the implied warranty% @5 o/ J7 l2 v# r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, t8 o* T/ [8 p$ P% U
- * GNU General Public License for more details.
% L h0 l& |( o( z; P9 t, V: v - */! o# G+ x3 I K9 ?; T
7 j. O7 O, r, C |2 @- #include <linux/module.h>/ u6 `$ c2 F& F2 N+ I9 x
- #include <linux/init.h>
4 X2 S) k' D1 E; K9 U - #include <linux/errno.h>
) T3 r. c6 }2 U6 D+ j! x - #include <linux/types.h>
9 G- _* M. d3 ], k - #include <linux/interrupt.h>: S/ z& f' V9 s1 b T" g: _
- #include <asm/io.h>: c) o) G% P, C; c( P0 T
- #include <linux/moduleparam.h>
h" g2 d+ R' [! X" w* P - #include <linux/sysctl.h>
1 b1 {! a8 B# h- u - #include <linux/mm.h>
/ W! e$ ?) O; T1 f8 f0 \ - #include <linux/dma-mapping.h>1 x3 ]) ]9 Y. ^$ |2 `: ?- ^
- ( ^+ {# \' q- Y: s; f
- #include <mach/memory.h>) S0 Z s# n+ C& X1 _ r# f
- #include <mach/hardware.h>
9 n& n4 h% {+ k8 Y" H2 e - #include <mach/irqs.h>
3 y7 A* H% p, |4 L+ s" E' e6 u6 H - #include <asm/hardware/edma.h>
4 O, l( e3 H* f/ f7 C% p) J; |
5 {" D `! p) m1 a; z- #undef EDMA3_DEBUG
+ r5 N+ ~7 _+ @$ C8 N - /*#define EDMA3_DEBUG*/
% `: ]9 F4 D0 x* |6 R5 V - " ?3 E" U, F ~: I5 N# x
- #ifdef EDMA3_DEBUG
8 L- j% K: i2 B2 n# ?7 E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 L! v: ~+ \! g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 u' g' A) Y, W% N/ K9 \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ {6 ^0 r0 ]& t8 f
- #else
B0 _7 {3 H% }$ Y. a/ I& t - #define DMA_PRINTK( x... )/ B9 @9 A H& }( h2 e: {+ u
- #define DMA_FN_IN5 t, z' F5 E3 _5 W: X9 j. s) h! W
- #define DMA_FN_OUT
1 U" r( o: B5 Z. q - #endif
2 @# a% k' {- S8 }( h: T# T$ y
! ?3 z% c' r0 n0 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) B7 `7 M9 T: H5 o8 N$ _
- #define STATIC_SHIFT 3) {* d) {- s* s: M8 A
- #define TCINTEN_SHIFT 20& {" T7 _! r1 F8 }
- #define ITCINTEN_SHIFT 21 S; P- D% m5 Z* ~: g) R& `# F
- #define TCCHEN_SHIFT 22: O5 B; ~6 d2 n9 D0 M
- #define ITCCHEN_SHIFT 23
6 [3 g3 M% O7 E% c% X# I7 z8 s
& v* m3 m5 o4 G4 t+ m3 v- static volatile int irqraised1 = 0;
# P, Y$ k0 A/ U2 B) }3 `+ P7 B - static volatile int irqraised2 = 0;
. f, b9 ~8 p" s/ V2 t+ y
: W$ |/ z/ N. o) V8 e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# G, P- `" _2 S; O6 H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 |$ F' m5 Z8 J7 b) e* i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! h$ @3 s3 {9 |- x/ @: \8 \, ? - 2 l2 f4 u: @; l' d; Y
- dma_addr_t dmaphyssrc1 = 0;
! |( j& k# `8 l) p q# u - dma_addr_t dmaphyssrc2 = 0;% C% g# V- k( ^0 {
- dma_addr_t dmaphysdest1 = 0;
1 p; ?2 l M5 a2 i a7 P0 Z - dma_addr_t dmaphysdest2 = 0;5 N2 s# ~! A5 |8 h. v. `8 Z- O
- 6 X. R( m- R. ]' x
- char *dmabufsrc1 = NULL;
9 p8 w3 Y& l5 k6 W% e( V1 o - char *dmabufsrc2 = NULL;, T$ F/ j7 b" a+ _) D l5 [
- char *dmabufdest1 = NULL;. P* v* N+ W9 a; h# S
- char *dmabufdest2 = NULL;
C! ]7 w' X$ K% s
! X3 o0 m `' s* U p- q- static int acnt = 512;& b. x, r8 |$ d$ j' m9 m
- static int bcnt = 8;& }/ ]9 |, \# O6 [
- static int ccnt = 8;% G9 ^& h. e4 f" G
- 9 j3 R" E) ~. k; e, v
- module_param(acnt, int, S_IRUGO);
- x7 Q2 o! v) \; R - module_param(bcnt, int, S_IRUGO);- d& ^0 ?3 `. i+ o9 Z% B" t0 ^
- module_param(ccnt, int, S_IRUGO);
复制代码
. r9 f) F/ j9 Y; S1 J* s6 B- Z, Z/ C# X8 L4 ~7 S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 L* ]' [8 J+ k3 M5 X& {: m. warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- x l2 G6 i" e4 w. x0 H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 ~3 s1 G. `. E8 [7 ~
2 `0 P' C; ~( J0 G5 O" p
: d1 |0 T1 E; f) Q( A- b
|
|