|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 r6 V" Z5 `) M& c
- [code]EDMA sample test application Q6 z" L' Q% ]# S6 n8 a/ d
- /*- L0 Z2 }, }# _; n3 K
- * edma_test.c
/ }6 z2 K7 q; w; i, ~ - *
- a8 u+ {4 t d+ h! y - * brief EDMA3 Test Application
" G$ [$ H: u, W! s - *
* S& h8 V4 L* O - * This file contains EDMA3 Test code.- h5 r* f0 ]2 Y! j
- *9 |+ n4 F; M% L3 M, y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) \7 W2 P* {. c; J; F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 a- z, h) Z7 R5 ] - * TO CHANGE.
# j0 g e/ D) B( R+ P. B7 ? - *
/ o3 e# `% T; R" ?+ y" w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 H. M" J6 p. ~: j - *! B2 X7 [0 ^& J. k: ~, F. i
- * This program is free software; you can redistribute it and/or
8 m! u5 a6 R9 i' i6 q$ p+ r - * modify it under the terms of the GNU General Public License as
m, o. V: Y8 i4 z. h* ? - * published by the Free Software Foundation version 2.8 N& S2 M r0 ]) O3 p9 L5 c U
- *
$ \. R8 Z7 ]3 h2 I, t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
e4 s2 [% l( z2 c6 u' ^ - * kind, whether express or implied; without even the implied warranty
0 z1 }$ N3 D$ B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 ^( ` r: L. i( q0 V
- * GNU General Public License for more details.
1 d9 p' e4 u. h) o - */: V9 V2 L2 g! g* j% P3 a' r" d
- $ g- d' _& n: w6 e3 U0 v
- #include <linux/module.h>! S* K# m+ g0 J2 R- A& l1 f
- #include <linux/init.h>
7 n! \ E$ o' y# P - #include <linux/errno.h>2 Q8 N1 k+ a2 G9 U2 \. s" ]
- #include <linux/types.h>
+ S9 h! B% J& N3 O - #include <linux/interrupt.h>
: |2 i& e0 L$ N! Q% G - #include <asm/io.h>& i9 z: e0 T3 I, }
- #include <linux/moduleparam.h>
: ~/ x" `5 f# N+ D# U8 p L( \5 D - #include <linux/sysctl.h>* W( I/ l) @% S7 B% e
- #include <linux/mm.h>" F" v! |8 \4 G6 v
- #include <linux/dma-mapping.h>
0 v3 F+ E& W0 n& L- i - - L4 S! V( T; x6 O2 G" ~/ x C5 Y
- #include <mach/memory.h>/ @8 m- { D4 W; u0 x
- #include <mach/hardware.h>
) k/ c9 ]+ B3 e" d - #include <mach/irqs.h>: S9 `7 f, O! N& ?3 `: S& P
- #include <asm/hardware/edma.h>
1 g6 U9 C8 \+ y' m5 C" J - , ]2 ?1 w* s0 C
- #undef EDMA3_DEBUG
4 J" o- u! p- n* h# F$ e$ b q - /*#define EDMA3_DEBUG*/- C, x$ T8 v" l4 A# o# U- ^
k; X+ d3 Z* a0 P7 Y- f. X- #ifdef EDMA3_DEBUG
3 z3 d: J6 y% [* l3 \$ f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# k" [/ e7 ~. |$ |+ q6 }3 \2 K4 d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 e5 S8 @: V( o& {6 m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 J: R- ?: l1 C& S% o
- #else5 c _5 y; }" A7 E0 F, n
- #define DMA_PRINTK( x... )3 Q, s1 Z" L0 n" I+ J
- #define DMA_FN_IN
8 H4 t4 S7 m1 G' U; l4 Q: U% I) ]; @ - #define DMA_FN_OUT
a$ J- a E( g6 _* t2 r - #endif! k' F3 S. \5 E
3 D, v5 \! e7 J& Q( h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ ?$ v6 g0 H% M" `7 Z; l
- #define STATIC_SHIFT 3- p, K( r( H1 h: P9 i: T+ x7 ]" M
- #define TCINTEN_SHIFT 20
# b# g9 J6 |" U5 i. X( I - #define ITCINTEN_SHIFT 21
; j ]0 W9 d3 f - #define TCCHEN_SHIFT 22
6 F! t& _. f" k9 J) z - #define ITCCHEN_SHIFT 23- T, L; [2 y$ F# p" K
) L* S5 c. N8 ~- static volatile int irqraised1 = 0;, b9 |( I$ c4 h0 I; n# Q7 c
- static volatile int irqraised2 = 0;
( }! {4 B* u' d/ M
" G, A% H: M; l1 \1 |- c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 y+ i, | o2 L; w9 ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, j' b; b7 ^( S. X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); u0 }% L+ t5 E$ F m
- # `/ z# T$ f9 `" x! R4 X! ~
- dma_addr_t dmaphyssrc1 = 0;
+ }' Z. h7 Y2 I/ g8 U! b0 V - dma_addr_t dmaphyssrc2 = 0;4 C1 d5 U* o n% r$ j' D. z
- dma_addr_t dmaphysdest1 = 0;
; q! u. `! Q; l' {! U8 l5 C - dma_addr_t dmaphysdest2 = 0;4 u% }7 h& u% J# a- n( z5 I
- / u$ x9 x v$ N2 E) |; L" a# K
- char *dmabufsrc1 = NULL;
' R2 F3 N) {, }8 q8 R3 O - char *dmabufsrc2 = NULL;
. E K H% K$ u. Y( T - char *dmabufdest1 = NULL;- Q; J, T3 {$ s0 } {' }6 q
- char *dmabufdest2 = NULL;
* P: n7 i/ U5 w$ u9 p( u
+ r5 Y8 a8 h0 u8 b; u) K: G- static int acnt = 512;
7 g B7 M& m) v+ N* B$ t# Y - static int bcnt = 8;/ w* Z( m! _6 Z8 U, r& s
- static int ccnt = 8;5 M, i- p* {7 x. k' Z+ L+ `4 M- ^
$ D# U" A3 e/ z/ r" f5 h- module_param(acnt, int, S_IRUGO);- r1 ^: X- ~& R4 d, h
- module_param(bcnt, int, S_IRUGO);
8 Z& ?) d6 T. Y) | - module_param(ccnt, int, S_IRUGO);
复制代码
; C, x8 g0 ]' e$ S2 n) A5 b
% b- R4 b9 K W3 e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ C1 p; n' y+ u0 e
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 t, v! H1 b( C* s* v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' T+ v- Z: T. R6 ^, |# T! r
/ P% v2 |5 S2 I5 p/ L7 x0 c5 r- x# d# r" _
|
|