|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 \# ?% \ l0 l% X, {4 f$ o d
- [code]EDMA sample test application/ y# ~& D! f! ~: t8 P3 |
- /*
# v/ C. w5 y/ S# ?6 E. Z# B* ?5 x - * edma_test.c" `, a% Y; `4 {. f% K, ?4 J- {) ~1 a
- *
8 S) R6 H `; e% `; i, v* `/ s - * brief EDMA3 Test Application
8 O4 N, f! Y" g6 w. ~ C; F - *8 U! N" W% r) D3 P$ P
- * This file contains EDMA3 Test code.
: l2 i$ U6 U. b" N) O - *
) ~6 [7 F: i! D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ ]! V6 Q. h% m1 B( V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 K3 K- d- L z) b4 A4 H - * TO CHANGE.2 n8 A- M/ B$ y
- *
' E* ~( v% y" c4 V) T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ E, d6 B3 L+ M0 n9 T - *
$ e: U7 t% _ ?; S5 }/ H; _ - * This program is free software; you can redistribute it and/or
1 O7 ^& S# ]: e( s - * modify it under the terms of the GNU General Public License as7 O$ S) [. M# |
- * published by the Free Software Foundation version 2. ?3 A- [8 P. R1 B
- *
6 Y; B( Y- X- ~6 L" M/ j+ V: r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ P) N w- h1 o, I8 z# ^ - * kind, whether express or implied; without even the implied warranty
2 Z1 y& j ^+ U/ M- m) Q6 l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. J# n' c5 h9 ` - * GNU General Public License for more details." ^* v* `0 G4 P z6 E
- */
# f, _) i0 i7 T- d/ S4 b9 L
3 ^. Q! i5 a" C. J* S- #include <linux/module.h>1 D4 ~: T- L. x) H& k
- #include <linux/init.h>. J" q: R1 [- r+ z6 s
- #include <linux/errno.h>
, }$ {' }3 @1 K' _$ ?! w! Q7 ^8 a - #include <linux/types.h>- A9 h( r: F. c5 L6 x/ R0 s+ x
- #include <linux/interrupt.h>) q& C" {- @2 v, \5 x: w
- #include <asm/io.h>
8 \7 C4 G* ?' t5 Q! _& X - #include <linux/moduleparam.h>
* }5 X+ b0 y( d - #include <linux/sysctl.h>
4 [/ k6 ]- ?4 [% ?( ? ] - #include <linux/mm.h>% F7 ^# L# x6 t& f4 u) ]
- #include <linux/dma-mapping.h>
3 C" r1 o' s! ~9 N" \! F! R' }3 y - [# C8 `4 F/ C
- #include <mach/memory.h>
; z/ a/ J0 K8 e/ j d1 s# Q - #include <mach/hardware.h>7 Q* n. |8 k) k
- #include <mach/irqs.h>( H2 i- x3 b) s. A/ S9 J
- #include <asm/hardware/edma.h>$ Z# E1 y& W* @8 l. v M) r
- $ S! X+ K1 A: H+ Q
- #undef EDMA3_DEBUG, r: _' D# }. m: w: c
- /*#define EDMA3_DEBUG*/( j. h( \# U& R# v" }
- 2 \) ]" {: p& E% q8 L8 @2 d
- #ifdef EDMA3_DEBUG
: P2 L! y$ `- a! K' C- V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; Z1 D3 n- T% ^! F7 F6 k4 C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" Z' o' S% |3 R3 Z2 p' ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). {8 `* d6 ~+ w, \' z. {3 t
- #else- v8 Z: H( g0 d( M& s( { F% a
- #define DMA_PRINTK( x... )
5 s) t8 r" ^& a0 e- d2 T, M - #define DMA_FN_IN
- J- ^; M; g% L, ~- }0 O - #define DMA_FN_OUT! @7 ]. T$ \ Y9 {8 K. ~
- #endif( q2 ~( a0 Q" J, E6 \ k/ |
- & @: S# y. }: S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ L% E- R/ Z* ? h4 a& z* h - #define STATIC_SHIFT 3& ^( S& X# i/ {! {; s9 r+ X
- #define TCINTEN_SHIFT 205 s: S; G5 h. K9 d3 c( L7 Q
- #define ITCINTEN_SHIFT 218 i0 F/ k, r8 {9 {' l) A# h- z
- #define TCCHEN_SHIFT 22
8 {5 [) d# X7 V+ v' x - #define ITCCHEN_SHIFT 23' o' G: ]+ q$ e
& M8 Y% i! }' l7 f" Y- static volatile int irqraised1 = 0;
. W4 n8 n: J6 M) B: ^* h - static volatile int irqraised2 = 0;9 Q7 {* b# _; Y' v% h+ I
- & ~+ ]! e) ^8 [' D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# H5 K E6 v C( h B5 e; G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 S# T# |4 P& M4 h5 A0 j" k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 P& N7 h* l! ^: C* W
7 S& c) L; q( ?( }- dma_addr_t dmaphyssrc1 = 0;8 D( L) O( U- o, N7 K! z% F8 r% c
- dma_addr_t dmaphyssrc2 = 0;
( \2 L9 o6 X. v v/ Z: O - dma_addr_t dmaphysdest1 = 0;
( G5 N6 D3 g3 g2 N( S3 z N+ Z/ }: W) s2 B - dma_addr_t dmaphysdest2 = 0;
* u/ j, Y) f P: a, I( c H( D; J/ l - ) \9 Q) q( n+ \7 w! I
- char *dmabufsrc1 = NULL; M6 R( F" `/ c4 [! P6 U
- char *dmabufsrc2 = NULL;. ~0 N" z, x: R/ U1 v
- char *dmabufdest1 = NULL;
7 I# l2 ? k! @/ h( V+ G# V2 [0 B - char *dmabufdest2 = NULL;
+ g" [" ]0 G7 k7 x0 l7 g5 N - 8 [) I, Z5 F7 B9 u- G0 Y r
- static int acnt = 512;
; I4 b! ]! h, y3 L( k - static int bcnt = 8;( ~% H4 k! A& j& S1 k
- static int ccnt = 8;) e. }( l' f' Q; b1 K' P/ f
- 5 z3 n7 @; q, Q$ y
- module_param(acnt, int, S_IRUGO);
$ J6 Y% @ _% e. B1 g7 d, F! Y - module_param(bcnt, int, S_IRUGO);
' h! L1 P' q2 J$ ~7 r1 x - module_param(ccnt, int, S_IRUGO);
复制代码 # r$ j' L! D. \9 ^
: J4 Q9 j: G, w: Q+ i4 K0 s& F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ f7 n# x; Y5 Q! d# _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 H7 J- l" D" V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* a' Q+ d! U: _1 |6 P7 \; F8 h
" V+ P! b/ T, i) B
& C& S5 d& Y+ P |
|