|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# i3 s" J: g" c- A `- R. N: y- [code]EDMA sample test application! D+ j' {" C5 g5 l0 n
- /* A& [3 O+ `+ X ~ {7 r
- * edma_test.c
o: V% ~$ r, S' w1 ~; h - *2 I5 \. M( _0 S3 G- @
- * brief EDMA3 Test Application# U! [4 D; V8 y. E& g
- *" M5 r3 {' |$ ? h* \& q+ z b
- * This file contains EDMA3 Test code.
( s' P; T1 J2 @0 J3 s - *
9 _4 H! G, G2 t2 p/ p3 x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ Z j5 N( ]# c6 f& X8 d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 S. {0 J# h. [/ c3 ?1 O: ~7 i% a9 G - * TO CHANGE.
$ M7 m% S5 }3 u" j+ e' q4 Z$ w - *! v5 U( O- Q1 N+ i& o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" f/ B( G* {" N! x/ `8 ^* o
- *. A$ X' J0 G+ V. O5 B B
- * This program is free software; you can redistribute it and/or5 T- c# A& |4 D5 z) I1 @3 q
- * modify it under the terms of the GNU General Public License as* q( f6 L! ~4 F9 w# N: }( F
- * published by the Free Software Foundation version 2.
# d" G; @. t8 _/ t8 k, L7 I' M - *
G5 N. Y4 @ M% L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 L' d- \8 Z" w2 t* \- V - * kind, whether express or implied; without even the implied warranty
6 D+ e7 d% G0 R$ i2 Y2 E0 [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( a7 B* y. }5 S1 z2 h$ O: D
- * GNU General Public License for more details.
i' F5 x0 d# j, c/ \ - *// Z, X$ i; f, Z* v$ U
4 I+ o2 D4 r2 Z- e9 R- #include <linux/module.h># |6 }) d- V" p6 L% n! d
- #include <linux/init.h>
% b% T9 F8 n& f" ~) Q. \ - #include <linux/errno.h>
% x8 o% P5 h6 ^+ _1 k - #include <linux/types.h>% ~: @/ i* ^' ~& o. X
- #include <linux/interrupt.h>
. c0 I! _) ]2 J* o, V - #include <asm/io.h>, U& ?2 q+ V2 H9 ? V
- #include <linux/moduleparam.h>+ o9 d% W2 H" B* Q7 R0 Y1 h
- #include <linux/sysctl.h># Z1 W, F+ w8 ^$ `
- #include <linux/mm.h>
: A* |# Z; j5 c C6 @& C5 F) C: N2 C - #include <linux/dma-mapping.h>
; i C" p4 R' k! ]8 [5 ]
2 b: F) W* ~2 ]8 p1 U2 }# j( p- #include <mach/memory.h>% F5 o5 h. F4 C. ~$ e* ~/ j9 I" \
- #include <mach/hardware.h>/ E, ~* `: }1 k1 {8 H- a
- #include <mach/irqs.h>" x* g9 o; N# Q6 |0 r* P* S: Q
- #include <asm/hardware/edma.h>
- G( t9 {& g$ c5 k - 8 ^: ?9 @+ G3 X7 f8 R2 Z
- #undef EDMA3_DEBUG
# E3 `) ^. }- i; P: @( q - /*#define EDMA3_DEBUG*/6 j! N0 o' ~% x0 k+ X/ i# `7 c
- # {" B' V; \3 Q5 ?+ y& g
- #ifdef EDMA3_DEBUG
7 W# d, ~( ~* D* `2 \5 P0 A" { r- Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 u) k/ a# h! {( g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! _3 d' F1 t/ y* c6 _( M3 A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( Q% F6 V' c0 p4 c, _. v - #else* J1 b" ^' M4 c$ l( y
- #define DMA_PRINTK( x... )) O) T# X! P1 H* E' j
- #define DMA_FN_IN' T- Z. H! w+ a' ?" c( b6 F' a) b. N
- #define DMA_FN_OUT6 M3 ~1 [5 K" T. e
- #endif
7 X8 V0 y1 q: O
8 X! g J# N7 p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: C( d& g) Y# ]6 p- V* g - #define STATIC_SHIFT 3
- ]% ^3 Y5 @; F2 @( ]; |' }! h" r - #define TCINTEN_SHIFT 20# \0 Q* Y" m- D; _( X; B+ D) N
- #define ITCINTEN_SHIFT 21
; R& X d% {5 T. w5 W/ j9 w2 Q - #define TCCHEN_SHIFT 22, h' ]4 x3 P2 y
- #define ITCCHEN_SHIFT 23; z( z; x; N) _% V+ y6 f: v
1 g+ g' T: y- f& I- static volatile int irqraised1 = 0;% @0 i" O/ @/ |
- static volatile int irqraised2 = 0;( i( r7 X& q% Y& L4 H8 {/ V
6 P# `: U; D4 F" G" W: n1 I. m9 s! x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); @- v$ N# ~* p. n- y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 _' u4 N3 _7 l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- W; z9 ~" @4 j# S% y% f6 Z
- x1 Q3 R! j/ T- dma_addr_t dmaphyssrc1 = 0;
' T0 i. B8 X% M$ ]/ k2 t. e$ h7 D4 D+ m - dma_addr_t dmaphyssrc2 = 0;
& `5 Q+ f& y8 a- U% r - dma_addr_t dmaphysdest1 = 0;/ t# g0 I" r5 V1 L' A
- dma_addr_t dmaphysdest2 = 0;* N: T, _! k7 j
- : B5 S: x. `5 r- t- ?. T& i" N- @% N
- char *dmabufsrc1 = NULL;9 J! l- A: N( ^! p# Z/ E6 Q
- char *dmabufsrc2 = NULL;
- _* D" R, a7 H. J9 w A - char *dmabufdest1 = NULL;
; Y/ u7 O, h" ?# C. }8 j - char *dmabufdest2 = NULL;
9 W$ F% e4 _3 r/ f" h: A B
7 n! \. }' G7 ^- static int acnt = 512;
3 I1 ]7 N. K& t! t7 ~ N - static int bcnt = 8;' _2 ^( ]; d- \% ]3 r
- static int ccnt = 8;: F* `: B1 J! `% z5 Y$ r
3 M: Q4 f4 N6 J5 v1 ]- module_param(acnt, int, S_IRUGO);
/ d# x7 `* E; x8 x$ e$ c - module_param(bcnt, int, S_IRUGO);$ y) N+ T3 k1 ^" R4 d
- module_param(ccnt, int, S_IRUGO);
复制代码 ; |% r6 Y& r. m5 F; o$ \! h! s
9 H Q2 r- e0 |# D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; m) x0 v, C% p A/ N7 b1 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ C4 O% v$ S l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% C9 n4 S4 _4 B; Z' ~8 O3 ^
( }/ K* ]3 s4 F m @% V/ a. E$ y9 ~9 ?7 L5 h- ^
|
|