|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' ?1 X. Y; | m- W# s6 [# \
- [code]EDMA sample test application" b+ R* j3 n6 f2 e1 V
- /*. A6 L; B7 m4 T' Q) V1 D% P
- * edma_test.c
: s! `) N( b% S$ D$ t$ z$ q - *5 h) }; w+ z' S, p& Z# ?
- * brief EDMA3 Test Application, \- A. d' p% m! U4 h
- *
+ Q4 e' f/ W& t8 R/ j+ Y6 n3 D/ F - * This file contains EDMA3 Test code.
. ~7 I# r' ~; p6 M* A; ^ - *8 s" k8 C: w, A! t1 h, [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ |' H* m) L$ R0 N$ \" l7 K2 f y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& O8 ?1 Y* I' C* R8 k - * TO CHANGE.
v: w+ c. H. H( k- Z* P- {, z - *5 {2 Z5 |. q9 @6 S3 P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( [$ V! A. O0 {7 r- D6 y' [ - *2 m9 Z% M ?$ H0 W) x$ d
- * This program is free software; you can redistribute it and/or3 P- R. i+ \9 ]4 K. j* @
- * modify it under the terms of the GNU General Public License as
: W1 }. o6 p, Y, X6 Q0 C - * published by the Free Software Foundation version 2.
" @, j) |- F/ ?3 u# o& j - *# N3 h. ?; k6 Z9 m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 a- W4 u( l! S - * kind, whether express or implied; without even the implied warranty
. r* S+ T2 k x- B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 y/ z0 ?6 s& N
- * GNU General Public License for more details.
; j$ \, g6 `# F" H a/ |# |/ k - */+ G% h& P& p" k& Y( w/ a! R/ F
- # _$ r4 k+ \( K" G! B
- #include <linux/module.h>
; O, A( |& T- W ^; J9 J5 ^; u( X - #include <linux/init.h> O5 {7 K7 W# Q
- #include <linux/errno.h>
" I) c Q4 ?/ L: c' z8 w( r - #include <linux/types.h>
/ P# L' B! D' c S) K3 e - #include <linux/interrupt.h>
6 g3 Y" t3 d$ X - #include <asm/io.h>, {* c6 [& f4 p% N& h' k- c6 @4 T
- #include <linux/moduleparam.h>6 B! Z: w4 k2 J9 S' {& o% _
- #include <linux/sysctl.h>5 Y: m& t) o/ e0 X* ^' H
- #include <linux/mm.h>( O5 v; ]. f9 ?
- #include <linux/dma-mapping.h>3 Q1 z& V' J! T+ m. I
3 E0 p: A% ~3 Y' b- #include <mach/memory.h>* c" M8 G( I& s" U ]4 f1 d8 H
- #include <mach/hardware.h>
" ~2 W5 T9 ~& l1 c) S1 J; b6 w - #include <mach/irqs.h>0 ]- L. w% B" t; r; h }3 R$ d
- #include <asm/hardware/edma.h>
+ A% v/ G+ B( g# S* [6 F - + ^5 j5 [# C% {9 N/ }4 a) T
- #undef EDMA3_DEBUG. C# B n4 p8 `
- /*#define EDMA3_DEBUG*/
8 _6 ?' u: D1 y5 e8 O - 6 O* @- q" \" l6 S$ T! m
- #ifdef EDMA3_DEBUG5 t$ J# S# T0 U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% s) W/ o3 D3 k, o' @( ]1 ^ S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( {& h+ A/ t0 r. P' J# s1 f/ R1 V8 Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( F- ]( n f% Y+ ~ - #else
9 R$ s' K' w6 `* n - #define DMA_PRINTK( x... )) F0 z# l9 M( U- Z: Y- A
- #define DMA_FN_IN2 F! I( C6 o) M$ \8 a( s
- #define DMA_FN_OUT
4 E" R) c- N3 K1 ?, C7 {( f - #endif
3 {) A% y) z, o
! L) ^7 s% i0 g! u2 h5 O6 o" m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 Z- i, [% E' r - #define STATIC_SHIFT 30 |5 q7 ^; C2 K( i; ?+ S" x
- #define TCINTEN_SHIFT 20
" e5 H! r2 v! n u# w! J( J9 j - #define ITCINTEN_SHIFT 21
% r3 x L! A0 Q2 H0 E7 L - #define TCCHEN_SHIFT 224 g: Q) X: A P& [/ O
- #define ITCCHEN_SHIFT 236 S7 b* f+ r4 g0 p
- * _8 w+ X/ W4 @% m0 C) l/ T( |
- static volatile int irqraised1 = 0;5 A r* q; K8 K! c; i+ e* ~, X; p
- static volatile int irqraised2 = 0;/ R- N0 k! F0 V
- 1 {% h8 J8 v, a. A4 ]1 r6 w L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% g. ~% p' G+ \9 |6 i* e4 | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 D% V$ l( e1 V2 R# m$ E: T+ A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; t3 k( p, x$ }( S7 @! q" ^0 U
& |& f; w; n- m# w5 D, B2 K( |5 Q K- dma_addr_t dmaphyssrc1 = 0;( K7 p$ _& q1 _/ y' \5 w) R/ v" l6 }
- dma_addr_t dmaphyssrc2 = 0;
" ?4 D3 S6 L r6 J2 ~' H/ y - dma_addr_t dmaphysdest1 = 0;
[; ]% y# e8 N/ m( M, r - dma_addr_t dmaphysdest2 = 0;/ m. v9 k8 r& Z3 p) w# h6 o7 y" S- |
: ~& ^4 N' U% J1 L& T- char *dmabufsrc1 = NULL;3 {- H) ]; F, m4 u: u/ Q
- char *dmabufsrc2 = NULL;) e+ K2 O' H6 x
- char *dmabufdest1 = NULL;9 ?6 y4 m) |0 D4 T9 t$ J; G
- char *dmabufdest2 = NULL;
: B: }- j! _5 c) a+ b& ^
: l: @0 |1 U, J, R5 Q- static int acnt = 512;
! r4 C7 A5 Z# l4 h, o - static int bcnt = 8;
" Z4 F* n I$ v( [. Z - static int ccnt = 8;% m( s' F& c F }, |" O9 n' i! _
. K' x* \5 ]) g# }- module_param(acnt, int, S_IRUGO);' n$ B- i) j! Q: g2 e+ a/ E* V1 E$ h
- module_param(bcnt, int, S_IRUGO);( L0 }" i/ L# ]5 r3 K6 N: w8 G
- module_param(ccnt, int, S_IRUGO);
复制代码
5 c0 E, ?$ L' \+ B {' j
4 K- J! t4 u3 { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- N q! L( K/ n0 P: E. Z! d4 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) O S5 M1 r- i% V, A, z( y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, w+ ?5 d) k9 @ A0 |
, s* U8 E1 I+ B0 A; O& b. C% T, d+ s4 Z6 @
|
|