|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 }: [% `: o# J$ _
- [code]EDMA sample test application3 ]% p4 b* V' }/ N. F7 v, w4 B
- /*& t! k- W9 g- }
- * edma_test.c6 y9 y1 C- y' Z# z7 [- b9 p$ T
- *
& G! E) I) D' b% W4 ^# N - * brief EDMA3 Test Application6 C1 i: x7 }( T; G- r
- *; h" z- T7 R: H3 U
- * This file contains EDMA3 Test code.; s2 J& w2 e! A, @: d7 N
- *1 Q. C4 ]* c* `) W' _) J! ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) P! Q k; E4 g% q1 ^8 [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 O& B0 d6 }; t b8 n) H' m
- * TO CHANGE.$ N9 m& E7 u0 C! }% j, k5 o
- *! S9 }6 l8 J# o- |- ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ E# f; I7 Z+ w* K - *
7 V5 Y8 {& |1 i5 J+ U { - * This program is free software; you can redistribute it and/or
% C2 h9 \# i1 ?- A& @5 a - * modify it under the terms of the GNU General Public License as) |0 Z* S+ b; L; r: @" Y4 m
- * published by the Free Software Foundation version 2.; p# o8 [1 y9 o+ V
- *7 p; p: M% a5 Y& [% m2 \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 A" J% \& f2 U' c - * kind, whether express or implied; without even the implied warranty
! k3 G$ \% K& I# H! R: `2 y- k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! p8 S5 f9 s$ a' F1 \( g u, F
- * GNU General Public License for more details.# `+ u3 r1 o" x: E+ V/ F0 T9 ?
- */
Z4 B3 u. x, Y, f
6 A4 e2 r( H! C7 q2 O- #include <linux/module.h>9 m& S7 O2 _+ y/ y
- #include <linux/init.h>
. G+ @3 o3 e: L o- Q+ t - #include <linux/errno.h>' y% {" n- o( X$ u6 W4 Z: t7 Y
- #include <linux/types.h>
$ A* a) w. f+ [& p8 @ - #include <linux/interrupt.h>
( Z: T! {: F7 b5 Z - #include <asm/io.h>' X# @/ U6 k1 ]* s" B0 s6 S
- #include <linux/moduleparam.h>
# B5 [" p# @6 t7 b - #include <linux/sysctl.h>% I# [7 E; q* q4 C- g1 U
- #include <linux/mm.h>
( Y* d/ X, a& g* t! U, J! c! P - #include <linux/dma-mapping.h>
% J6 O2 _, s5 ?3 _1 p" h - 8 m j6 K( i5 Y* e
- #include <mach/memory.h>
& g' O+ m, |4 B# {: |! ^" e - #include <mach/hardware.h>
( D( l5 {8 J6 v* r! F2 M - #include <mach/irqs.h>
& Z: _" _$ i6 `3 l$ Y1 g2 q6 M' K - #include <asm/hardware/edma.h>( w4 E- V* ?6 V! T2 o6 x2 N
+ z9 S1 d, ], O H6 z- #undef EDMA3_DEBUG) y# N [& R) H: g
- /*#define EDMA3_DEBUG*/
7 v) K) D% z; B* j - ) k2 m/ ` a) t# ]4 F
- #ifdef EDMA3_DEBUG
4 p4 [; [" X/ I" A* F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
`3 s7 @. n, t0 d) p6 W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ G! ]1 `2 h" x& }2 P- C/ Z* X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ r0 B {8 m7 J& f U& j: @ - #else/ b, Y0 Z4 N3 M/ J/ x
- #define DMA_PRINTK( x... )- o) D3 t* K3 M( C& o5 l
- #define DMA_FN_IN
^0 ^9 b# q- m+ [' E5 { - #define DMA_FN_OUT
) I* @& b# H5 B - #endif2 u A5 G' e! O4 Q0 U
- 5 `7 ^! X) B/ W. O G( b+ ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 n; y7 i: R' n9 x+ F& K" j5 @) @# h
- #define STATIC_SHIFT 3
$ }6 ]& H6 v( \& X - #define TCINTEN_SHIFT 20
3 j$ m2 f9 E# S" `; @, \# m - #define ITCINTEN_SHIFT 21
" h$ Q1 M T+ F6 O - #define TCCHEN_SHIFT 22
; i1 ~4 f' Z1 U' E/ S/ T8 U+ i/ G - #define ITCCHEN_SHIFT 23
6 T6 \5 n+ {+ n - # e: p9 s$ [) R: q k) m0 X/ P
- static volatile int irqraised1 = 0;
' h' L4 E9 O" v+ C* ]1 t' S - static volatile int irqraised2 = 0;
5 D* c$ g K8 q4 O" G - 8 q/ W& }2 P; O, _& ]8 ^. H/ B5 y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) ?4 r6 } L- y& X# g* t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) T9 c) W5 Y" J9 R3 Z9 {' A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ?2 |& Q l5 ?" E' J7 U! C - / W+ B/ p# v& W, {5 r" | ~4 U" U: {
- dma_addr_t dmaphyssrc1 = 0;# z. q9 j4 _ m2 ~
- dma_addr_t dmaphyssrc2 = 0;) d% A/ a9 }4 X8 `% g F
- dma_addr_t dmaphysdest1 = 0;0 n9 y: \& q7 U; Z. K; g' B
- dma_addr_t dmaphysdest2 = 0;. z1 a% i: O* }; ]
* I& T* c9 I! B, _1 H3 L- D7 ~0 z- char *dmabufsrc1 = NULL;
. _ i8 R) K. r% a7 @& s - char *dmabufsrc2 = NULL;
5 @; i7 K& K9 ^' } - char *dmabufdest1 = NULL;
, \; I; f) h9 s t* ^/ ] - char *dmabufdest2 = NULL;
1 l, F, l/ c- H
/ S( X3 [, d& s8 c" C8 }- static int acnt = 512;) n; c1 Q7 M( t1 {! A; P$ s1 a
- static int bcnt = 8;
+ J* J2 b' i+ G" V. U# o - static int ccnt = 8;
/ `. e; H; S. f. _ B* B1 b' p1 L - + f0 Y! }0 V# g- s* q' Q0 `. l
- module_param(acnt, int, S_IRUGO);2 Z* ^# }0 [7 i5 ^) ]
- module_param(bcnt, int, S_IRUGO);; l; J m0 W4 ?) r) P3 y& B# _
- module_param(ccnt, int, S_IRUGO);
复制代码
: K4 Z5 Y" P/ [2 l+ o) e
+ M6 D. z6 c! t) E2 B. g- @; W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: i) K8 r; i# E! A8 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" i+ p( y |; i& X ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ B" U' w/ d" A: D: Q3 t
' V1 D/ B3 k# y( p1 N2 v2 T4 C6 y0 k3 b$ T4 @ B/ I
|
|