|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 K$ I# T. t+ V0 n \
- [code]EDMA sample test application# b1 k! y4 A/ Y. h, J
- /** E6 o) Y+ ]0 V3 M
- * edma_test.c9 Y6 ~- E4 J% E" s. S
- *
) }0 r2 ]% e# G4 {& B - * brief EDMA3 Test Application' _' w% c' @* e
- *+ k7 K+ M( j! g1 r" P1 f; P/ Y+ |
- * This file contains EDMA3 Test code.3 s& W) T5 v8 }6 B* F% g0 N
- */ ^ L$ n8 h5 y& g+ k, t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 E" y" x) \( G1 ]7 c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( v2 e% I0 n y - * TO CHANGE.5 c. Z1 W* `1 U; k. X+ H3 E
- * s* `# |% ~1 a2 \9 d8 J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- `* d! J4 M$ c) c1 P2 z* C) H - *6 q6 j: w3 t& [& ]7 d; [2 t4 f
- * This program is free software; you can redistribute it and/or
" Z4 c6 _. h$ ] - * modify it under the terms of the GNU General Public License as$ I6 C. I6 X& K' d$ g5 l
- * published by the Free Software Foundation version 2.
! [/ {, \2 T8 ^5 j- @# T" E - *
* z' Q# V( `- K! P8 @' v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! F* ~. U0 |( S- z | - * kind, whether express or implied; without even the implied warranty- C0 u' F, M. T' {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 c4 p1 e* X' k
- * GNU General Public License for more details.. I1 [7 ]' G5 t: X \6 R
- */
! W+ N2 K) `6 k" |5 m; p5 ~) Y# C - * e: }9 X3 J3 o& @# C7 T2 v
- #include <linux/module.h>9 m6 U7 U/ k( I9 v
- #include <linux/init.h>2 _$ U( m# l& U
- #include <linux/errno.h>* n7 \- i4 M* O5 {
- #include <linux/types.h>5 R# s9 b$ Q' c. h' ^, X
- #include <linux/interrupt.h>4 t& a8 }6 {% P
- #include <asm/io.h>; d- G6 a9 Z, U0 c
- #include <linux/moduleparam.h>) V$ u" b" i# z* [
- #include <linux/sysctl.h>6 V( k. D* [( a# l4 w* ^( ~3 K
- #include <linux/mm.h>* C9 a6 Y" L6 Q& v8 K# x
- #include <linux/dma-mapping.h>
. M. M# z) {, ?$ G7 j - ! M) ~: P: ^9 r! d
- #include <mach/memory.h>
. V2 m6 |0 M- P: p4 q - #include <mach/hardware.h>! h1 x/ }( s: s; n
- #include <mach/irqs.h>8 z" e0 ], {2 L
- #include <asm/hardware/edma.h>) H5 h! @! f, J, W% n
- . M2 i! Y5 \, k, l6 Q- v) L
- #undef EDMA3_DEBUG% A+ F3 g! A4 L/ e5 O% ]
- /*#define EDMA3_DEBUG*/
# q; I6 Y5 F3 q& h' v - - G7 f; z( U4 l
- #ifdef EDMA3_DEBUG
0 W ^( ]7 W! q: o/ n. r& p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ ]$ F7 q e7 e& k# F# u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 ]9 V; d4 y: F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); w: j% l7 Q- T% i0 M
- #else; W$ \# q4 Z* r. T- ~2 s1 j* `
- #define DMA_PRINTK( x... )# X( R. K% [ Z$ X% s
- #define DMA_FN_IN
; X& X7 q' z: n; M$ R - #define DMA_FN_OUT
5 J) t6 s, a# Y - #endif5 V7 w& N' k# T! P7 J
" q* `' N. V0 n* T. S# G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( l* Q1 Q. w& B$ H+ W3 ?
- #define STATIC_SHIFT 3$ U7 x2 m& f6 g( P% r/ W* J6 Y, c- i& G
- #define TCINTEN_SHIFT 20
' d; Q5 l8 | G4 q - #define ITCINTEN_SHIFT 21$ c" d& u4 I. P3 v
- #define TCCHEN_SHIFT 229 h* R& o; G% b! o
- #define ITCCHEN_SHIFT 23, m7 a1 B, ?9 ?+ I" q
- 3 X5 b" J9 i$ i8 }+ C: m; `
- static volatile int irqraised1 = 0;
/ E. X$ }' u% L0 p4 O8 {- s9 j - static volatile int irqraised2 = 0;
. C% B) o/ L6 b8 @1 Y! |# W# O+ ]: _0 W - 9 E( o2 c) K0 C! F. Z F& G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, g9 d, [' p- L: c, `# E6 j& J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; X! x5 l9 Z$ m+ `% z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ R% d5 K* h; d3 l: y: r
- ; j. X3 K( N% C* d
- dma_addr_t dmaphyssrc1 = 0;8 _* o& i: H" O* p
- dma_addr_t dmaphyssrc2 = 0;+ m8 D& L' `! `; P& b* `/ t1 o9 C
- dma_addr_t dmaphysdest1 = 0;
: s8 D2 X/ v0 F3 R7 P1 v9 ?. m - dma_addr_t dmaphysdest2 = 0;3 w; \% M( f) c$ g: o. X$ T- r& s" l
- ! T2 z# q3 s# m, S' }) H) A0 _; C
- char *dmabufsrc1 = NULL;5 Z; a& i/ E, Q: H) s3 e+ J
- char *dmabufsrc2 = NULL;
/ g. l# r* T0 V4 v- n - char *dmabufdest1 = NULL;+ w; Q( Q% H+ ?6 t6 k2 M/ k. S
- char *dmabufdest2 = NULL;! e U' \) I+ y( D
: J% ^3 y' A# H) w; f i$ W- static int acnt = 512;
1 F$ V' g- h: j ?. n- z; n - static int bcnt = 8;8 ?! a. r; D0 \) H N7 `) _
- static int ccnt = 8;
1 r' E8 V) A( S& |" C) G' Z - / E2 O; `- m u2 w4 P9 P9 ^( G) L
- module_param(acnt, int, S_IRUGO);
( n6 s6 d! y4 A - module_param(bcnt, int, S_IRUGO);" U% M' r1 h8 i7 s$ `
- module_param(ccnt, int, S_IRUGO);
复制代码 " T' U' }: E: O
/ v R+ J9 S B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, F8 @/ D4 v$ y+ V+ j/ v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% G& a+ b1 Q2 q7 u6 x: @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 ?. d) K! g5 \* c8 s; P; z. H% @+ O5 b& y
) D5 j5 d9 {" ?' _! D |
|