|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 ^2 n! E& n' w- [code]EDMA sample test application
; B8 {% ^2 J* u1 ~7 [5 [, I - /*
) K+ ]- [$ p7 I2 E - * edma_test.c. {3 z7 c/ h$ L' f
- *
+ [; K% B4 d- f2 } - * brief EDMA3 Test Application
) x i* I& y, ^( ]7 F. ^9 | G - *
0 Q2 n; q9 f5 J9 t2 x - * This file contains EDMA3 Test code.
7 I; j5 F4 M' n3 n, f - *! I4 G1 N$ V, Q; H @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% [( P2 b8 T2 D; W/ L+ f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- O+ e* Z( n( S
- * TO CHANGE.2 z# H0 K, p" H$ T7 @% y$ f
- *
$ C' |5 C7 |0 V+ [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ G9 R7 _4 @# \* k, A( X - *
( R( n' U# K% V5 u3 y - * This program is free software; you can redistribute it and/or4 `3 ]6 m b) H
- * modify it under the terms of the GNU General Public License as4 y# t: u% l# }8 e0 N: C
- * published by the Free Software Foundation version 2.& o$ K7 l" J0 M0 {" Y: q
- *+ t$ C( x3 W1 q9 s1 F, W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
v% Y9 V; b0 [% U6 f% y9 d0 _ - * kind, whether express or implied; without even the implied warranty
+ b: @9 N% g' j* ^; T% s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 t9 n+ Q; g7 u7 F( N# X
- * GNU General Public License for more details.
- V$ W# Z5 f# Y' C - */+ [( p$ z1 ]/ ?3 {! {0 m
- , V6 L% O9 ?0 p1 V. M. t
- #include <linux/module.h>/ J' e: c, D2 X: B+ K' k1 L
- #include <linux/init.h>
. E" l3 _ g' G/ J1 m# j# Z - #include <linux/errno.h>" B' D T; v: W8 @( P; R( `
- #include <linux/types.h>
+ c; {! T' x4 o1 {4 D/ H7 B) b - #include <linux/interrupt.h>% n f% y0 {. w4 J
- #include <asm/io.h>& T' e0 t. c0 r! Y
- #include <linux/moduleparam.h>
+ K4 `+ a" w7 |. K' N - #include <linux/sysctl.h>
4 L) m) _( t- T: H& u: p& q - #include <linux/mm.h>9 R7 U. Q# D3 P, w9 ]5 j) w) _* q
- #include <linux/dma-mapping.h>
, e& h' U8 g/ t- k# c7 m- y
, F0 s- {/ H. Q1 U- #include <mach/memory.h>3 L: T" ]- q0 X! V
- #include <mach/hardware.h>
! l g, J0 @) P - #include <mach/irqs.h>7 V& Q8 `0 K ], Y* C
- #include <asm/hardware/edma.h>
0 G" E S( _0 V& x0 y1 Q
. `6 V) |8 ?7 ?, v4 R- #undef EDMA3_DEBUG+ R$ ]. L8 H1 C. h. l
- /*#define EDMA3_DEBUG*/" W9 i- ?3 @1 ^+ @2 w; Z8 _6 |) Q
6 d2 P1 n( d' o0 E* W- I- #ifdef EDMA3_DEBUG
* g* W6 y- g: y$ r2 a2 } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 Y" h" r2 b6 h2 ^$ C8 m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* g, M1 ^ s" K: T0 z& x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 @$ [4 E [$ q K9 P1 J3 D - #else$ }. ?, c) X0 _5 D: V
- #define DMA_PRINTK( x... )
4 Z+ v- [# a9 M5 Y. M0 l+ ` L - #define DMA_FN_IN
$ r0 p( e) ]; H' j' n - #define DMA_FN_OUT
) o9 v) ]3 P6 `/ P1 z - #endif5 m F, ^' U& u! \8 ]
- : T; W( }$ U( |/ c% \! j! |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, D# ~+ W+ v( ^! j/ U - #define STATIC_SHIFT 3) a9 a8 f& S* j3 Z1 ]
- #define TCINTEN_SHIFT 20- J; g7 s4 P- J/ Y$ q
- #define ITCINTEN_SHIFT 21
6 R) o* X4 f" G3 r/ ]! S7 P$ z" w - #define TCCHEN_SHIFT 22
( e1 `; Y/ e! r# O - #define ITCCHEN_SHIFT 23" o) \) s# N/ k' M
- 5 v3 I, t$ ~6 s- O% s
- static volatile int irqraised1 = 0;
( N7 v4 Q6 [- z0 n$ @! B) D* Y - static volatile int irqraised2 = 0;3 d6 N+ ]$ {0 i- ], g
- + G5 z% K, T' S" e# ?$ k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 C; g0 t! r6 B6 u, x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 b( Q! m" n+ P" v) N7 C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 D1 R- O9 D" r! F3 s. O% w
- ! X. ~9 U* w0 q) }* \
- dma_addr_t dmaphyssrc1 = 0;
- W2 e" V5 P5 l3 o7 s/ \2 B' r - dma_addr_t dmaphyssrc2 = 0;
" U/ |* P& N2 J4 l* ]9 | - dma_addr_t dmaphysdest1 = 0;6 h- V0 ?. v3 a; r2 J
- dma_addr_t dmaphysdest2 = 0;$ p; t2 V4 Z$ W+ ~7 `) H% x5 w
3 W3 r7 z8 x- ]9 P+ ^5 G- char *dmabufsrc1 = NULL;. b! N# r3 _+ ~9 R; |
- char *dmabufsrc2 = NULL;
2 P7 f1 f$ `' w; d* s - char *dmabufdest1 = NULL;- [; Y# ~+ O- n% M! q0 X
- char *dmabufdest2 = NULL;
: F9 M1 Q* X+ O4 }3 J
4 ^3 ?; m( d- d" }5 \9 Q- Q- static int acnt = 512;
; g1 G8 a: m7 J2 A" `+ j - static int bcnt = 8;* R8 z' P7 Y1 B5 t
- static int ccnt = 8;
. g5 ~1 e8 N+ b$ q - / I+ n# D% P$ A9 U+ I( c; ^
- module_param(acnt, int, S_IRUGO);
- c/ \2 G2 F: Z' }) r+ O - module_param(bcnt, int, S_IRUGO);7 ?( f7 V& Q5 u6 E" d
- module_param(ccnt, int, S_IRUGO);
复制代码
7 Q+ C# L9 W& y- F4 m+ a' Y* @8 Z6 u5 Q2 z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 | X c8 e! _" p4 B) uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 W- S% u; ]8 c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- b* _* W' ~) B0 S! x2 F: Z
3 [ l- { Q3 K" Y* _' F0 W$ c/ q
6 l& Z- S8 ?' h" ]1 z |
|