|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * E! v6 A8 D* G# t! r" X
- [code]EDMA sample test application$ ^+ }' I W9 t2 b# ]- j
- /*
5 d8 }3 Y0 V7 `/ j; m5 g: H - * edma_test.c
9 Y$ C9 g- |8 f- Y - *7 ^. w1 w3 N4 Q& y/ s
- * brief EDMA3 Test Application
; y' @! z& X& ~4 p* A! Y! I- q - *+ ?/ w8 a5 f9 d9 m$ a+ n+ n# H
- * This file contains EDMA3 Test code.
& E/ u' }% T" [' M2 @* c: e - * M- A$ q5 e0 P" ]" r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE L9 a/ I8 I, R% D5 N: r$ G+ F) |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 _6 K! ^3 i- r2 e - * TO CHANGE.
, t: _6 D1 A: e, \ - *
% I* S, }7 S- [9 f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ Z6 y! v4 T2 [- C4 P8 b0 F3 J - *1 `& J3 D7 E7 \3 {9 k P4 f
- * This program is free software; you can redistribute it and/or F! _5 E# y$ L! I
- * modify it under the terms of the GNU General Public License as# a% @0 Y8 ~; E+ Q# C' A
- * published by the Free Software Foundation version 2.
2 J: {" O6 l9 n/ P, i+ b3 q - *1 R2 @; G8 c% U4 b ^8 R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! @3 ?0 A& p }- S4 i. [2 ?# s - * kind, whether express or implied; without even the implied warranty
1 e5 K2 Z: P: d& r* A' O0 E; x0 } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& ^# _( H0 ]4 _) r! x
- * GNU General Public License for more details.
3 t9 }" D3 O' D( g9 l- H - */8 i* C: D0 B3 y% s2 y8 `
- - B) n& ^- m$ L' H4 d7 x1 r6 ?
- #include <linux/module.h>% X \: g0 `+ g' t
- #include <linux/init.h>+ _. y9 n6 c, U
- #include <linux/errno.h>( y' {& T; ?# N( x. |0 X/ ?: T/ x
- #include <linux/types.h>
0 d5 j5 l' t" g2 q3 V2 s - #include <linux/interrupt.h>% d8 P4 J% L" P1 j T% M3 `
- #include <asm/io.h>( A0 F0 `8 K6 A
- #include <linux/moduleparam.h>
4 f$ Z! n6 O- e% l- m% a - #include <linux/sysctl.h>
$ [ a) l9 u$ [, r, o! j2 [ - #include <linux/mm.h>
1 b! p0 ^! N6 ^& B. W7 ~ - #include <linux/dma-mapping.h>
2 M; S& Y6 `, z; L$ u" o - 7 I; S1 W0 v" b) n* C9 i
- #include <mach/memory.h>
2 |1 P# w" m: z( g2 H6 n: C - #include <mach/hardware.h>) g7 i9 D" U% P' X, F2 E
- #include <mach/irqs.h>
- _2 h" j3 D2 {$ S' l0 n2 U - #include <asm/hardware/edma.h>
, W" f; ]' b5 i+ R4 w j( P5 w - ! B; d$ I# V; Q* h/ g" A2 N/ j
- #undef EDMA3_DEBUG- r0 i) j T$ Q
- /*#define EDMA3_DEBUG*/
4 j, N, S$ P4 B* n) }, d
' j7 B2 g+ z2 u. ]2 L2 t4 {- #ifdef EDMA3_DEBUG/ A9 O3 k. v) [; G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). L1 X. c2 Z8 Y% _- S& `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ F/ }* D3 f/ \+ e5 V1 g! ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- \! C+ m5 V( A7 ^
- #else
+ p7 T! S: D; U - #define DMA_PRINTK( x... ); }1 }' m3 Y( h* \2 }/ Y$ j
- #define DMA_FN_IN
" [) |+ `) z0 k, H - #define DMA_FN_OUT
( x& P3 s: N: {: e - #endif+ T+ }4 o. @; T3 n& Y# C
* K2 B% P c, T+ c* G/ r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 U3 n/ j0 I$ E- N
- #define STATIC_SHIFT 3
$ G. k' n2 {7 b. ~- Q( u+ @! _ - #define TCINTEN_SHIFT 20% D# v9 V' M+ U& J* M: e
- #define ITCINTEN_SHIFT 21
5 L% Q I) C- e - #define TCCHEN_SHIFT 22
& G/ Y3 L2 W) D) b5 O& r - #define ITCCHEN_SHIFT 237 x" k0 |- u, J* @6 i! n
- 8 V/ x0 M* m' E+ P B' ?: \
- static volatile int irqraised1 = 0;: r: h; I* V) i* v. y7 N9 B
- static volatile int irqraised2 = 0;% M9 f2 B- D" H
- ' J Q/ m8 A; }8 q9 a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 c( n( E4 H( J# D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 z) d6 I' y3 _9 P- k, n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
f$ O2 W4 T. _. F7 [ - 2 D& \1 q5 F; Q& J
- dma_addr_t dmaphyssrc1 = 0;
7 s" @# E6 s! d9 B4 [) E( ? - dma_addr_t dmaphyssrc2 = 0;
1 m1 k, K5 e( i' K( r6 B - dma_addr_t dmaphysdest1 = 0;
9 c1 |" s. K9 _3 v, P$ z) ]3 G - dma_addr_t dmaphysdest2 = 0;
3 M C8 {3 X8 z9 Z( u
" `3 x8 L7 M) c- char *dmabufsrc1 = NULL;
: y, G3 y6 k. z1 k - char *dmabufsrc2 = NULL;) Z/ V! g4 }, j. I9 ^9 a: p' u v
- char *dmabufdest1 = NULL;0 y0 h9 a/ n8 w' F
- char *dmabufdest2 = NULL;
! k$ L( V' @; k8 k4 d2 z+ P; F( w - / {5 E) ?$ D' ~; K6 u) h; _) E' @
- static int acnt = 512;% J/ t! ]4 C" P: z
- static int bcnt = 8;
. j2 }: e+ D- A - static int ccnt = 8;
5 \' c5 y; Q2 U2 h) {! q - 0 @" R$ w( v* p' E
- module_param(acnt, int, S_IRUGO);
/ g7 {! o* t* R$ x4 O& t( V3 E0 b - module_param(bcnt, int, S_IRUGO);
# Y4 f: Q/ h, W5 b$ [& e1 V* Z - module_param(ccnt, int, S_IRUGO);
复制代码
- z. s- i" j% l6 B1 {9 B7 z- o& a! g* f8 B& Y3 q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 W6 G) W- R* f9 I) g u. Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* q8 B8 Q, @7 J2 V6 }. q& W) K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 n# ^8 Y7 ^. ~; [5 R& z$ D3 p$ g9 p* p, k
7 q2 t$ h9 M& P$ t, I |
|