|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . e6 V& N5 M9 O; W- v. {
- [code]EDMA sample test application" [: h: G6 Q' u) x
- /*& c% X6 |8 i1 b n0 r
- * edma_test.c7 s4 U+ w" [. G3 g3 ^) A
- *9 u. z9 |' G% Q1 Q3 h$ u
- * brief EDMA3 Test Application
7 r& l+ C6 L6 r- ^/ @3 n - *
/ }' p0 K, |2 I- J - * This file contains EDMA3 Test code. f: g2 s) c6 P' u# I
- *9 z; l5 R7 f) L& w) t4 b) A6 I4 |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& Z' r2 t5 k7 D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% F/ V% d- d9 w5 a' c4 G" j, u
- * TO CHANGE.
* @9 [5 l; v9 R - *& z8 c) h$ F0 R7 ?7 ^1 n- c6 }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' B5 ~8 a4 h( f1 m, D( P) S
- *
( ]) |. S4 ^" d1 S8 H - * This program is free software; you can redistribute it and/or i/ Y8 ^1 N! ^& X
- * modify it under the terms of the GNU General Public License as
: e2 q' H( ]5 C% W9 N, f; ^ - * published by the Free Software Foundation version 2.
( x5 P5 l) x* X - *
# Z6 h) n n& T* H0 P2 Z0 o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* t3 h9 `% m( D: J0 J/ C$ I. P
- * kind, whether express or implied; without even the implied warranty2 L4 L8 W9 u! G. ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& C+ u+ W( f) k# G - * GNU General Public License for more details.
n2 X" f0 J6 y- i2 Q4 V {0 n - */$ r# f- `9 \2 \7 R5 C% s3 |& K+ ?
( ? D5 k, D$ ?% U3 Y- #include <linux/module.h>- p; z& ]" E" g' A
- #include <linux/init.h>4 H$ Z# o# y" k D" M8 J
- #include <linux/errno.h>6 B* t" t5 G6 j' I
- #include <linux/types.h>: O6 o. a7 j3 S" O5 j
- #include <linux/interrupt.h>
1 G8 s& m6 C& e - #include <asm/io.h>! j) c3 o" o+ F7 B' @3 d0 Z
- #include <linux/moduleparam.h>( R1 U) j7 G+ u6 S" e. S
- #include <linux/sysctl.h>
7 {9 x/ ~* l J: j1 L$ G; s7 s - #include <linux/mm.h>
, e5 |' ~( H5 ~6 l8 g, h - #include <linux/dma-mapping.h>
' _; s) t3 j5 k* m - + W4 ^4 D9 ~ A9 h) { _$ f1 k
- #include <mach/memory.h>! \# C; [: k7 w/ | o
- #include <mach/hardware.h>
3 y: w% ^* S# H ^9 i! r. b - #include <mach/irqs.h>
. j# k. N; H4 f0 k - #include <asm/hardware/edma.h>
0 e' P9 x3 W* ]9 C - ; v9 `3 g6 u l* }* M3 ]- z( c/ W8 E
- #undef EDMA3_DEBUG5 Y& P4 w8 A9 K
- /*#define EDMA3_DEBUG*/1 @' T- a4 Q8 ^4 L" I6 a( t
- 4 O! L3 u+ w; X' P) ~+ Z
- #ifdef EDMA3_DEBUG& S- U! t9 J- ?+ t% Y! ]+ {) x9 h8 T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 Q X7 f4 b+ M- P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 [" L9 u- f% t4 i" A* k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 e- {$ p- b* W2 J$ `" S - #else
I6 L$ A( D! g( b2 g6 W- I - #define DMA_PRINTK( x... )- [' I" B9 m, F$ k' P0 }
- #define DMA_FN_IN
( L( y' a Y6 y& d1 t- ` - #define DMA_FN_OUT
- k" `* k$ P d' k, |% G6 q - #endif- U, F0 E3 m g0 N3 e+ e2 |+ E3 a
- ; z/ z! l# `5 t" G& {" n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 S8 Q3 ~3 }3 ^% q8 |: R/ B/ O
- #define STATIC_SHIFT 3 o, w F6 O* H# _
- #define TCINTEN_SHIFT 209 Y1 w* L& l/ c! ^& t
- #define ITCINTEN_SHIFT 21
8 [. o, O' B# |. ?5 w& I1 b" T - #define TCCHEN_SHIFT 22% H) u2 S) I5 t9 h6 M: d5 S" k
- #define ITCCHEN_SHIFT 23
1 U( j& {" I5 ~7 d4 L o9 H
! V2 t! A# e# Y! o- static volatile int irqraised1 = 0;
! R( c6 F& u8 Z) [* I5 S! o - static volatile int irqraised2 = 0;( x' \5 H" a& F9 N8 a2 A
% ~4 j" E, J5 @" R8 Z% u9 G. i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; i( o o6 k$ S x4 k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. N+ g+ t2 u1 S8 D4 L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Q' Q% ]9 ?) \7 e" B
* U! T7 t& K& m" [7 ^7 L- dma_addr_t dmaphyssrc1 = 0;
2 u/ t& A! x% V) y9 G - dma_addr_t dmaphyssrc2 = 0;) W+ Q+ `0 K; p
- dma_addr_t dmaphysdest1 = 0;
8 |, f% w0 M5 `, r. E) g - dma_addr_t dmaphysdest2 = 0;6 B8 f! z2 ]( Q |* [' s x
- 2 z7 C1 X+ U* T( D( T/ I5 U9 u
- char *dmabufsrc1 = NULL;, P6 l* F( N3 ^" q- ~+ D
- char *dmabufsrc2 = NULL;+ E4 G% M4 O, E' k4 n
- char *dmabufdest1 = NULL;* @2 s9 c8 Y- ~: _) u
- char *dmabufdest2 = NULL;
4 B- D6 N5 v& d. @' k7 e2 i
8 M, e' q9 S, \) k+ l; I- static int acnt = 512;% r# t/ \8 y+ ?
- static int bcnt = 8;' }& q9 L0 E# g! V
- static int ccnt = 8;1 n+ l9 L' {) @; r( S
- 5 `5 | ~: F7 j5 @( }, h
- module_param(acnt, int, S_IRUGO);3 e) ~8 h+ [2 {6 X* `4 K
- module_param(bcnt, int, S_IRUGO);
) b' R W3 m& Z! c2 b4 [ - module_param(ccnt, int, S_IRUGO);
复制代码
6 G3 v0 L! K! z Z Y* T( f" [2 x8 @! a: _9 M- a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# r& d: }9 B. U3 Q* g 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- D" Y6 t, R; l. E4 l* E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! X; S. ~$ H; T& f# O
/ B/ }/ A8 e) j' \, q/ m4 H
( B8 x% w2 {( h9 s; z1 s, M |
|