|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 \/ J) m0 ]+ J3 z# e6 x! @5 ]
- [code]EDMA sample test application: A, I- T' l% @
- /*; p/ ^3 z1 E' y$ |8 l- P% w
- * edma_test.c
- k! y' X( H! e) }* h - *, i9 }! B5 C( }" |
- * brief EDMA3 Test Application; ` X+ q* |6 l8 w2 F8 w& o
- *9 T& E) p4 j* o$ t. \; @
- * This file contains EDMA3 Test code.; s+ M! ?+ z4 V% W& I) M" G8 s* {& s4 p% A
- *& _5 x3 L0 i% |! C. x, x- B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 g, T2 l6 R5 w; H; B% z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ X/ ]0 G1 a7 C" N% `, j - * TO CHANGE.
: @5 T. I- j$ A0 w0 Z. Z - *9 w) H7 U4 s4 a7 @8 z. @ `4 j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- j0 o) u. y" |4 F+ Y d - *
1 V& D; q3 m$ G5 a2 F - * This program is free software; you can redistribute it and/or
* y, L p4 ~9 |7 X3 q" a - * modify it under the terms of the GNU General Public License as
) [! X, ^/ g, @' x$ }6 x4 L - * published by the Free Software Foundation version 2.
9 l1 E6 x( i( l, s% R/ f/ K - *
) {2 h( i8 t* X9 q6 L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. r; Z$ k+ z6 }, k. V$ u
- * kind, whether express or implied; without even the implied warranty( C2 b8 ~' {! D& C7 Q( j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& B1 A" \0 S1 ]! }& T) O - * GNU General Public License for more details.7 q( G$ @7 S. j! v, \
- */
6 V4 t6 X4 n. ]% Y- h8 `1 | - 6 L4 R. Y. m3 p# N( _
- #include <linux/module.h>
, m6 \0 q# [( Q; L - #include <linux/init.h>
$ w$ F7 l9 `) |* R - #include <linux/errno.h>8 U" K6 y% e2 R
- #include <linux/types.h>& d) P( e! S7 ?2 A% m
- #include <linux/interrupt.h>
+ _9 a" \5 A+ N/ W3 B) r - #include <asm/io.h>/ \) ^7 J1 E5 b3 l( W+ E( ]
- #include <linux/moduleparam.h>
- i& A Z5 M( w7 ^5 y - #include <linux/sysctl.h>9 o# J6 d5 g1 j# ^" e
- #include <linux/mm.h>2 S1 X$ R& e/ A- ^+ A9 z3 Q
- #include <linux/dma-mapping.h>3 i* c' f8 v5 g6 U
* y% I& v3 \. t- #include <mach/memory.h>$ ] r6 P$ _) I; D1 p' B
- #include <mach/hardware.h>
& Y% W4 {8 z$ j - #include <mach/irqs.h>
- \, C: e/ J/ s2 } - #include <asm/hardware/edma.h>2 }2 u' ~ m" @
- # M& T$ [8 {, n; R- b
- #undef EDMA3_DEBUG5 V8 }# Q) Y: W5 t% N) p
- /*#define EDMA3_DEBUG*/
% M' b0 ]7 s, e2 R' E8 O - $ b2 v0 K v" k: L
- #ifdef EDMA3_DEBUG' ]' t4 C* Y0 J' |: }; h+ o4 W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 p4 `1 ~2 V5 T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 m* m( s s9 v, ?- i+ q& ]2 Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ C/ n' s/ Y5 d, H9 n/ H1 H9 D - #else
- r& a) C+ W- P/ I; Q" u A* g - #define DMA_PRINTK( x... )# p6 W) S; J( k: n" f/ w
- #define DMA_FN_IN: x2 _" O; a. I0 j! O5 e- k
- #define DMA_FN_OUT. z3 }2 K( D$ g# `/ `3 D. @0 I
- #endif6 i" V2 g" {; @9 x# P" d
- 8 e3 _( C" L* D- W2 f& m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* _6 t* J$ G9 g% |# ^" O; W- ]+ F - #define STATIC_SHIFT 3' R# E) A" x5 L+ [
- #define TCINTEN_SHIFT 20
: n# }0 g0 P H; _8 k6 j! Z h; e - #define ITCINTEN_SHIFT 21. C6 H( i* b: V# h
- #define TCCHEN_SHIFT 22 g1 }5 F' G6 ?, X
- #define ITCCHEN_SHIFT 23' M2 ?3 E+ H8 a( Q7 Y
- 5 a8 k/ `* S* O+ ]" w4 o- m
- static volatile int irqraised1 = 0;; F- W$ U# p, @: d* `
- static volatile int irqraised2 = 0;
/ V6 j' j% ^; N; o& O: b4 } - + F. Q$ _ U$ G" c! Q, {6 E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ H) A! n; C0 d0 G- v- b, m, U. |! r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& y# t; W2 J G$ R4 \" L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ z1 G5 M9 j+ Y% b& e+ @' }
, }+ @ ~4 d( u/ ]) V. i7 D- dma_addr_t dmaphyssrc1 = 0;
+ p2 e+ J4 _. D" N6 M - dma_addr_t dmaphyssrc2 = 0;
: q5 I/ J8 _' V- r8 U - dma_addr_t dmaphysdest1 = 0;
$ d6 j( C. r0 ]7 L7 R* l& U( l - dma_addr_t dmaphysdest2 = 0;+ s2 _! v- l& `3 ?
/ y8 C l, t8 Q& s. C( `- char *dmabufsrc1 = NULL;
7 m0 m. c! [. v1 b& E7 |1 p5 O4 B. E* P5 d8 u - char *dmabufsrc2 = NULL;! b) K9 k* A, @1 S8 t* F" D, u( I
- char *dmabufdest1 = NULL;
' `; {7 |' R/ y$ e- u - char *dmabufdest2 = NULL;
0 `# S) c- K( s7 J9 P" u: I, f$ a
! _& t3 l# F9 X j* \" `- static int acnt = 512;3 t3 [' m0 N8 F3 ?- ?
- static int bcnt = 8;
; W8 O* n6 b( q( D3 Y - static int ccnt = 8;) E* X% r; r. T
- * c) t. n- C$ o( r3 S+ H
- module_param(acnt, int, S_IRUGO);- E+ [3 N# { v9 O
- module_param(bcnt, int, S_IRUGO);# d# J6 s7 s0 I9 a
- module_param(ccnt, int, S_IRUGO);
复制代码
% ^& Q4 q7 S* {* f0 g8 Q
+ Z+ ^$ U" M& J+ ] l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; y ~# p' K2 [; h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 Z: n4 K( n% U$ F& Q3 Y! D/ q+ N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 Z i% l0 w5 i9 ]% c1 D7 L( j+ X
" v' J' d6 Q" ]% i" s, D% M; Q% w( H2 @3 O
|
|