|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! p5 _8 g1 a7 h% J$ M4 d8 N- [code]EDMA sample test application2 Z8 S" K+ J2 S8 ?0 Y
- /* L! n- z- D7 N% |8 V
- * edma_test.c; T: Y$ Q# F2 _* F1 y" B. l
- *
* s/ n6 S! B8 L - * brief EDMA3 Test Application* f/ {: Y; W0 h+ M
- */ W% ^, ~( M) h) Q; C& Q- z7 W
- * This file contains EDMA3 Test code./ h4 r3 s- i$ U7 v: |/ a' W7 x
- ** U. Y8 Q4 ^7 k9 _3 h! P S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 G+ }; N" u. ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 Y% x' O. f* L
- * TO CHANGE.8 ~. x Y, @6 v* y3 D1 I: H5 W
- *5 {( r* a P7 x( w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 J! Z. N! T9 F# y6 k$ i$ }
- *
' C& T6 ? U* v - * This program is free software; you can redistribute it and/or
4 L# o1 S- O# f; R2 D* c - * modify it under the terms of the GNU General Public License as
n5 P% i& v# z* G: i - * published by the Free Software Foundation version 2.
9 E3 V0 F* ~3 q! i - *
& I/ g9 ^, I: G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- d+ B1 w* J- E7 T# l+ W - * kind, whether express or implied; without even the implied warranty1 J- F" O8 Z [ g, ]7 O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! F# o+ k) T W% U% F& d$ B7 V
- * GNU General Public License for more details.4 @# E4 k! q9 O+ @. J9 c$ h8 I% q
- */
8 R- e6 d/ e6 M - . T* _/ Y3 Y7 q, v& \; m- k1 e- ^
- #include <linux/module.h>
0 j) K" }$ D8 v$ `5 c V - #include <linux/init.h>
, g- Y( ~( ] H# P, n6 ] - #include <linux/errno.h>
9 T& H: Y1 b: k7 U" q - #include <linux/types.h>8 B# r5 @; q3 {5 |& P0 A4 P" a. G6 k
- #include <linux/interrupt.h>. x2 w/ ^- k* M2 N T
- #include <asm/io.h>
# z5 s: T0 e! D% |% J3 l, j - #include <linux/moduleparam.h>
" @9 ^% y8 X& v3 H: a - #include <linux/sysctl.h>; |( L7 Q# r8 o6 n
- #include <linux/mm.h>
* ^ `8 Z1 m. B. I1 s' o - #include <linux/dma-mapping.h>. E- T: T9 z7 [ j% ~ B
c2 v8 t4 p6 U: [* w) I- #include <mach/memory.h>1 q" t8 r7 N# j( m; w- p
- #include <mach/hardware.h>
- `( q- H. O. {5 Z6 b# s. e - #include <mach/irqs.h>
: s" |2 O1 J# q# Y& [$ S c4 b - #include <asm/hardware/edma.h>
$ x3 M( x8 q4 C - 3 M9 f0 |# `8 v# ?- A
- #undef EDMA3_DEBUG, x! Z- f8 [; y! m/ E
- /*#define EDMA3_DEBUG*/- [9 O1 Z# V; U W$ h
3 k. N$ T, l3 j5 p/ h- #ifdef EDMA3_DEBUG3 S, c/ ]# S, T' i, e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& d1 w3 H; c% ]$ D N# i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 b" I* R9 s$ ]# c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) [( a( j) t# i0 [) M - #else- L s5 N5 n: I8 w
- #define DMA_PRINTK( x... )
% v( ]7 C' {* l8 x8 G, b1 @( m% m; s) s - #define DMA_FN_IN
+ L' M1 y. p. R5 R8 t5 T - #define DMA_FN_OUT
5 |. @6 t' i% ` - #endif! C& {* p3 A2 I d
- * Z# A: e' X4 t6 I B; o# o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) h! x, z( [9 h - #define STATIC_SHIFT 39 I4 } Y' {! D' _# A/ q
- #define TCINTEN_SHIFT 20
) t4 P5 {4 w; q - #define ITCINTEN_SHIFT 212 J4 Z" V2 ~& m _3 ^ ~
- #define TCCHEN_SHIFT 226 t; g' r* e; j8 ?; a
- #define ITCCHEN_SHIFT 230 d! R& `7 |; K7 v7 M- C
- 3 k/ ?% t2 f' u8 v) G
- static volatile int irqraised1 = 0;) d0 v; M6 O! Q& `( C0 |
- static volatile int irqraised2 = 0;
5 t. S* I+ e8 @- h0 r. ^
$ g+ ?% ?2 ~% X& p! K0 n7 O, X, k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
i- l8 K# v3 J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 H* T, i6 H6 N/ i& S, i% I% P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 K; v: Z5 b3 d
- 4 S8 _7 y& \3 C' G& I) N
- dma_addr_t dmaphyssrc1 = 0;* @) F! R( C9 [. i5 k( |
- dma_addr_t dmaphyssrc2 = 0;
/ O) }" s. a! h9 m4 J3 l2 X4 p - dma_addr_t dmaphysdest1 = 0;
1 d# C, K' r6 F. i% _5 n8 z* z - dma_addr_t dmaphysdest2 = 0;
- P U( k5 }+ q7 }) R4 P: ` - # I+ ^3 l7 F2 y& ?% `' Y6 L
- char *dmabufsrc1 = NULL;, v/ @+ m4 B8 j- h8 k$ F
- char *dmabufsrc2 = NULL;
1 R6 f* s; R3 |' J: |; [9 O0 k - char *dmabufdest1 = NULL;) F" i2 Q7 H5 J- D1 c; y* O' P
- char *dmabufdest2 = NULL;
; Y0 U. H. y" r8 b& P" ~4 C4 V
( j! s' w: a6 ~9 { d2 R2 n2 [- static int acnt = 512;6 C. P* v& V' }; I0 M$ N' U
- static int bcnt = 8;
5 u4 k) C9 e0 B" }1 { - static int ccnt = 8;
6 R) I& I# y$ T7 E7 s0 @
& O8 M' ]; t* T1 C1 c$ e- module_param(acnt, int, S_IRUGO);; C+ v# q0 X# C1 e
- module_param(bcnt, int, S_IRUGO);; p! p/ J3 g N7 L
- module_param(ccnt, int, S_IRUGO);
复制代码
+ I# q' g- E( n1 |8 J0 t7 k2 W- j& U2 B: l4 A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" C& \8 H8 C" c# e3 ^) c! n9 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' D/ v+ v" w; u8 C, i9 J1 H% u- f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 c- z7 i' J5 Z4 D6 ^/ k
3 {4 y3 u4 w. P' |4 m2 L0 S
* C! z- ? ?' j, d" _4 E
|
|