|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 D% ?' m/ [9 T8 D/ M) T
- [code]EDMA sample test application8 g. E; _( }) T V8 \; p/ ~) m
- /*# J: k! v( V; c5 i6 ]1 k9 O. e3 B
- * edma_test.c, V) q& ^. E' G( U9 z/ H
- *& m% v: F" o: E7 ~% Z6 e0 D
- * brief EDMA3 Test Application* M, m m @7 I) Y3 r; m" S+ P( a
- *
: X9 h6 y1 @% L - * This file contains EDMA3 Test code.
9 n& q/ H- _* V* d8 K - *' D) X. c6 ~0 z: @( E/ o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% |" O# a( u8 I7 f; a1 ?5 V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ B' S' j7 a* e$ C% M1 F& L - * TO CHANGE.. Y* G" @% V( S+ p9 B! g; A* F
- *
! B4 o) `- J* e. d& l" r! m( _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 }& c: v; S$ F8 ^: m - *2 w: I8 r4 I4 X% L, `
- * This program is free software; you can redistribute it and/or5 k2 |: B. C% e
- * modify it under the terms of the GNU General Public License as& k0 R) \; E+ s
- * published by the Free Software Foundation version 2.
$ ^9 ?7 D( w7 I - *2 {. ?. Y9 d2 {' P) i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! ]3 a3 E% z5 i1 A
- * kind, whether express or implied; without even the implied warranty
6 Y3 _+ M. T; I" e2 ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& Y6 @# m, z, x9 A6 l# f- | - * GNU General Public License for more details.
+ g H, b# Z' V; l0 k - */6 ~* ?6 ~! T; t0 ^
/ N0 Z F8 N- F% q4 x' r- #include <linux/module.h>- r; g& j) Q8 Y+ e
- #include <linux/init.h>1 ]0 [* t7 s& L) p% D* N
- #include <linux/errno.h>
9 e: W! X3 E1 ]' ?5 h! N9 A - #include <linux/types.h>
8 T5 ^$ E3 X, U$ U& C( A# C - #include <linux/interrupt.h>
" t, O R t6 S+ ~ - #include <asm/io.h>
( A& l" ?) m1 ]! |9 F - #include <linux/moduleparam.h>
. Z8 M3 q& L3 @. y% B; E! B - #include <linux/sysctl.h>
6 b8 j. \( D5 F/ }! c8 y - #include <linux/mm.h>( l% i) f( m4 H8 ~
- #include <linux/dma-mapping.h>
0 [1 H5 N: K8 ~' A+ i! p - * W/ f+ l% I( g" w( i' R& g
- #include <mach/memory.h>
2 b5 x" _1 g9 O - #include <mach/hardware.h># J$ d6 E6 |' h# ^% u) [$ k* w
- #include <mach/irqs.h>
O5 r# V8 h9 f: v" p6 [ - #include <asm/hardware/edma.h>
8 E' H; f4 j O6 |/ M1 n7 V
, F' w# J' E% P& Y- #undef EDMA3_DEBUG
% P$ N# S5 a/ U9 a* B - /*#define EDMA3_DEBUG*/
' Z) `) r6 n' n3 c - / c' p2 i% u5 W: S
- #ifdef EDMA3_DEBUG
& \1 k4 ^& ]- _0 ~* t7 W9 W4 Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& v9 s, g L* m. f: \( v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* v7 H& d) { u$ Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% l" W" s8 a- t, A3 M7 E
- #else
) {0 L# E9 F7 i9 T4 F - #define DMA_PRINTK( x... )
& g! }- ^0 {) w7 z - #define DMA_FN_IN
3 C$ n0 u# r' k0 s5 ]2 | - #define DMA_FN_OUT
7 K1 c: E" x: Q* \2 p - #endif
3 H3 _1 B; a+ C1 o6 }1 z) K2 @/ c
$ J" o4 r7 t: K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& S- [+ Z2 g* [6 b0 j
- #define STATIC_SHIFT 30 T! n Z6 h0 Y
- #define TCINTEN_SHIFT 20
. I, o. `- v3 K, W# L( e- _) ] - #define ITCINTEN_SHIFT 21$ s. q$ \6 E4 a* Q
- #define TCCHEN_SHIFT 229 r& E6 S* f/ g: G1 a3 B
- #define ITCCHEN_SHIFT 233 F0 p6 S( U4 g- n
- % {% R8 L9 G% U7 ]- U
- static volatile int irqraised1 = 0;9 M- u t+ i0 j) u1 U
- static volatile int irqraised2 = 0;( H- u/ L+ V+ p% p1 C8 [( j* R& J! A
- : E5 \+ N- D. v c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 ^: y$ o4 g1 \! {/ t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, a" ~8 X% g' _0 n! q/ B0 I. ~$ O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. {! f9 x7 ]/ B/ ^! \) B - - |8 J$ J. A" U8 b: G9 |; V
- dma_addr_t dmaphyssrc1 = 0;; w7 N7 H/ C5 ^4 h2 m8 x7 `
- dma_addr_t dmaphyssrc2 = 0;
- f/ B6 H" f! r - dma_addr_t dmaphysdest1 = 0;
0 d! n: Q h$ c - dma_addr_t dmaphysdest2 = 0; m; ~, ?# A( k+ x6 s& H
7 r6 V; q2 ]: N5 M" g* \3 `+ ]: t- char *dmabufsrc1 = NULL;
8 N- b4 g+ Z$ Z9 W. G3 k - char *dmabufsrc2 = NULL;/ V4 L' S! _- v5 G- x* l7 t
- char *dmabufdest1 = NULL;
) q$ b1 S0 P1 j1 r - char *dmabufdest2 = NULL;% M2 ]% n+ ~$ t1 J
: A4 s" X) ~1 w( p6 ~$ L- static int acnt = 512;) s7 V% m: Q! S7 W+ f6 b. X
- static int bcnt = 8;
2 M5 ], o5 V8 z7 _+ H5 l: S4 } - static int ccnt = 8;
, D* \5 [- r9 l, ]6 t2 |( j6 H' X
% I( n8 v, i0 m! G& \$ B- module_param(acnt, int, S_IRUGO);
+ v5 K7 \9 q( j t* n: Y - module_param(bcnt, int, S_IRUGO);
5 ~2 K1 u* r/ }. G2 w - module_param(ccnt, int, S_IRUGO);
复制代码
) G; W. L) e; M4 L( s- r2 w3 e3 ?0 V" y6 ]0 n- d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* d. I1 ^0 a1 b. n f; `. darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) s, W1 D; t% P6 @( ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 Q$ X5 ~) ?2 |. i; X5 _" }7 {$ ?+ L7 D+ L8 H
$ ?. b# Z9 K1 W. b% ?1 ] |
|