|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 \$ _. c: k' k7 ?! \
- [code]EDMA sample test application1 o; `6 J7 `5 z0 q/ S- D* h
- /*
- }# z6 J$ ^2 P0 [7 F$ i; E* t! | - * edma_test.c! c o" _5 {/ N& I G0 G
- *
/ V2 m; E3 X, u - * brief EDMA3 Test Application$ n3 r3 r2 W; U1 R: r, G3 H! m
- *
8 n) n1 i. ?+ x' R0 |" Z& z/ j - * This file contains EDMA3 Test code.
$ }& x6 m' I, }% U - *
3 k. Q/ X5 f& K- Q& X1 R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& u8 R: H, h0 p: o$ L1 K8 U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 z/ c5 K, @$ j& H" J; k
- * TO CHANGE.
; X* C6 L' r+ ^ - *) e F. p& A3 |3 L8 l) T9 T, w& o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' K% a4 G+ m) R
- *' }6 I" Q) y( {$ ^2 W4 S$ u$ j+ P
- * This program is free software; you can redistribute it and/or
) N. W' D3 n; {* R2 [ - * modify it under the terms of the GNU General Public License as
! b4 J( K6 T2 d: U& ?& E, o1 ` - * published by the Free Software Foundation version 2.* L% T/ l" n5 \& a: [1 |0 [; Q
- *
* ^0 j) u: ]% N5 c9 n1 B! ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 @. H; z) G" w0 N& \7 O3 y* Q - * kind, whether express or implied; without even the implied warranty
! s- c% U- q7 H1 j9 ~1 B2 g# } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; a0 g" F8 T+ ]0 h* j! e- Z/ ] - * GNU General Public License for more details.
8 K3 ]1 T" E3 Q, ? S- h& ~ - */3 M f2 i1 p R
- ) D1 B* H; |* x5 p* A5 r8 E
- #include <linux/module.h>
8 U0 ~. H7 r' T3 C - #include <linux/init.h>( u5 Y' j2 N5 x" U8 {
- #include <linux/errno.h>2 J" C- Z& C' Y6 l9 R
- #include <linux/types.h>
: C0 m8 A& M4 _5 w - #include <linux/interrupt.h>! R% p% z. h8 I: t! }2 W+ m
- #include <asm/io.h>
# {* O. J2 H$ \9 ?7 B0 \ - #include <linux/moduleparam.h>
/ A) z% c7 w( E0 |8 E# m; i1 o% ^ - #include <linux/sysctl.h>
" f! v$ c) g b% q& Z* \$ h# ~ - #include <linux/mm.h>
k) G- }: x1 u% |5 M2 W* ~, f - #include <linux/dma-mapping.h>
1 {5 f2 | z+ L - ( H5 N, j9 O" h1 }: f- w! _: y
- #include <mach/memory.h>. H2 s1 ^0 r* S/ j+ m
- #include <mach/hardware.h>
) h: b! A! _$ i1 r - #include <mach/irqs.h>2 M9 _, @& K& \- G: ~* o, O
- #include <asm/hardware/edma.h>7 W+ A( X& F! @8 y/ E& ]7 p7 J
- 9 a% Y6 O8 G7 y- K2 R
- #undef EDMA3_DEBUG$ ^% @# v8 ]/ u. E5 x
- /*#define EDMA3_DEBUG*/! x: g8 w4 r# x' G4 n. v
- 8 d4 o3 |7 Z; `) q( L1 r
- #ifdef EDMA3_DEBUG
+ }, j3 [ u) ^( M. }- Q0 @, F/ N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) [+ U! ?3 u$ Z( i1 t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- O- f0 `: a+ \) ]: M* m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 u$ g! w) Z6 k5 L - #else; Y: c# ~* ?# E: | R
- #define DMA_PRINTK( x... )$ [7 o6 H2 G- V3 P% D1 D0 g+ _$ \
- #define DMA_FN_IN7 k0 Y& \6 L: Q7 h+ Z
- #define DMA_FN_OUT
+ d" x6 y. v: A - #endif
6 C' T3 v9 O; }4 T4 r3 N2 O - ?, g2 u$ t% m( B2 h \, r4 U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! _6 k; N% F) Z+ ?3 `6 Q& \
- #define STATIC_SHIFT 35 b7 R, I$ `9 ?* \
- #define TCINTEN_SHIFT 20
% v2 Z7 d( N# W/ H; J - #define ITCINTEN_SHIFT 213 |9 A# }0 x3 T" ~& ?
- #define TCCHEN_SHIFT 22
9 g$ X B) s$ ~. D0 ] - #define ITCCHEN_SHIFT 23
7 w* i7 d$ U7 d: c1 u2 g9 | - , G l/ ]) p5 K& F) a! c
- static volatile int irqraised1 = 0;2 c& i% U% _2 D) h7 k; k( m
- static volatile int irqraised2 = 0;
! j1 g: N1 ^! N- n) r
/ Y' [$ H4 f9 Z8 E1 r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 B( D) Q3 {, j& V, R) o5 U- y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 W8 V' G) x V$ P9 k1 c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% \) B1 B! b7 Q" I3 |
1 j0 |( s9 U2 }& E8 n- dma_addr_t dmaphyssrc1 = 0;, {9 ]6 P3 ~+ t8 r4 R
- dma_addr_t dmaphyssrc2 = 0;
% M/ [* U1 |% r8 y K: U7 k$ @5 e - dma_addr_t dmaphysdest1 = 0;
- r4 {' R- M5 s) } - dma_addr_t dmaphysdest2 = 0;
8 V& c3 ]. n) y5 }: s6 G6 J
+ ]0 x- _1 T% e' T8 }7 S- char *dmabufsrc1 = NULL;
5 ?) Y$ K _ p0 g* J+ E4 Y - char *dmabufsrc2 = NULL;
3 b3 H1 |+ T- T S - char *dmabufdest1 = NULL;
* ?- G2 S2 U# [8 \1 M0 |/ B - char *dmabufdest2 = NULL;
7 k+ U1 F9 s. n& j* K3 `% |2 z - / R x; m N: y, A! U, ^( u8 V. G
- static int acnt = 512;
" }6 \8 l0 w. E7 @ - static int bcnt = 8;9 S0 F) d; i# x" E4 b
- static int ccnt = 8;
7 A. [" I; J- y% B1 j- B" s5 S) {
" N' F/ Z3 D! A* K m4 P% q- module_param(acnt, int, S_IRUGO);
) D8 f" I2 k3 n$ ~; p. K - module_param(bcnt, int, S_IRUGO);* a" G% Z; W( I! u6 c* |) b! I* ~0 c7 z
- module_param(ccnt, int, S_IRUGO);
复制代码 ; g7 g; Y; \- f9 }. q( S6 b+ x
% z* b1 {3 D9 U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# X8 g5 v/ `( j, 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 ]' p( ^1 u+ | u: u) m) h5 ?. ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 ~. k2 ?1 ]) G( L. b0 ~
; o8 B3 J/ O# v( C: q0 \, ?8 _- [0 c2 J/ d8 C
|
|