|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , T5 @- A7 e( k0 v6 h, Z
- [code]EDMA sample test application8 P7 o: l. ?' C! `. e8 z2 d! x
- /*! u& d+ T. r) f- M& W# ?' W
- * edma_test.c) y: R- {. S+ O. R; u$ F/ R
- *
8 F: n2 F: ` V0 H. E; x - * brief EDMA3 Test Application. n+ s. z# ^* y" m. K
- *
& K# r1 Y8 g! L1 k, P6 I4 H - * This file contains EDMA3 Test code.
/ \# X% `( n3 Q- k8 n2 _ - *
' _, G b4 u/ D. V9 x: W/ m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# Y6 s' ?* ^+ m# P* A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& s; R/ U& D9 { [9 z/ e& q
- * TO CHANGE.
1 J& x3 M) Z v6 T U - *8 z' i8 v5 R' C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 L* U$ h: F% G7 A7 ]5 {7 {
- *
. H# N" g! }2 T% a - * This program is free software; you can redistribute it and/or2 z4 C: |& k# I4 b5 y" ~, m2 W ~
- * modify it under the terms of the GNU General Public License as
" I+ v5 u) y, W - * published by the Free Software Foundation version 2.
- i( H5 A# \: d$ _& M* o - *# N" W# v0 X7 K [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" o; n2 I; [; L# [+ V- F, K) p
- * kind, whether express or implied; without even the implied warranty5 [9 ^; |0 L, p; k+ a7 A% h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 `2 s. D0 s8 t6 ]1 p, b
- * GNU General Public License for more details.
9 C7 r( K* R( O, V: O8 r/ G5 g; F - */3 V5 e1 u8 H+ r, I% D9 b* i
$ ~8 k0 T. o" W3 \2 T0 G- #include <linux/module.h> O8 E( @1 }6 e! c9 [3 j
- #include <linux/init.h>, {. a ?* H% ?) E6 l% ^9 K
- #include <linux/errno.h>( F2 R. i: X& j% }5 T0 k& L
- #include <linux/types.h>" p6 D# @6 S9 I. n
- #include <linux/interrupt.h>& y) E& i8 i$ K: ~3 x# @; q/ X# S4 W
- #include <asm/io.h>
+ |& J/ e# F8 q$ Q0 p* P& z - #include <linux/moduleparam.h>+ E0 v% @$ I& Y7 v4 i9 f
- #include <linux/sysctl.h>/ s& P2 N. Z6 \) Z5 l- s4 e3 } @
- #include <linux/mm.h>; I3 [% A( x0 c) N6 v+ j0 w c
- #include <linux/dma-mapping.h>
. y* r& ~; n, j
* i: G: q$ A2 X" I' c2 I9 O' ^- #include <mach/memory.h>' w! q/ i: v% M0 u5 j
- #include <mach/hardware.h>
1 r; i* v1 f% V. T; x - #include <mach/irqs.h>
H) j5 Q" P) o' Z* t - #include <asm/hardware/edma.h>
; A0 n! ?, F B/ ^9 A/ ? - + S( X- ?8 d, W H
- #undef EDMA3_DEBUG! P% v }7 `, U2 {
- /*#define EDMA3_DEBUG*/
h! l% K- a( A - * t6 i. n2 `, _2 E7 D5 }1 M- P
- #ifdef EDMA3_DEBUG$ X# }1 V- j0 \& B% B7 {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 [3 S4 b0 v# ]! a% e9 e* P' [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, O# O2 W( k( }2 e+ N6 o; j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 \7 Y7 b9 ^! m$ O* a. t - #else
" s- R: x5 \8 H2 K- M+ @1 }5 N - #define DMA_PRINTK( x... )
& D+ z% R. C- M) R8 ?/ b' i* h - #define DMA_FN_IN; E# p9 L9 ~; ?4 b
- #define DMA_FN_OUT
m5 H" @% z$ H0 X - #endif
. `# Q( M% `8 P# V* w/ C9 S" u
7 D* G% C5 j- L! g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* c( H$ W3 E2 ?/ ^! l% W - #define STATIC_SHIFT 3( @6 H/ L$ e$ C2 J5 @* f
- #define TCINTEN_SHIFT 20& D7 E+ D! X4 V/ o+ j2 E6 o5 h
- #define ITCINTEN_SHIFT 21
1 L2 f. f* K6 t$ i/ v - #define TCCHEN_SHIFT 223 Q" B" o7 s7 d9 T. Q ?
- #define ITCCHEN_SHIFT 23; p' B( Q- [7 N
# o* e8 t4 s0 }/ z$ f: Q- static volatile int irqraised1 = 0;
2 I$ |! s, F5 T5 I/ J& f n4 E - static volatile int irqraised2 = 0;
3 w% s% Z8 \% S) [" Z - ( c5 l- ]+ Q( C7 G& s2 h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 w* o& U5 l, m/ r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' \" p# S; ]/ V+ m5 f" c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 A C" W4 q9 K
- 6 M9 O1 d# s/ v1 {$ ~% R- L' ]
- dma_addr_t dmaphyssrc1 = 0;+ i6 b1 e* z1 u ~
- dma_addr_t dmaphyssrc2 = 0;
" e4 W) P( t9 j* ~' G3 O" v$ d - dma_addr_t dmaphysdest1 = 0;9 x( ]* ^7 }7 `9 R, ~# I
- dma_addr_t dmaphysdest2 = 0;0 ]2 G8 Y& f4 _! J2 i# t
) C5 h2 d1 A5 h8 n) s" P- char *dmabufsrc1 = NULL;! x) B! s K* ?5 r a: B K; ~
- char *dmabufsrc2 = NULL;/ _& N/ F ~. @3 f; n9 o& h
- char *dmabufdest1 = NULL;
( P" [7 S' v6 g# |. B' Z6 ^ - char *dmabufdest2 = NULL;; |# F9 \; |* A
- " ` t7 }; O7 J* k5 v6 A$ s; B$ k
- static int acnt = 512;) S3 k7 Y/ P. V9 i% L5 p
- static int bcnt = 8;
7 l2 Q9 D, n5 x: ?8 k$ F9 @ - static int ccnt = 8;
& a- x4 H( l- E
a& ^- M" i# f2 t7 `( k5 ]- module_param(acnt, int, S_IRUGO);
0 W2 j5 ?3 G5 N9 ~, o - module_param(bcnt, int, S_IRUGO);$ ~( P1 v1 O9 {+ i( Y
- module_param(ccnt, int, S_IRUGO);
复制代码 9 W9 b9 I! S! X' r
& D' {, F. q i% x" S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' d n# I4 n# {, S5 Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) Y% j1 J1 E9 k2 K. ]& L+ P6 R# n) I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 C0 _: U. | O: G7 y/ w+ R
& ~8 d: a3 Z2 k+ l% g8 H- N. Q% T, [0 Z
|
|