|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 b$ N/ S5 P* D% w+ V% y8 H- [code]EDMA sample test application& T$ M8 ^1 v, E! k2 u7 x1 r5 P
- /*: E- S* m" e8 V. r0 p7 X: `
- * edma_test.c
. b' u" U8 Q$ b - *
a$ p4 \/ t9 c1 y* E - * brief EDMA3 Test Application
. b Q# p5 W, \7 n- W - *
) |/ s, k4 f0 `, [* \8 ? - * This file contains EDMA3 Test code.
$ V4 M' x+ A) |$ U+ {1 d - *5 q3 f3 e$ X/ ?7 v v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 P5 ^' s$ m7 X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ I S9 `) B# F! _3 p8 N - * TO CHANGE.
. W& m) F' {9 ]/ X: c4 N+ P - *- |' e& u# H" }7 N+ ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' m9 x8 K- y) Z: H Q5 M) U
- *8 C, B5 [8 c. b8 g. i
- * This program is free software; you can redistribute it and/or g" ]/ e" D( n
- * modify it under the terms of the GNU General Public License as" F" b9 u2 d$ G" h. n, j
- * published by the Free Software Foundation version 2.* ?( H$ ]6 D# }' C0 a
- *. ^3 E6 a. O4 u( h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ E) [7 I6 l# [6 h - * kind, whether express or implied; without even the implied warranty
' i3 G" ]# b! v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ R2 C N+ t. d( @( b) d - * GNU General Public License for more details./ D7 Q2 X$ M3 b9 S* Q
- */
3 Z' S. x1 t8 h6 \2 y - ( L* U3 w! `6 \6 y8 I: [
- #include <linux/module.h>
6 n% Z/ j& {3 H* ^: D - #include <linux/init.h>* a/ }$ `3 O4 Q
- #include <linux/errno.h>
0 S/ O6 d, R( s9 [4 B5 K% p - #include <linux/types.h>
0 ^4 y) D4 J6 Q# l - #include <linux/interrupt.h>% [) i# i5 w: m- y
- #include <asm/io.h>; z; f1 s; Q' k1 h0 @
- #include <linux/moduleparam.h>
' D; S5 A* n) e7 v - #include <linux/sysctl.h>
( @& d- x: x' p: I( o% y5 Y - #include <linux/mm.h>. M* P: e( R0 V7 @. \8 z- n
- #include <linux/dma-mapping.h>
5 g Y) ^; v7 z" f O - 5 C$ Y: ^1 P" ~5 w: o* V
- #include <mach/memory.h>/ T4 W7 N; S4 _( S8 V; x2 S; ]" R* I
- #include <mach/hardware.h>4 S' a' d& u* e2 c' H& A. U; ~
- #include <mach/irqs.h>$ n9 _; A( D. @- Z; q% e
- #include <asm/hardware/edma.h>: ~3 a0 t5 }! }
% ~- `8 x3 P$ v- #undef EDMA3_DEBUG. }. q( \. O9 r6 @: y
- /*#define EDMA3_DEBUG*/
2 t% d5 z) g3 r$ {6 G Z - ; _* \& |. ?0 o. A
- #ifdef EDMA3_DEBUG
+ O" E. H- @! F0 U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ w6 G; K$ y5 n* f+ I3 N6 J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" C. J9 }# A. C& r! G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" T. h8 E; M* J9 l) v3 c ^1 h- ? - #else7 \, g& L* m! b' D
- #define DMA_PRINTK( x... )
1 ~$ x% H2 N" C3 r2 R2 `( {. I3 k. h, q - #define DMA_FN_IN/ ?" _' P8 X5 J( Y2 \
- #define DMA_FN_OUT
6 p$ Y3 O5 R7 F5 X/ {" p - #endif
/ V6 @' X( i. Z7 k: V
+ P C1 N) {7 S+ V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ t9 f0 L1 ?' A6 _+ I R/ W - #define STATIC_SHIFT 3! ]& D% S+ C' _ L" @. V
- #define TCINTEN_SHIFT 20( t* L, f$ _( v5 ^' J8 e
- #define ITCINTEN_SHIFT 21/ @5 h* R* z$ M$ f, A6 ]
- #define TCCHEN_SHIFT 22
9 O, R' U" L: O - #define ITCCHEN_SHIFT 23
. [5 [& }0 j1 D. V8 M - - k2 y" z' [6 F# E- x6 V0 J
- static volatile int irqraised1 = 0;7 _2 N* n" g3 R; Y& k; K
- static volatile int irqraised2 = 0; N' |/ H# N P* ^, J
- 2 G( p' w* v# w- D* A0 b$ \$ j1 l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 \( a) _: k6 h# ^/ Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; v% b2 o, \1 A# {" L& f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, M: u4 K2 H8 m0 S* u% k - 4 e6 o {% b& u
- dma_addr_t dmaphyssrc1 = 0;# w0 W- q8 K4 ^! J
- dma_addr_t dmaphyssrc2 = 0;0 K& x% x) m2 w1 s
- dma_addr_t dmaphysdest1 = 0;
" G# u/ v' S b9 L/ S, n) T - dma_addr_t dmaphysdest2 = 0;
. L8 N. C" N* l# s
9 L# {. c. i Z6 j- char *dmabufsrc1 = NULL;
0 A1 V+ x! W0 _: I6 A) P+ x. U5 R - char *dmabufsrc2 = NULL;4 @( m0 Q% P. Y$ b
- char *dmabufdest1 = NULL;7 I, C$ M0 ^0 X4 j1 P9 a' }
- char *dmabufdest2 = NULL;% w# A2 V% ^$ B t# p1 |
6 Y0 f8 _* W7 |1 D( R/ S% z- N9 I- static int acnt = 512;
8 |8 O$ y/ {4 N5 B - static int bcnt = 8;( y1 d' ~" }9 _5 V+ o
- static int ccnt = 8;* m. E M2 S: C% g( I
. d+ A4 y3 a6 e# ]6 ]- ]/ E. U- module_param(acnt, int, S_IRUGO);# ^! }1 J6 Q1 \. }# {; ^0 i2 Q$ v
- module_param(bcnt, int, S_IRUGO);) P/ f. t0 Q K+ b# c) q
- module_param(ccnt, int, S_IRUGO);
复制代码
( _( L, a/ z# @" I7 t* y
- q4 l7 `, n, C9 f9 R1 m& x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& K+ G" S! V" p2 \ _( j6 g' F- F
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 N7 w1 D/ C0 Z/ ^4 b4 X( j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! s' F7 F' Z% z+ l2 a2 j
$ n; a: |& C8 Y
$ D& t! m' p T% M' e' t5 A4 ` |
|