|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 T: ^* G5 r6 f
- [code]EDMA sample test application, e9 R- o: p) L8 ^
- /*
5 `$ j4 G2 Y' P( q& d5 t* e4 V - * edma_test.c
: S- @3 \# ?; U& }3 g! H8 D - *( O. v0 ]3 S8 P
- * brief EDMA3 Test Application; A7 w. @; A2 c m
- *. t& g1 A: A4 X8 j
- * This file contains EDMA3 Test code.! a5 a5 O1 S9 y' w
- *
: K! e8 j& b8 w8 r. A$ h9 T( _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- [6 ~ g& e! {5 U# M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 [" u4 L5 }' V' a - * TO CHANGE.* q c% t X& F+ _) j
- *
5 D5 p& D' U. O2 `+ C: Q* s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- c! |2 z1 i0 { U, Q
- *
2 c( N. \; Y6 P5 r - * This program is free software; you can redistribute it and/or
: P& h) }+ s2 `, x/ h4 j - * modify it under the terms of the GNU General Public License as( F- z/ z, a, n2 C, i, z* l6 U b
- * published by the Free Software Foundation version 2.( [7 D( l. Y' Q0 p# O A- Q( [" g
- *
* Q- O* t; z& j- q/ ~& |3 Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 [; r+ E5 y) S% j s* x - * kind, whether express or implied; without even the implied warranty
' ~6 C4 d$ i8 U' Z, m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; q3 u9 B7 L) R* I
- * GNU General Public License for more details.% b( l8 \, E, D8 @( x$ ?3 L, T% r
- */
9 a8 H/ ]5 ?% @1 p: ]
% H3 ]3 P+ P8 m$ y! C- #include <linux/module.h>( v- T) h) Z; E1 }7 e4 r
- #include <linux/init.h>( n' J W9 ^ @, S0 t
- #include <linux/errno.h>
' J- p2 ]5 u: `/ U! a3 m - #include <linux/types.h>3 S7 [1 {$ n1 D1 b- t
- #include <linux/interrupt.h>
3 X! @2 Z" ^% k - #include <asm/io.h>. k- `! ~' ]* D* x+ v; O
- #include <linux/moduleparam.h>0 T5 j6 N `( ?- A# a! j. U t0 {* M
- #include <linux/sysctl.h>! {: s* H9 q. _" M
- #include <linux/mm.h>2 J% D2 l: U8 E% s" v: [% I1 k3 L
- #include <linux/dma-mapping.h>
6 t) z! `3 A. l, j- p- p: B8 T8 R$ m - " K4 i" {- W5 V6 o5 g
- #include <mach/memory.h>& F9 h, Y" i/ d& n5 |0 B% ]) {+ H
- #include <mach/hardware.h>
1 H1 R. v2 f9 F# v; y4 G2 g - #include <mach/irqs.h>
1 {7 x. ?& t* O- [ - #include <asm/hardware/edma.h>
4 V9 f: }% p/ b# _5 H3 ^ S - ( K# D E7 W- M6 c
- #undef EDMA3_DEBUG
" c9 `. g% w3 c0 G; T9 g, l - /*#define EDMA3_DEBUG*/0 G% a' [0 P3 ^
, ]1 f& \8 K+ I. O- #ifdef EDMA3_DEBUG
2 F0 _* `# f+ Q; J/ T1 d. r* m! g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 _, T9 Z9 s! t; E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* K3 j3 E5 h4 B4 ^$ T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 T7 J" Y# k) U# x- g0 B# z - #else; U: r- r- w" t2 B: ]: c6 R
- #define DMA_PRINTK( x... )6 D' f- z! A1 Y0 o2 m$ h0 O6 |" L
- #define DMA_FN_IN
; x( W3 k$ r0 q( Z: k - #define DMA_FN_OUT9 p( v1 m8 a9 d6 ^8 \8 w3 U
- #endif' o! v# b! J1 t. {0 v `
- % Z: H; y: `. c5 A7 {: s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- Z5 g' i/ N& v! B2 W( O: X
- #define STATIC_SHIFT 37 I9 w/ p& B# s$ D* i& Z- J1 a
- #define TCINTEN_SHIFT 20
c+ s' M% c8 u$ D+ h; ^) O' j% v - #define ITCINTEN_SHIFT 210 u5 x0 c, _4 U4 m
- #define TCCHEN_SHIFT 22
' t. d4 q o! V) c( N% v8 \, M - #define ITCCHEN_SHIFT 23
* M. W& v0 k! [3 M# v6 x l* h
# [* d4 |2 H8 t: W3 c- static volatile int irqraised1 = 0;" Z: [# @9 v- R, X, @& A) V+ \" k
- static volatile int irqraised2 = 0;4 S6 ~8 N3 @5 U$ [+ M0 {3 b
- 0 Z+ o5 ^7 ^: v. d2 x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- F' C4 \. D( Q" }" r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, p0 R" F2 F( }# Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# V/ v5 h0 I# L- ~( d* z8 }
$ _1 S1 \7 _5 D; A# ]- dma_addr_t dmaphyssrc1 = 0;
+ N% h! {2 Y9 K& g9 f - dma_addr_t dmaphyssrc2 = 0;: D( a9 T9 m$ z2 W" q0 h! B
- dma_addr_t dmaphysdest1 = 0;
' C" @4 {2 w9 e! I - dma_addr_t dmaphysdest2 = 0;1 O7 C. v0 z: B, o) F
- , ^8 U) m5 N d: t6 F) M1 B
- char *dmabufsrc1 = NULL;
4 V5 r# F* c% S* u - char *dmabufsrc2 = NULL;* `" R! E! @! J, J
- char *dmabufdest1 = NULL;
6 L+ S2 a7 t0 m1 J( i6 K - char *dmabufdest2 = NULL;) b. `4 K% k- k. z
- ) e0 `: U1 B$ s" s3 V/ f* `
- static int acnt = 512;* O1 S" u/ p" T; F4 Q1 K
- static int bcnt = 8;
0 {! F# v- `* E7 b4 Q2 I f - static int ccnt = 8;
) L: Q; I2 V. ]- D: ~/ ? - / c/ {. ~+ t t4 c2 v5 L# x% n% B/ S
- module_param(acnt, int, S_IRUGO);
# ?; h ^+ I- c' T, g+ S% w - module_param(bcnt, int, S_IRUGO);
; d% X0 j( i" e& G1 s- D - module_param(ccnt, int, S_IRUGO);
复制代码 * l. d d* q- |
4 U6 @2 b$ q7 J# t0 m8 [2 J" n, a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* N& x, T$ i# `! L( ~. T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- u& C/ J* n$ P- S/ \. g8 p; i1 \+ k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 W# F3 ]/ v% q. S3 w1 k. u" N+ x w) p0 `( ^' V" m. ?
+ T+ B0 C" F! } i+ g5 i |
|