|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 |3 u$ Y6 {) ^6 B/ ] W7 P, L
- [code]EDMA sample test application
8 M b( @6 v6 _1 y! c7 U/ S - /*
: S3 p0 @5 \; I/ y" F/ t' `. j' D - * edma_test.c. D( v0 C* T* f
- *! q3 d: s" ~3 s
- * brief EDMA3 Test Application6 O3 x, q8 \- j# D
- *& e' R/ z) C/ k3 G. b
- * This file contains EDMA3 Test code.+ d1 [0 h& j9 @' i0 w1 @1 d, b6 h
- *
! \7 m7 l* b: b; H" V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' s* V6 A4 d; L& i- G, h* B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 u6 g5 i! A5 n8 S/ }* g! J7 _7 z
- * TO CHANGE. V! R5 Q6 M3 w4 g
- *
8 `8 |/ a. o9 A) u- l0 t. z. n. s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
H5 ?, i/ O6 j! ?0 U2 E0 u8 b" m - *# L) D& @( P) |
- * This program is free software; you can redistribute it and/or
2 t, l! Y. l7 d( |$ K - * modify it under the terms of the GNU General Public License as
8 n6 E, t: M" z - * published by the Free Software Foundation version 2.- i7 w# t$ E& g; E% l1 ^
- *) }7 I1 r- o& c6 R+ b5 k0 N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any m, `. q5 c( `9 @; u9 e/ ?+ f& l
- * kind, whether express or implied; without even the implied warranty7 d3 w6 x' C. r4 c# \+ X8 f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* o4 s" |% A& m% ` - * GNU General Public License for more details.# L! G% v& i/ S4 L9 k% W2 K
- */3 ^8 d3 R' ?9 n+ Y0 l; [
- : s1 h7 w! Z& S6 j& Q. @
- #include <linux/module.h>
4 R/ L1 ?9 k+ Q - #include <linux/init.h>
2 t4 c H% ]. i - #include <linux/errno.h>
3 z( _0 l# E Q: |) q" @2 t. h, n - #include <linux/types.h>
0 M/ S* y1 G$ I8 m& e( J: e8 w/ G - #include <linux/interrupt.h>& w6 T" j3 s+ J1 L3 ^3 m
- #include <asm/io.h>$ D0 P% z1 M/ I+ R. {8 ?$ J, }
- #include <linux/moduleparam.h>
4 ^, s9 v# I" q1 e2 @$ i" ^* \ - #include <linux/sysctl.h>
5 B. y/ M( N0 L# ^+ U4 T; P9 C" i - #include <linux/mm.h>
- ^ z# {7 W; @# } {/ R W5 }" W - #include <linux/dma-mapping.h>) G1 ?% o/ ^- p- ~5 |; N U
5 h6 Q& X2 w) J# ~/ y- #include <mach/memory.h>
, L' E, n4 g9 L* S; N' y - #include <mach/hardware.h>) `1 S C- m/ l* ?! a Y
- #include <mach/irqs.h>
$ a2 y+ m. a8 h% n - #include <asm/hardware/edma.h>: [3 l/ Z( i6 e1 c1 D* N, h
- " x+ ?/ a4 a+ B( O0 r
- #undef EDMA3_DEBUG6 _2 F) T w8 E
- /*#define EDMA3_DEBUG*/
# }, Y% M; N$ s$ { - 2 g" C7 Q/ I/ e) ^6 U) N
- #ifdef EDMA3_DEBUG$ V9 p+ p3 Q# H' t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 M- @* o. V+ G: z' u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. `/ v+ u a3 U$ Q: h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ X- Y' Y- S3 ?. I* P - #else, C0 G+ D. d, T
- #define DMA_PRINTK( x... )1 C9 u" v) n B2 Q0 t/ |
- #define DMA_FN_IN
5 f7 t- t4 j" P8 i, Z2 p2 b - #define DMA_FN_OUT p, k0 ]# g) B! C6 {
- #endif* x; ]$ Q( I+ r# I
- / G! @& O/ N1 @1 [- a# ~4 n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) o5 K: O1 U8 d# j# {+ S! N. S: N - #define STATIC_SHIFT 3
- Y7 Y" ^& E9 P& [5 N5 W8 V, ] - #define TCINTEN_SHIFT 201 T6 d3 _& _4 ]4 R; M: B4 r
- #define ITCINTEN_SHIFT 219 `' I' E% `1 y0 Z8 l
- #define TCCHEN_SHIFT 22
$ B" T: }- z2 g/ c$ E - #define ITCCHEN_SHIFT 23. x, |6 e. |& {' l$ ^' N' t
/ j; d, _, q |- static volatile int irqraised1 = 0;
" s4 U5 s6 K7 ?8 e; U - static volatile int irqraised2 = 0;
3 F' o! n* I) F+ F
( g+ h1 \0 C. {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: m! k3 x i5 ^& B4 b. r; h6 `5 _, | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); ]# h6 z( [1 [( b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ R4 N6 I2 E+ V1 j
8 z3 H" u @% A- dma_addr_t dmaphyssrc1 = 0;0 u4 U$ u% y( x8 J- m7 H
- dma_addr_t dmaphyssrc2 = 0;* N4 ^: I1 } C& q/ D
- dma_addr_t dmaphysdest1 = 0;
H% l% _% T, G - dma_addr_t dmaphysdest2 = 0;0 D, J) v3 Z' l' J. G
3 H/ j$ L( L4 ]- char *dmabufsrc1 = NULL;
' c7 D; |$ n3 C6 A) O - char *dmabufsrc2 = NULL;' S2 U# l2 Q8 ~3 }6 h2 D" W
- char *dmabufdest1 = NULL;
w& E: Q! M/ A! D/ m6 ^ - char *dmabufdest2 = NULL;" h2 G6 h7 K0 Q E) u) }9 V
3 D8 @- T) w& T4 l) i- static int acnt = 512;
3 K4 A0 l9 z- \5 C0 C+ s8 F - static int bcnt = 8;
! \0 C& b6 { V( \, f: g - static int ccnt = 8;
1 F( F, W. c/ L# I - * R, F3 Q! N" N% L7 f6 C2 p9 o
- module_param(acnt, int, S_IRUGO);
# m& n O3 @+ I - module_param(bcnt, int, S_IRUGO);
$ }! S6 J( J8 q; ~9 ?' T9 F - module_param(ccnt, int, S_IRUGO);
复制代码 $ z' c% f0 I! s; Q+ j! v$ X
( [( `8 L$ W8 `3 ^4 _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! e Q1 O' P* U% r/ h! e9 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 z V* i/ ]4 n# k5 ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: s$ Z0 q& d$ F0 e n9 n) O! l5 I9 S" d: z. `1 H/ |8 M: ?
' p- U& r# P! r# I
|
|