|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 G) u( S+ O6 U# H
- [code]EDMA sample test application
7 a/ A& D A, I6 C6 u - /*
3 ?6 c$ r# a+ I. z' w; O# ~3 Q [ - * edma_test.c/ |7 |, N# ^' ], Q I; r; j+ {0 E
- *
! `% W$ K6 U t1 U5 F! n - * brief EDMA3 Test Application% i6 b1 j. ?) o3 t' q ?
- *
- q' L8 {* q: M - * This file contains EDMA3 Test code.
" l* I& h8 f3 V! F/ y) f& F - *+ u! B0 ^/ x3 {8 Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* O, Q0 v |7 _" C5 S0 {) @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% f6 `, l/ W: g1 c0 K/ I
- * TO CHANGE.
2 k# X' n# k6 w. y6 I* C - *, W# T- x# Q4 w$ |0 L/ f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 n/ e9 N3 b$ B) z- v% [ - *
, m7 |- q% L8 V - * This program is free software; you can redistribute it and/or; J+ F! w# b% Z1 p# k, f6 v$ ~
- * modify it under the terms of the GNU General Public License as) U+ y9 T' i3 \: I& o
- * published by the Free Software Foundation version 2.* ]: _3 r) D3 i0 `
- *
: X9 W8 `4 C, s& A6 r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 |3 Z: Q1 z! Y( F3 ?1 s - * kind, whether express or implied; without even the implied warranty/ f& l$ h6 g) E7 e1 X$ m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% ^8 O& O, d0 e
- * GNU General Public License for more details.
1 C( _' b* M. M - */
; h" ?' y) w$ j r% X - ! Y3 T) t( t2 k1 {4 F! A4 A
- #include <linux/module.h>2 K) D8 }# |+ t5 e3 l8 h; Z
- #include <linux/init.h>( G" u8 Q4 b% d4 R2 X& i! Q2 q
- #include <linux/errno.h>
& w3 D. _1 i V; b* }8 X/ | - #include <linux/types.h>+ W* w/ E8 n6 |* \% G( d
- #include <linux/interrupt.h>
" C3 m( h7 C' r - #include <asm/io.h>+ f) j# t- o# w5 U' r3 C+ R H
- #include <linux/moduleparam.h>
9 E5 J) T1 x; k" E - #include <linux/sysctl.h>: t; B# N: f. A4 p1 K$ L
- #include <linux/mm.h>
5 D' D# @7 w% }, C7 n" C0 n - #include <linux/dma-mapping.h>
[! H P: i4 n+ r4 T+ L2 R' Q1 G
. ?, J- U+ n1 f1 O: E7 v- #include <mach/memory.h># F* f6 n! k2 a1 \
- #include <mach/hardware.h>
4 r+ |) Z2 f, _7 Z9 O" H( w; { - #include <mach/irqs.h>
* {4 C$ G) R' w9 Y# W - #include <asm/hardware/edma.h>
/ c) G: q) n4 q* t* z
2 ^3 [. F+ \5 u; ]% l& F; _: |- #undef EDMA3_DEBUG
. o( @' ~2 i7 R( w [# x. J$ C - /*#define EDMA3_DEBUG*/% h* R5 v' u; w% _. l
- 5 B0 ^0 j) u! j' L
- #ifdef EDMA3_DEBUG
1 V) k1 B; B5 u6 ?" Z/ a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 M. v, X6 o, `1 }+ c1 J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) X) g1 N+ Q& X' w* K2 C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( h7 U7 ]! n; H& {' W - #else
( Q* u: f0 X( o( l- e - #define DMA_PRINTK( x... )9 e% c' L( w4 A; _3 I+ d7 k5 Z8 R; Q' N
- #define DMA_FN_IN
$ s; V+ r3 y% T5 K/ b - #define DMA_FN_OUT
5 z: d/ L6 n' Z2 _& t. b - #endif4 [+ P# O7 a- e. d
- 4 c4 W0 L5 |+ t# ~/ Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 t! |/ I+ ^: r( @ - #define STATIC_SHIFT 31 a3 _$ n' s G6 B
- #define TCINTEN_SHIFT 20
0 o' g1 s0 J% n* i' T) v5 u% m - #define ITCINTEN_SHIFT 21
& \! m: e u, }: P - #define TCCHEN_SHIFT 22
/ N/ ]7 D5 g0 @7 w8 k - #define ITCCHEN_SHIFT 23
% `. k* O' o2 i0 K - 3 g' p9 ]; t5 |0 ]$ E
- static volatile int irqraised1 = 0;8 C' @7 f2 S/ J- x( Q
- static volatile int irqraised2 = 0;
, f8 @6 i5 e" G M
4 C/ a {, _3 O* H0 K* V9 I I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% s# s8 B$ g/ b F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ R# \3 P1 Q; ^; L1 @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ `8 J# E+ A. c( A/ B3 ]' ` - $ Z# }4 W3 D2 x1 j# W
- dma_addr_t dmaphyssrc1 = 0;
- f' [7 v9 n/ t; q' }: I - dma_addr_t dmaphyssrc2 = 0;# i% ^# c" M2 d: I9 Y3 A
- dma_addr_t dmaphysdest1 = 0;
! \8 [) ^5 s! @, _ - dma_addr_t dmaphysdest2 = 0;
* W( |# M, x1 w9 e4 c/ \
F5 Z5 B; P. [$ s- char *dmabufsrc1 = NULL;: P1 A: V# {$ A$ W5 @0 E
- char *dmabufsrc2 = NULL;, K! Z% J* c7 A6 q O( @5 b
- char *dmabufdest1 = NULL;* j) i: p, s$ e5 z3 C
- char *dmabufdest2 = NULL;) k# Q0 D! I; S/ Y
- 3 i8 l- T# ~4 K+ K' c
- static int acnt = 512;, M7 U- A( t8 P
- static int bcnt = 8;/ r1 F% h& ?$ e2 W
- static int ccnt = 8;
. l5 e+ _, w2 I- ~) h, P( Q7 M7 e
6 S: w0 E9 o4 z- z4 _. [8 t- module_param(acnt, int, S_IRUGO);
1 _$ r' q/ d Q2 R. \" y - module_param(bcnt, int, S_IRUGO);8 V" ]. z }, J
- module_param(ccnt, int, S_IRUGO);
复制代码 0 G5 @) \# @ U# L
4 G# L& O! t- B1 k' u1 i! n1 c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 i. z6 ^( C8 w l
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 U) v) Q4 p- Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% l. O h/ ]1 _" F( T+ L! y% S
& B, Q9 I& J8 d4 w, c0 }; f: I+ J) z3 C# H! X
|
|