|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 h# Q3 S+ s F$ m" L6 X& b2 }
- [code]EDMA sample test application* f! a$ A3 x+ ^
- /*
8 |+ X/ s1 N: J1 `5 w1 P) A - * edma_test.c
" {. l1 r0 B! M( V7 x - *9 z9 {& W: u4 ~ H- n. c- n6 |
- * brief EDMA3 Test Application
# L* Q/ |" q" f6 ?2 j1 h+ z# @ - *2 r8 t. y* Q3 p7 S
- * This file contains EDMA3 Test code.) W3 X& d* c, I* H O [
- *
, T4 g3 u& w% d6 V6 _8 H9 W& T1 f: w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" W' \0 W9 W4 l8 |8 ^$ ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 i/ V% L0 S- K& X) F( \ ?# X0 u
- * TO CHANGE.
: N m5 h) U# k6 i6 l- T, r# E - *% \9 k+ H, X5 f( C9 u0 z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 t0 h2 J+ ~) [* Q
- *
+ ^$ @( B: u& c( ] - * This program is free software; you can redistribute it and/or- i0 C. C3 C) n# w3 Q
- * modify it under the terms of the GNU General Public License as. ~( o# [) A7 o/ D& _
- * published by the Free Software Foundation version 2.
$ L) _ H$ x7 S* c% v - *) T: }# t3 A8 ~" m% @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 q/ R( F9 d% `+ P' {9 Z+ F4 n - * kind, whether express or implied; without even the implied warranty
* v1 g. T, d& L! q2 R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 a' m: ^ i# Q) }: J% q) }- x
- * GNU General Public License for more details.
+ a# C! N! z* v+ c - */
1 _' I! Z* d, T1 b" U - 0 P6 K/ u3 i( e8 S: L8 K
- #include <linux/module.h>3 H8 x6 L* X% l
- #include <linux/init.h>
$ R" C9 i0 K! @( {# t& W0 F - #include <linux/errno.h>
" h6 G% x; r& O* u! l0 ?2 C0 I - #include <linux/types.h>, W4 ?( w: ]. H' `
- #include <linux/interrupt.h>! k b( F5 m, d4 b0 y
- #include <asm/io.h>
O) W' A, z6 i! ~% @% f9 g - #include <linux/moduleparam.h>
- M" f6 M2 s- e- j/ ] - #include <linux/sysctl.h>
+ f9 u, ?) G1 m. @ - #include <linux/mm.h>
; T- F) H4 q E- W3 X/ R! i - #include <linux/dma-mapping.h>
3 f) ~0 ~) G# M& U7 Y5 O+ M1 ? - * l+ |$ ^" i" d! U( Z
- #include <mach/memory.h>6 q$ _9 O$ F1 O! V( p; a t' u
- #include <mach/hardware.h>% [/ e3 _0 k M% [) R
- #include <mach/irqs.h>1 `- |: v& ~' i% a
- #include <asm/hardware/edma.h>
% S# q. D( B% z4 X, L0 I
: ~0 M1 x% x% P+ W9 _! G- #undef EDMA3_DEBUG7 F* D. |4 k& B4 _( T
- /*#define EDMA3_DEBUG*/
; U: P+ Y& S) s- F% n! C
; ^& P1 @: I) m: z. @- #ifdef EDMA3_DEBUG( @3 O7 L$ G' Z! T5 l2 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 |, W3 c5 t5 G( N$ v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- Z; R8 g/ x% R+ a) y7 @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, N5 Z# H9 @3 U# x F6 g9 \$ n - #else# v( h" a, Y* J9 @
- #define DMA_PRINTK( x... )
" Q# f# u& _+ D5 Y4 q5 E6 t7 y) _( l - #define DMA_FN_IN. `; ~. r4 p' P- s4 M# s( Q
- #define DMA_FN_OUT2 B) |* k2 w/ \2 u1 k6 \ n8 ~
- #endif. O0 c' `: g: {. g h
- 5 X: L! q, x' e9 l5 T7 ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 {$ K) B5 x0 O+ |6 y; p) L5 o9 t# s
- #define STATIC_SHIFT 3" S) L I1 B v' L% S. Q
- #define TCINTEN_SHIFT 20
( M. q. J* k* B" R - #define ITCINTEN_SHIFT 21
" Y: r9 H- ?) b2 ]$ `; x* X' i1 M$ d - #define TCCHEN_SHIFT 22- y. u: ^9 @2 ?' e# W7 G3 c
- #define ITCCHEN_SHIFT 23
7 W" C; h& ?/ Q! K/ ?6 ]+ t0 [$ ? - 5 _4 O& V/ k3 Q) |" y
- static volatile int irqraised1 = 0;. e3 u/ V$ w: d4 \ F
- static volatile int irqraised2 = 0;( M; j! t, H: |7 H! K. O- y+ ^4 ]
- - _ b3 x& R5 D: J- _; N4 c& L2 i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 M4 W0 z6 ?+ R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( H* H0 y" [7 H7 y4 s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& O; _! { S3 m
. h) L8 H/ m H9 e1 `' N- dma_addr_t dmaphyssrc1 = 0;' P# R) f' M1 @8 p
- dma_addr_t dmaphyssrc2 = 0;0 s) `! }- x) L9 c Q( }- B, n# g& `
- dma_addr_t dmaphysdest1 = 0;& k+ f$ \( I' N' _$ c
- dma_addr_t dmaphysdest2 = 0;( D; U5 ]& e7 I
( P5 D+ g) D( g4 E4 q( U" v# j- char *dmabufsrc1 = NULL;
1 A& m# u. W O( A - char *dmabufsrc2 = NULL;
4 R& O- h" S& U - char *dmabufdest1 = NULL;8 g, l. Z& m: n( K. z
- char *dmabufdest2 = NULL; r0 L7 N1 g# d; r1 c% ^# A& p
$ r6 `& L: I1 i |2 i0 M- static int acnt = 512;' I" ~5 x/ U) j
- static int bcnt = 8;8 S% L; s9 R: R; ?
- static int ccnt = 8;& i4 _; z6 u. Z+ C
/ @+ v4 y( E- Z: A8 ~- module_param(acnt, int, S_IRUGO);4 b& n0 z% w: ?1 L' s3 C3 E
- module_param(bcnt, int, S_IRUGO);3 a# P1 r& p; F# N0 o' g
- module_param(ccnt, int, S_IRUGO);
复制代码
" P8 f+ a8 v7 {% u. q
2 P, P8 E3 j/ s3 B/ a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 a$ n" I1 w' o$ Y$ S- m4 D; @ narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 v: D: R- f9 r! X4 R9 L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* D2 Y! @. i' ?- o6 `( c, Y# b) Q: I# i2 m( W' [9 E
; J$ R4 {/ p6 ?/ j% i |
|