|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ d; v- s0 z* d6 H5 t0 P: E- [code]EDMA sample test application
9 w# r" ~+ {2 n. K: c - /*7 }! q- @* _1 l, U- P- t5 x4 p
- * edma_test.c/ k, m% K6 o' g" h. O( P% m! n4 z
- *' i" D! ~3 G9 ?0 s
- * brief EDMA3 Test Application
4 E: Y- \% T, C - *) V9 D6 T; N* p
- * This file contains EDMA3 Test code.
. z5 l% Y& f8 Y1 N3 x( ^+ } - *
! t! e% F: D. L @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ h- U3 i* z% a" d9 M* s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ I3 j l+ ?2 Y8 _, C. I9 z$ j$ }
- * TO CHANGE.
. R1 [+ l, a2 V6 x n. r - *
8 l- e7 _, l0 y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 j8 W& I6 p% r+ ?; O( n/ V* w1 F& L
- *( C! l7 _) l) X9 |) I
- * This program is free software; you can redistribute it and/or
0 R8 d2 A+ S8 Z+ V" i- C4 j/ c - * modify it under the terms of the GNU General Public License as" h2 n0 N- w. c, h
- * published by the Free Software Foundation version 2.
% Z1 t% z3 j" ]; s! ?5 B - *
l( @, ]9 Y8 T; ?9 F5 K" B; F) K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 R: P4 B4 @" [6 W) i8 J% ^
- * kind, whether express or implied; without even the implied warranty
, g1 w, O! `0 H$ p" ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& a+ [. }0 D4 ~& v3 C* ?
- * GNU General Public License for more details.# p; Z! ^6 V+ P. v# n6 }
- */
& b; t4 u* M! h, Q& e- L- t: M
+ ]2 l$ _ @: ]- #include <linux/module.h>
; P! z/ P$ S/ N5 a( ^ - #include <linux/init.h>: t, ^$ S& E6 |
- #include <linux/errno.h>
! w# b4 T' M8 v. S Q+ I& G - #include <linux/types.h> y5 ~; W+ s L* M1 o' [
- #include <linux/interrupt.h>+ e5 [) b1 M: k4 z- g3 h
- #include <asm/io.h>
% ~/ ^4 u6 J/ B- R% c - #include <linux/moduleparam.h>; G3 O2 C2 ^5 b. ?" h1 ^5 p2 {
- #include <linux/sysctl.h>
& r5 J H6 @* p0 Y! J( n8 K - #include <linux/mm.h>8 H0 O2 C* b+ S+ n/ S2 f; u
- #include <linux/dma-mapping.h>" `8 f/ c7 g! Z; V& e$ G) L
- / ~$ g3 S0 Q% C% M5 f
- #include <mach/memory.h>7 c; a, g* v @3 f
- #include <mach/hardware.h>% H1 G5 G/ ?0 {2 x
- #include <mach/irqs.h>
8 ~8 K; [2 b7 [/ v" P, R - #include <asm/hardware/edma.h>
! x0 O. u* G9 I; o- ~3 l - 4 D9 a9 @2 y( M0 r( ~
- #undef EDMA3_DEBUG0 D2 q6 k- \" c1 a4 q! F2 s6 {
- /*#define EDMA3_DEBUG*/9 w7 q6 L3 I- F
" \, i( ?) Z% j' F; Q. Q# Z- #ifdef EDMA3_DEBUG
6 ^! F+ k1 x X3 M9 o) Y& w2 O( c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 f a; L( _& g1 D' b/ r! U" w, p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& ^0 X: @. @- F) Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. t: M* X/ F2 H# ^1 w: f# e - #else" a1 N& K' j: r/ C
- #define DMA_PRINTK( x... )# R; p$ T2 Q9 P, B v
- #define DMA_FN_IN
/ L: l$ a0 E# o }" ]$ F/ e2 |2 _ - #define DMA_FN_OUT
/ G! y) T# U4 V3 W7 V - #endif
9 m, m) T6 }& d# R! t
; l$ J5 L3 G6 G+ ^1 {5 T. e; v* c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* Z/ L* P# ]: i8 w7 H
- #define STATIC_SHIFT 3
8 T# D$ O9 R: n2 y$ M8 k - #define TCINTEN_SHIFT 205 d! H/ F$ v$ i
- #define ITCINTEN_SHIFT 21
9 K; j4 q3 c9 r0 ]3 x - #define TCCHEN_SHIFT 22
v% c/ n6 S0 P- J, _ - #define ITCCHEN_SHIFT 23" `' x. Y5 S2 y: j5 G1 C3 D/ X
+ n* y3 ^! x0 j( H% \0 G. D! H) ]. z- static volatile int irqraised1 = 0;/ O5 _. W0 N5 b" J8 C h
- static volatile int irqraised2 = 0;* \. w* w! P6 C ]
- / W2 B; t3 \8 T- h+ v! k! F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. W% m/ Q! m- |) j& _0 w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# }8 }4 @9 v" g- b# e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% l+ F/ r" Y. s6 l% T
, }4 U! a9 P2 Q2 _- dma_addr_t dmaphyssrc1 = 0;# \% }2 j$ R" f4 J8 t5 b
- dma_addr_t dmaphyssrc2 = 0;
1 O% n2 i0 I: ]& Z8 K5 d% A l - dma_addr_t dmaphysdest1 = 0;
" \7 C" X# i! S9 r- n, C- [ - dma_addr_t dmaphysdest2 = 0;0 X# f! J8 w' b1 z* C! B
4 O, o* ^# j0 _. ^! h n- char *dmabufsrc1 = NULL;. S4 W- J6 v3 p- @# B- z6 W
- char *dmabufsrc2 = NULL;; r6 E; C# {# x# P4 r9 l2 o
- char *dmabufdest1 = NULL;
: |& _, k+ O9 Q1 ?7 c* @ - char *dmabufdest2 = NULL;
% f+ q ~4 |1 [' O5 t9 Y - + g7 Y" _, u, p
- static int acnt = 512; ?3 }; {# `% n/ `3 k( V
- static int bcnt = 8;
4 g5 L& j9 N( Y# s7 K6 P - static int ccnt = 8;
' x9 ~' @; R2 v7 L4 D
7 f. k7 \& f7 n3 x/ }8 w- module_param(acnt, int, S_IRUGO);' r& L$ [- P' \1 c$ W
- module_param(bcnt, int, S_IRUGO);
/ s9 f, h3 p7 Y( m( @ - module_param(ccnt, int, S_IRUGO);
复制代码
. l* @3 h" s2 T: \+ M; n7 r$ D! @' m7 B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" E; _2 n1 H/ H1 S+ N- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# D* @7 @- }+ J6 c/ ?; m, m! R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 g5 H( `* N Z$ p {' G2 E7 P7 w3 [9 k7 g
- `" d8 L- N; I/ f! F/ b& h
|
|