|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 g1 Y) g% A! F
- [code]EDMA sample test application* T# s( o" U3 R/ r5 P" U! A
- /*$ r/ f3 z& I2 F2 l; c, Z
- * edma_test.c5 t- X% s- h b1 ~0 w
- * ?0 M/ t4 f/ F r, q& o
- * brief EDMA3 Test Application
5 V) @5 C/ e" {/ ^4 p+ { - *6 @/ g4 x* y4 q2 \8 X3 G
- * This file contains EDMA3 Test code.
1 T6 h e/ d2 `4 I3 N g - *
, f' L9 P4 B0 R8 a* s5 c: ^0 ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* K) a$ z# E% T/ ?$ i# q1 I! c# q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 L; X! C6 S' `( V3 J% a - * TO CHANGE.: t' \: E1 H* x2 s
- *
' { D; H/ s6 L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# M, l( t2 N+ w+ t8 |; K* f4 U' m1 Z" m - *( P, N, G0 d& `! f: N* z5 I3 z
- * This program is free software; you can redistribute it and/or* X8 X$ i2 t; L' ?4 |% @
- * modify it under the terms of the GNU General Public License as6 X# v. [* T" G' u; R& Z4 ]
- * published by the Free Software Foundation version 2.
7 d1 X7 U3 ^' ` v: u; R; Z: m8 R - *
( S" A# ]# r+ H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ a6 [! H2 H# R% Y$ u' z - * kind, whether express or implied; without even the implied warranty
' l* u5 p9 v5 \2 b) I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# w: t, v2 Z* S s - * GNU General Public License for more details.
* _* u2 \* \9 }2 l - */
, T" k! r- X3 e3 g0 g1 B
8 D# M' H! I9 K- #include <linux/module.h>
+ x7 Q: [* }. I$ C - #include <linux/init.h>
6 U! l; y$ d J+ y - #include <linux/errno.h>' V" Y& s/ G* Y/ c' L5 v# z
- #include <linux/types.h>
/ M3 u7 [4 b# x/ T - #include <linux/interrupt.h>3 m" X) k* r8 Q% d
- #include <asm/io.h>
( r# ~$ Q0 b" v: z/ p+ s - #include <linux/moduleparam.h>0 _0 u( E& c( r1 n- o* `& t6 X
- #include <linux/sysctl.h>+ K9 H4 W/ g; T; E( s% t, S
- #include <linux/mm.h>) r8 M( a& R3 {$ a5 @' A
- #include <linux/dma-mapping.h>
4 a3 s @$ W" h7 j3 L) I8 x4 |5 D
( S3 z" E# ^4 ]* j! J/ ~& E6 g/ p- #include <mach/memory.h>
- t$ N6 ^# k9 K. x1 {" B9 m/ X! d - #include <mach/hardware.h>7 F4 j2 m8 F9 j4 p" f
- #include <mach/irqs.h>
5 P( y& Z/ q2 ?- }& K- F - #include <asm/hardware/edma.h>& d; J6 [& \( @ ]4 N* d# D1 M
- 0 X+ m& D& u2 h1 k+ V- s% Q
- #undef EDMA3_DEBUG
4 z0 L0 T) l0 l2 U) d9 W; u' c# M - /*#define EDMA3_DEBUG*/
" ]4 L& }2 C' h6 N& t% e
& z6 }, r* U+ e- P- j: W* H- #ifdef EDMA3_DEBUG; u6 t* @4 b4 |/ Z* ~. j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), _! X% c7 k& b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 v% w8 J6 y, H: k/ @8 t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: [( w ?% o* T3 b( }& |+ m - #else7 v+ v/ I2 Q; P% Y8 X B3 t
- #define DMA_PRINTK( x... )
- w4 _' X- i( k - #define DMA_FN_IN( H$ a: Q$ X" I9 o# R
- #define DMA_FN_OUT+ C$ f; J! ^& b, [
- #endif y7 P8 I0 a% t# ?) w f& F# w; l( C, @
/ k3 D3 s, Q( C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( L% ~2 H( `* [) r$ g - #define STATIC_SHIFT 3
& e B+ d# a' z$ a$ \ - #define TCINTEN_SHIFT 20% p8 y5 | P$ P9 y0 m- S2 y4 ]
- #define ITCINTEN_SHIFT 21
8 u2 g8 M9 A- `( p& } - #define TCCHEN_SHIFT 22! {8 L% o j) _7 j8 l6 S0 t1 h
- #define ITCCHEN_SHIFT 237 Y0 `4 r, A9 x7 n3 |
) c# z" \- E. m4 f8 x- static volatile int irqraised1 = 0;5 _' z+ g* p' q/ g: J; p
- static volatile int irqraised2 = 0;$ R; [+ S! z- J4 v5 z2 _" a
9 ?5 f$ \5 a! P( b7 y, f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& n1 f8 E% _- j% ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! E0 h: }' S& e1 \, o" | A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 l ^6 R4 A/ ^- Q) R
2 {+ `0 u/ W! e. j- dma_addr_t dmaphyssrc1 = 0;
! D8 w, K& m! g. L9 W! C% g - dma_addr_t dmaphyssrc2 = 0;4 m* `+ F! C5 L( `
- dma_addr_t dmaphysdest1 = 0;
- j; E: o6 ^9 v. \ - dma_addr_t dmaphysdest2 = 0;& J* Q. N2 d0 z9 C
; v. ?. b& E4 x1 U4 J; {5 ~$ j- char *dmabufsrc1 = NULL;
. [& u/ q! D7 p6 w1 m! q$ b# m) c - char *dmabufsrc2 = NULL;
$ e! {5 o+ z4 ^9 N6 L( O. }# Q - char *dmabufdest1 = NULL;7 L6 V9 f: A8 ^' s# h: z0 \" @- a, z
- char *dmabufdest2 = NULL;
+ S# p7 e$ B; h* `' |
, \2 h7 e5 d/ y! L* Q8 s$ ~6 I- static int acnt = 512; b0 h9 a* {- J0 T! P# B1 }- Z. c
- static int bcnt = 8;$ } a. l- m0 H, Z: J
- static int ccnt = 8;" U% v( v2 E2 ?' o! ^3 i
- 1 V2 a/ n1 n ]8 u6 o- R
- module_param(acnt, int, S_IRUGO);& @- h2 ]1 Q$ m% _/ |. \
- module_param(bcnt, int, S_IRUGO);# L$ w8 X( w" e. t6 \
- module_param(ccnt, int, S_IRUGO);
复制代码 % L' s8 G, C* j" O5 `2 V
# A& K8 U7 e) y0 g* H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ b% N. n0 v+ y' w* zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" \2 k2 T4 c* \' a* c4 f) R* N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 g, o }4 r" d6 I/ J+ p4 g# p" p; O- P% G: m1 w
; d6 a+ ]1 ]' |3 ?6 Q/ z
|
|