|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- {6 C. w3 N: Q- a# e- [code]EDMA sample test application
; V: Y) ~* w2 s - /*: Q' W+ W+ }2 c) o* g3 k6 Y6 m9 a1 F
- * edma_test.c
/ i* a! x6 p6 u& B# ~$ M - *) b ^! p J. q% F3 k' Q
- * brief EDMA3 Test Application
3 H; f+ i+ O# Z1 ` - *6 a: y: g N6 @( I
- * This file contains EDMA3 Test code.
# p7 D5 F4 F2 V6 B - *5 Q& c0 O9 t; @0 w6 c7 P, T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; S& W) q, b( K* h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 y4 d. Y; I, h/ b+ b" s" `- b+ Y
- * TO CHANGE.! H M( w% w- ~; s8 b
- *
1 |* g" u" X% U! u5 y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ Y: { t1 f ^2 O
- *# i( t( o. n) X% z! n" n$ |
- * This program is free software; you can redistribute it and/or
4 v* y7 O' O. O8 C+ I4 N$ Q - * modify it under the terms of the GNU General Public License as( h: F0 M- b W1 i3 Q1 G
- * published by the Free Software Foundation version 2.8 |4 I# D* Y, Y$ p% R1 j
- *
% z5 H% r: I1 Z3 [' y6 Q/ d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- r6 E' b0 R' {$ C0 F9 x$ A+ Z
- * kind, whether express or implied; without even the implied warranty( |7 F7 ~4 ^' ^; k# n1 j! f4 ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 c7 V4 V" ^' G; Z4 ?4 w3 E$ X
- * GNU General Public License for more details.- X3 c4 \ f/ {( C( o& L, @
- */( [! F( i) X% R8 x
- r; \3 u0 G, @2 l
- #include <linux/module.h>
% Z; z% E. C; K$ Y8 m8 t - #include <linux/init.h>, J, Y. k: Z1 |: q
- #include <linux/errno.h>
! {) C( u, _: v; S. i- o8 R - #include <linux/types.h>
; X2 c. _0 B" @ N+ I; x* V# Z - #include <linux/interrupt.h>
" k) D* c" L$ J. J; v5 O0 J3 B9 |' w, ]+ D - #include <asm/io.h>
; s0 z/ w% V2 y6 } - #include <linux/moduleparam.h>4 g0 k$ v" ^2 H; N; |
- #include <linux/sysctl.h>. i$ h( S7 n3 |4 Y; B; [5 }; ? V
- #include <linux/mm.h>
9 H3 O: z. E' ?! z - #include <linux/dma-mapping.h>- o: I* i$ F% |8 K
- + Z1 j" H P, {$ t4 {& c
- #include <mach/memory.h>
! K3 X# M. C2 d6 C% x) a - #include <mach/hardware.h>
; H) g& \# o' \1 l- ]4 O - #include <mach/irqs.h>& z3 `0 j7 ~- D! C& X
- #include <asm/hardware/edma.h>
0 }! O8 M- V+ |) l {6 M% A - ' |5 Y) p* v& v
- #undef EDMA3_DEBUG
. ~* g5 v( s4 w - /*#define EDMA3_DEBUG*/
2 S7 I, s2 d# v( w2 l3 |
8 L5 I9 t$ Z( E9 u: z& e% x/ t- #ifdef EDMA3_DEBUG
2 x/ n! `# A1 m) @5 Q/ A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 W" A( F! T' H7 j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! B8 e) N# ^8 d0 w' [! c; N5 V* D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, w" {/ ~- \7 v, ~. T+ y - #else- @3 }) f0 L7 S0 @+ F+ I5 Z
- #define DMA_PRINTK( x... )) ~/ U( x1 t: R1 m2 d7 O
- #define DMA_FN_IN
8 j/ q8 {) Z3 K5 o7 y2 J! v( ], [; ` - #define DMA_FN_OUT! J4 D+ I7 \+ W+ w
- #endif
2 c* s8 L3 u4 ^ - h, U* S7 K$ s5 U3 L# i( Y# _: ^5 b9 N6 S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 U, F/ r, `2 U1 K: Q) T: a - #define STATIC_SHIFT 3
* M: E$ f/ c, P - #define TCINTEN_SHIFT 20
8 Q& V# E$ @, [4 g' j; _1 p - #define ITCINTEN_SHIFT 21: R# D f- ]5 _/ w
- #define TCCHEN_SHIFT 22' h8 C' U9 |" l$ ^7 Z
- #define ITCCHEN_SHIFT 232 b2 Y4 ~' C6 h( n% h1 `0 n
- 9 d7 e$ s$ F6 l
- static volatile int irqraised1 = 0;6 T3 R Z ~1 M$ ^
- static volatile int irqraised2 = 0;
' ^1 X$ h4 U0 _' E" i7 M - $ u; b0 }4 @: V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, M% R, f3 v" n1 @# w& b3 ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 w3 _- U% ^, k) R8 C1 s4 {# Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& m; c O3 b* @, h) I3 Z
; E# a3 `; z2 W5 y( b. \; p6 j- dma_addr_t dmaphyssrc1 = 0;
! x4 h& Q' L# K7 ~ - dma_addr_t dmaphyssrc2 = 0;
. H4 Z2 [7 G1 f5 a7 O4 ]/ d7 K0 v - dma_addr_t dmaphysdest1 = 0;9 l' x" Q' A6 r2 _, l
- dma_addr_t dmaphysdest2 = 0;6 A# n" Q, d& F/ R
( y8 G/ I+ G) [0 u" e* K L9 M9 o- char *dmabufsrc1 = NULL;
5 K0 [7 t! k% `6 D5 L3 V - char *dmabufsrc2 = NULL;
; q' T8 E' S. ~! s1 {8 Q( i6 R - char *dmabufdest1 = NULL;
+ D/ X( h; A3 S0 r - char *dmabufdest2 = NULL;
! _- `; f! s) u. K - - P: b% F5 L( B6 a( G
- static int acnt = 512;/ }6 q' T4 ], J6 x2 ^ T& }
- static int bcnt = 8;
$ ]3 o; z4 F) E; a; a8 r4 K$ i - static int ccnt = 8;, ?/ N4 ? e6 X8 f; t0 D
- _: A8 @1 u& O' v. D; G, H( z- module_param(acnt, int, S_IRUGO);; `4 {$ C" x; Q( v- I6 I h
- module_param(bcnt, int, S_IRUGO);
, k, `) R9 m2 M. B3 N7 q3 y - module_param(ccnt, int, S_IRUGO);
复制代码 & K. Z: k6 o U4 d- o
) v- y8 p) q- t! f. C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 D8 m& ^8 q2 qarm-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 X# \! }: g$ m# s# `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: D) x. M& Q$ t0 k, { [- u4 i1 W* u4 ? ]. K1 t
, v7 U3 n ?' R, T
|
|