|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" _$ l6 m R+ P( W0 B8 \- [code]EDMA sample test application ?) R; j) a, P4 e$ a R( f
- /*
; q6 n+ E3 v+ e6 H - * edma_test.c
9 K& G3 u5 j) x; k - *
# o- ?7 l. b) V. W; h - * brief EDMA3 Test Application
& ~, i+ ^& _: I) q \9 V0 O - *
7 N0 s9 [7 h! }- T" @( D5 r - * This file contains EDMA3 Test code.
' d6 a6 y1 b) ~, {; v7 B2 A: k& u - *7 r9 l. Q" V& o s. N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 ?. ^! ], o! Y) U7 z \$ F% _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' L7 k" y9 `' f- \7 ?" V
- * TO CHANGE., @! _; s6 B* m6 K6 Z
- *
; j% O/ _/ G9 U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- N7 S+ U; [, r; y+ }
- *4 P: Z) N8 P0 D6 M( }: ^
- * This program is free software; you can redistribute it and/or8 s2 k: n2 f, c; p" ~
- * modify it under the terms of the GNU General Public License as
5 `8 V4 f. e! a4 M# H8 T6 G - * published by the Free Software Foundation version 2.
" l: J4 v0 B$ F: Y8 K# D* ] - *
: Q7 w. A: o2 u! a8 x9 y( M5 h1 U7 A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# A, g7 d7 x& P' _: {5 ^7 ?! A- A( K8 g - * kind, whether express or implied; without even the implied warranty$ E7 _2 z: _8 m7 r, `! I8 A( J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& i$ q4 Z G" I r+ U& c0 l+ }
- * GNU General Public License for more details.
S& D+ Y: G8 x) W/ ]: u7 c - */3 \7 N* x+ v$ P2 e
7 L: A- B0 ]. D5 D- #include <linux/module.h>( }' s+ m, k% @+ l4 n. C
- #include <linux/init.h>( d) L2 y$ n1 N7 e1 }! ]2 K7 ^0 J
- #include <linux/errno.h>
2 k# \2 M$ t% b* G0 E - #include <linux/types.h>5 ?) u+ K2 b! n& ~1 m5 _
- #include <linux/interrupt.h>
+ r3 D# S, r+ A3 q* m - #include <asm/io.h>
4 R( x0 L3 Y) r3 F - #include <linux/moduleparam.h>2 w* e$ b; J2 c: A5 J- Z
- #include <linux/sysctl.h>
- s4 o) K4 B7 S3 J - #include <linux/mm.h>
! t C9 g, t m4 H2 c* O - #include <linux/dma-mapping.h>
; L4 C; | u8 Z3 I: h - 8 k4 }, L' N$ N( V- J
- #include <mach/memory.h>; {/ h9 o' C$ ~
- #include <mach/hardware.h>1 {7 M, m/ Z' E& h$ S
- #include <mach/irqs.h>
- i1 S) i3 f7 P - #include <asm/hardware/edma.h>
5 h* t" o4 N# m8 }$ k
: |+ G; ?8 W1 B1 Y' n( X& J- #undef EDMA3_DEBUG
: R& C7 Q: c/ e, J2 w0 f1 ^ - /*#define EDMA3_DEBUG*/9 b; F- v2 w' l
# V: _% }6 a, \" \- #ifdef EDMA3_DEBUG
8 S8 [, I q( V8 C! U/ Y9 M1 R0 u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, m9 M# X4 N( ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. H: f! ~( ?0 x& r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, D! E5 t0 v1 Y - #else. J, I6 d3 V4 T4 [
- #define DMA_PRINTK( x... )+ C. D' F4 e; q/ X
- #define DMA_FN_IN
) y J U2 p, k. B6 c - #define DMA_FN_OUT. p9 A' Z9 W% E( T5 }
- #endif
' |5 k) c1 A$ [
1 y3 o7 I( j! H1 X0 T' g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 K. x5 G C j4 \. F - #define STATIC_SHIFT 35 S9 m( i1 z* u% j1 {5 b
- #define TCINTEN_SHIFT 20
2 m" b- a! l" b& Z; u9 `& ^7 _) i" _ - #define ITCINTEN_SHIFT 21
% Y7 l. n% k" X" e- ]* L3 B - #define TCCHEN_SHIFT 22
. }$ |" w# M1 i8 u$ e: N- i - #define ITCCHEN_SHIFT 23
% o* S/ g- v1 ?% u - & M. ]+ u( A8 E4 v
- static volatile int irqraised1 = 0;
' ^9 Q) z' I5 _9 o$ q( }+ _ - static volatile int irqraised2 = 0;' q8 i0 [$ J8 m0 L4 d7 l/ X6 q: {
% H7 C4 L7 H1 |: r, r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 D j1 z" x3 c: c) b/ _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ T# W: k; J. y: O5 d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ r0 Z [% s. s9 ~) `3 K& j - ' X9 W9 l9 n4 P: F
- dma_addr_t dmaphyssrc1 = 0;
6 t. ^" @4 v1 u* `% A& @6 Q! z# Y - dma_addr_t dmaphyssrc2 = 0;; G/ j: h% V5 X# C; @
- dma_addr_t dmaphysdest1 = 0;6 |) T* @8 d# C+ m6 ~7 Y
- dma_addr_t dmaphysdest2 = 0;3 u+ J) {8 p2 n& J' o
- $ f" p4 Q, @" `
- char *dmabufsrc1 = NULL;
+ S# a! X( G, d1 }. W* e - char *dmabufsrc2 = NULL;
% g4 M, \& @) p5 }: R& E - char *dmabufdest1 = NULL;8 Z# ~2 d3 z1 |9 G# r6 a" P Y+ `. g
- char *dmabufdest2 = NULL;
1 h3 M# o- B b% S1 ?3 u y) { - ' r* v. ?- B7 g" s
- static int acnt = 512;
& F& u) }! T! }6 h* ?+ \ - static int bcnt = 8;
- K' i8 E' m* \! V# x: e* m - static int ccnt = 8;
4 k; G8 N( H- o8 A4 S- b
8 G' U; I. w1 q4 {; B- module_param(acnt, int, S_IRUGO);' p+ z5 ]& i) l1 N1 X
- module_param(bcnt, int, S_IRUGO);
, z) j. f- ~9 F& T6 ^9 U% E: G - module_param(ccnt, int, S_IRUGO);
复制代码
4 ^4 y. l2 i/ ~7 i- z) W8 ~ E( N% l; r- y# c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. l. Z$ K1 M! Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, \& D6 j1 w; D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, R1 s4 m- f# c9 p& u6 ?
+ }/ q. U9 ]' f0 [' i* e0 o' D! p! g- n, `
|
|