|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* E. J( T# R) F# i( n- [code]EDMA sample test application
: o0 D& i3 u# P, w6 K4 `& A5 Y( O - /*$ e$ @0 N: M% T- f8 z
- * edma_test.c
) N/ C6 f, H" e - *
: ?2 P9 ?& u" r. i1 a/ M% ]2 d+ \ - * brief EDMA3 Test Application* y9 V% f9 z, ^& E R& c6 B( d- z& m
- *
* ~4 s: z- \; ]" T4 h - * This file contains EDMA3 Test code.
. t9 N# ~( z$ P: _" s8 _$ L - *5 N& y+ ^# ^, q6 Y# u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 Q) ~# u; `% _8 ~2 [3 y+ d9 N) a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 @4 K( Z+ R& @' ^ - * TO CHANGE.& ?( E" G+ p. K% k- Y. h2 ]) B* Y, ~( o
- *
" a/ r6 u! v! Z3 i2 Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 ~, b0 o' @, k! T8 p
- *
+ y: d0 [- w7 z: a - * This program is free software; you can redistribute it and/or' Y1 ~5 { e8 i2 f* ~' N
- * modify it under the terms of the GNU General Public License as
+ a* w; M( l7 B1 P( l+ j - * published by the Free Software Foundation version 2. O) w1 a% h5 F4 G( Y
- *1 ^' q. Y3 S$ ]4 l9 |* N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 k: b0 r& h7 y% Q
- * kind, whether express or implied; without even the implied warranty
3 z3 E, f' y( w7 j' A6 t* ^* { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ v3 ~. x. r, E, H8 m- Q# l
- * GNU General Public License for more details.; e- O1 \8 g/ {. o9 ^; j1 U
- */
2 h- I7 x* Q+ |$ g3 s
) a5 f6 M. F- g+ S7 M0 m- #include <linux/module.h>6 L6 V1 V* A, W r" z
- #include <linux/init.h>5 @/ E. u; l5 f( V* m' ]& x
- #include <linux/errno.h>+ d; v, I M& r6 {
- #include <linux/types.h>" e) e' N4 C# I/ I
- #include <linux/interrupt.h>! f( m' R1 x5 D; E6 E
- #include <asm/io.h>- i o4 V& B; t2 T4 f8 Y/ g' i
- #include <linux/moduleparam.h>
2 `7 e; E: _4 z* j) P- S - #include <linux/sysctl.h>, T. r. A. E& f1 H2 ~8 E; \
- #include <linux/mm.h>
9 W! [4 s) T3 D- g - #include <linux/dma-mapping.h>, h; q8 q; T& F4 h/ \6 C$ {! }+ v
0 x, O. M' v. F; g# Z z- #include <mach/memory.h>
8 ?1 R3 @' s; D4 g! f" I, a - #include <mach/hardware.h>/ M( T X% r2 \+ b2 N7 \# ^
- #include <mach/irqs.h>5 s$ H( ^6 [3 }% n+ v1 m
- #include <asm/hardware/edma.h>
0 c' H, Q0 B7 c* b, G' j
3 C" J3 J1 E" V0 i- #undef EDMA3_DEBUG9 w2 ~3 c* d$ W" e% s/ T# o
- /*#define EDMA3_DEBUG*/
. _1 r- f% N& ?& k& H- {* _; p - 0 ^! ?9 v) f0 u" A3 N
- #ifdef EDMA3_DEBUG' ~1 s! A( v; N5 m: g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* A7 Z E9 y' u' A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# z& M% l; ^( m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( a4 C# S5 Y# c+ q2 t( m1 L
- #else
& y6 g# ~- f7 [* g4 S6 T) g2 ^ _ - #define DMA_PRINTK( x... )
8 G- W0 Q* e% X! ~$ z' r - #define DMA_FN_IN$ Z, V/ Y6 v$ D$ K) B+ i
- #define DMA_FN_OUT
7 L6 Y4 f# V2 @4 I- g5 @% Q - #endif' D8 Z+ _' d3 W+ v$ F# @
U' C6 r ]1 F$ M8 `* u6 |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 ~/ o. o8 y6 h4 G$ ?- \: _( m
- #define STATIC_SHIFT 3$ s6 E" U! \1 ?0 m X
- #define TCINTEN_SHIFT 20( X/ k. q& x/ w* N8 m: b# T5 |
- #define ITCINTEN_SHIFT 21
% u9 M0 q# r2 u: s% j - #define TCCHEN_SHIFT 22! \6 g3 N4 M" h9 V s% s
- #define ITCCHEN_SHIFT 23. M+ N7 h) z" ~8 u e# d
9 m: y2 D* P y- static volatile int irqraised1 = 0;
; r" {/ T4 `( C3 g z1 I - static volatile int irqraised2 = 0; R4 C5 \7 {- H* G5 p: G
- 8 Q2 B5 p+ g K9 O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! W* o, e0 X6 s/ W: D7 _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# n7 ^8 i( b& T# H- Y \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" F2 f0 B' m; H7 t0 D: l: b4 ^
& Z/ R8 E, h. W, [9 W; Z8 }- dma_addr_t dmaphyssrc1 = 0;9 q' @% I" U, M: v8 s1 r/ t3 s
- dma_addr_t dmaphyssrc2 = 0;; X L' Q+ R* x7 |9 i5 _ K% V
- dma_addr_t dmaphysdest1 = 0;
9 k: k- m% w$ Q. T$ u5 u - dma_addr_t dmaphysdest2 = 0;
; M, F1 V$ ]$ U7 M# e: B: P - ) x) E! ^" S9 F/ M. n: O4 J) h6 \
- char *dmabufsrc1 = NULL;
8 O% _6 u u( f - char *dmabufsrc2 = NULL;
- R' K2 B$ ?! S, _9 o& D! w2 h, W - char *dmabufdest1 = NULL;
& M' `7 u8 ^4 `4 L( H* f - char *dmabufdest2 = NULL;' ]: f# I+ u9 {( h$ X% F
- " H4 ]+ c% W1 c7 @, x t% y2 H- n: {
- static int acnt = 512;2 t9 R, f: [9 K/ U# |6 H
- static int bcnt = 8;5 b/ s* `- ]; _7 R
- static int ccnt = 8;
1 A, Y6 \: E8 y
$ o& W2 k0 c |' k- module_param(acnt, int, S_IRUGO);
$ t2 Z4 f3 B% g4 Z7 ~& `8 b) r) E - module_param(bcnt, int, S_IRUGO);3 J* K! M" c; O: A. T
- module_param(ccnt, int, S_IRUGO);
复制代码
6 p& e; ^) L% U" l
; O; c+ A o# ^( j3 f" v! Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 z: [" w5 n4 @( `) S: G& D) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% q$ |( B7 N2 @4 B) g( T1 t4 u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 I6 B5 j" V' C$ W. r0 Q4 C3 D& e" O& h9 L% \
! w% K1 r V; e! {; L0 O
|
|