|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( q! a& n7 @0 ?3 j5 u$ L
- [code]EDMA sample test application
/ i: I0 z9 \" Y9 D. J3 I; P - /*
* Z e; z& X0 r0 Y X2 H - * edma_test.c
" x3 K1 S9 v+ u! U& l - *" C' }. ~6 H! A7 E3 X R2 i }
- * brief EDMA3 Test Application
4 L& j% u4 e1 x - *
! H: {' W. X1 Q* Q f+ n9 Z - * This file contains EDMA3 Test code.+ q. P! ^! M2 j; T# [3 B/ i
- *5 {0 ^' V& L' \% J8 g9 b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 B X0 d' ^8 ~$ u4 A( M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 L% I! i4 H F" W( s! E- ~: C) Y, m - * TO CHANGE.
" y# e4 T1 i- o5 p- r5 E& \ - *- k1 n! S+ t4 q4 {- ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 c. ~. {/ s2 ]8 G4 d+ `
- *
0 Z; m& N- Q4 S5 c1 E) Y7 T - * This program is free software; you can redistribute it and/or- ]# z: B/ q5 N* s/ h# g/ D- U
- * modify it under the terms of the GNU General Public License as* j& T* \; M$ D" Y8 y1 d
- * published by the Free Software Foundation version 2.: U) E) a- V8 _, ^: j5 |# r
- *- d/ y, N3 f9 ?# f1 h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 v' T; D, U+ n- N - * kind, whether express or implied; without even the implied warranty
: J( p* }! p7 F( R6 N6 K8 ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 m4 t$ g" M2 r" t1 z: U! | - * GNU General Public License for more details.
3 o/ p- u; q. `, z: _1 n - */6 n9 ? ~0 s3 v2 C
7 K4 y$ \# j7 ^" u- c) d% O6 y- #include <linux/module.h>
# [7 W( p, t C9 t+ K) {' _) ~ - #include <linux/init.h>3 w3 p4 ^) D$ N2 S# t2 y
- #include <linux/errno.h>
1 G" q9 D! u0 V) |" r - #include <linux/types.h>' [( J, x2 S x/ f9 q; w$ x5 C
- #include <linux/interrupt.h>) f5 |8 L/ v. O' v
- #include <asm/io.h>
/ V& L( @; B6 Y# ~+ n! W% r - #include <linux/moduleparam.h>
! s, t+ W: [! h, f' i - #include <linux/sysctl.h>
% R0 C' ^1 ]; u5 A% R( s- q" ] - #include <linux/mm.h>
0 D3 f$ Y" m b* C - #include <linux/dma-mapping.h>$ u9 G }, b; f! J5 ]' g. o
. M7 l$ U: R( m( d0 T- #include <mach/memory.h>
6 d: X4 P0 g3 Q$ N2 n& ~2 M - #include <mach/hardware.h>1 B) n5 _( x, r
- #include <mach/irqs.h>
* ~7 t5 f L6 E* c# k, Q - #include <asm/hardware/edma.h>
+ V$ [+ r; U9 {7 ^
2 L! Z# c# {8 O9 ]9 L$ ^/ j6 A; j- #undef EDMA3_DEBUG( c! y$ z( L7 V
- /*#define EDMA3_DEBUG*/' O s% x: n4 R
- $ I" Z6 u, O1 T) }2 s# O1 e" {$ B3 @# W
- #ifdef EDMA3_DEBUG
& Q! v; Q! d0 z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 d: p% T0 H) |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) K P: g7 W, u% q5 F$ K4 H8 Z+ o a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) }* H- c# _% P7 T0 x# j
- #else% N0 i$ S) y6 z
- #define DMA_PRINTK( x... )* ^3 `2 l/ ]; }8 V
- #define DMA_FN_IN$ c6 d. I1 v# S t2 _, ~9 }' R, W$ m- e
- #define DMA_FN_OUT4 T* r% o% Z l/ Q, d
- #endif
/ @. ~+ m* w3 V# u$ ]) W; `
4 `- a8 @6 c+ {/ S8 B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* t9 D6 x5 @! [' e
- #define STATIC_SHIFT 3. V" z$ y" Q o. R Z( m) I
- #define TCINTEN_SHIFT 20
7 ?: V: [1 r. a0 r4 C+ R6 U8 t - #define ITCINTEN_SHIFT 21- ^7 ~& V" }0 w
- #define TCCHEN_SHIFT 22! d% z- o( M! ^& t/ j% Q2 {/ F/ [
- #define ITCCHEN_SHIFT 23. A6 B; u+ `3 V3 r/ ]$ A/ W
N2 l2 E/ Z; U- static volatile int irqraised1 = 0;
+ p6 Z0 h/ E2 O2 H" `# N - static volatile int irqraised2 = 0;- }, b3 O8 n+ [- O/ E. ~& [
5 a$ Q O" C. k/ d% r" x! ] N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 Y) ^5 u6 S# @; y6 f5 l2 B) v4 u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 n' i% [! x* L$ a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' D1 p, @! Y: q
8 B) [. o1 D4 A, x7 L8 O5 \- dma_addr_t dmaphyssrc1 = 0;
2 a+ k. M+ l- y( ~ - dma_addr_t dmaphyssrc2 = 0;6 T# X9 G$ N+ \! s- d
- dma_addr_t dmaphysdest1 = 0;# a0 ^: R, j! k' U' o* j6 b: G7 A
- dma_addr_t dmaphysdest2 = 0; ~2 ?9 O7 y# h! ?! y2 P) F
3 b2 n( w: k' K! G% V5 f- char *dmabufsrc1 = NULL;
& g' F9 y [. R - char *dmabufsrc2 = NULL;
$ A0 ?4 C* d) w: f# I - char *dmabufdest1 = NULL;3 L* l1 d# D7 y+ r, f9 v: B
- char *dmabufdest2 = NULL; T6 h; T9 \* ]- B3 J
- / _5 [: k9 Q7 `# ?3 y" Q4 T3 H
- static int acnt = 512;
8 z8 V$ O) }1 }( W; n/ N - static int bcnt = 8;4 s5 ~. Y8 i+ ?& x; ?' J, }- e
- static int ccnt = 8;7 s+ \9 Y3 Z" K8 s, G" l0 ~
- `* {8 t( W+ I6 L% H* h- module_param(acnt, int, S_IRUGO);
1 n$ I: J) B+ F2 S - module_param(bcnt, int, S_IRUGO);
` @7 w Q# [& d - module_param(ccnt, int, S_IRUGO);
复制代码
, h7 x: O: u2 F1 _" I$ ?% C U! u3 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
K! O5 F+ t Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 r" Z/ X6 h9 g! r) d! O, V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- D$ k8 M$ e: @& v u
( ^6 f$ \9 M$ M- ^1 k. U2 [- ]8 _, c- o0 ^
|
|