|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " Q* A, Z1 m; W* l- Z
- [code]EDMA sample test application p k2 a: l/ R
- /*
1 V2 \9 T) f# v4 h D) }* o6 b - * edma_test.c
: d4 w5 Z" o5 _ l- b1 c - *
# \: E" \6 N* \; v. b- r5 D+ X - * brief EDMA3 Test Application0 ]0 `6 y7 g2 r4 k1 q7 d2 G* S9 x
- *2 M- D" X& D: h: `+ W
- * This file contains EDMA3 Test code.6 O; O; [4 l: c' d3 O6 S e1 K1 C
- *' Q& }/ i3 y, b% |) H! J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! A: B: m4 i8 x2 c8 [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( O$ e" J. u, x a - * TO CHANGE.5 {: S9 W+ L3 g" J: N
- *
% C. I& x4 m" D$ `. k+ z5 s; K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ o# l6 u' s( y- D - *' s$ I6 E$ b* H
- * This program is free software; you can redistribute it and/or; I, ^4 i. {; X" O# H1 a: m4 K, g! S: h
- * modify it under the terms of the GNU General Public License as4 m- ?5 k/ {7 f6 K: F$ Y
- * published by the Free Software Foundation version 2.
& O" z( |4 p( N! [8 f - *
" [* ^7 R7 u. n' e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% Z' q B7 |- n4 y6 B* K, q/ E" W - * kind, whether express or implied; without even the implied warranty: @0 |( r8 A- e4 O8 Q4 T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! a% W$ s1 e! J4 J \# Y
- * GNU General Public License for more details.
& q: }" @4 q5 G% b7 f8 Z - */% K; D0 [0 I( ?* v- T6 v6 I
- / F# p: Q- c1 h+ [& t& G
- #include <linux/module.h>
) H; D4 V% I# P- }1 N o - #include <linux/init.h>
2 G6 M; v/ s+ ^. D - #include <linux/errno.h>6 O. _9 r" {. }
- #include <linux/types.h>4 _6 \8 G7 p/ u2 n
- #include <linux/interrupt.h>
3 m* @, l# a* @7 d - #include <asm/io.h>6 E- T% C3 {! \: b
- #include <linux/moduleparam.h>
" r2 \, r6 J9 A; r - #include <linux/sysctl.h>
" r: t" k/ M/ Y" G - #include <linux/mm.h>! Q, }! ~9 y9 {
- #include <linux/dma-mapping.h>9 Z+ l. V2 L5 V% l
{( F! l$ U9 A4 s- #include <mach/memory.h>
# P2 i; u1 n7 g& T) O2 l1 n( H; l - #include <mach/hardware.h>
8 H! f/ n2 S5 g+ N - #include <mach/irqs.h>/ p; J# I5 E7 F! k- S4 P. N
- #include <asm/hardware/edma.h>9 P4 S. G6 h5 B% |) _9 F6 J8 k" x. q
- 7 Y& k" h: j5 S8 o3 H5 U
- #undef EDMA3_DEBUG+ g" Y4 R* h6 c2 {+ V
- /*#define EDMA3_DEBUG*/
5 E: N# f4 X2 E& O$ s
# U& I! B5 P# a/ F `6 t9 D- #ifdef EDMA3_DEBUG
1 Y* g! z" m# p2 X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 i9 B" J* Q) |- L& A+ h- U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 N$ f3 |( |5 d0 j ]5 d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, g! L5 |8 c( V! F. z - #else
# |; J) Z/ i/ ^ - #define DMA_PRINTK( x... )" j7 q" U- H; `/ M0 ^) E
- #define DMA_FN_IN
" G/ N$ w. Z8 d( z! ^1 E" o2 A - #define DMA_FN_OUT" ~' @( u7 Q) l
- #endif
: ^5 V, e; D; `" d# l+ K
4 N8 W3 n, X3 T" S7 p7 Z2 O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 l5 V% t! N4 n& j - #define STATIC_SHIFT 3
0 R" ] Y& I9 o! T* U9 B - #define TCINTEN_SHIFT 20
, {- X# s, d+ J# \1 R4 {8 F/ ?9 a - #define ITCINTEN_SHIFT 21
+ G+ D' Q- _# ^6 h* a0 j' b - #define TCCHEN_SHIFT 22
2 g. M; H2 I8 q4 S/ t- n- S9 P% M - #define ITCCHEN_SHIFT 235 g2 R6 Z8 M4 B8 ~
' v9 m+ j' ~1 j: v! q ^9 J- T# m- static volatile int irqraised1 = 0;6 m# k, a7 A8 F0 k% a0 ?. ~
- static volatile int irqraised2 = 0;
- Q/ x+ w8 L) d
' w+ \ ]' J$ q) s5 ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, a! I$ L: J3 b& t4 C o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" W; i9 U3 }. [$ T2 L2 a E2 M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; K6 \" h) ?3 O" ^ O) A: \2 i- n - ! }* Y9 l( d) I1 C5 ^+ j; J7 }
- dma_addr_t dmaphyssrc1 = 0;8 l T* Q) {$ O" z* s( _
- dma_addr_t dmaphyssrc2 = 0;
2 w& {$ a5 Y- o V. c - dma_addr_t dmaphysdest1 = 0;
; U6 `, Y+ ?3 Q; g - dma_addr_t dmaphysdest2 = 0;2 E Z& V2 i& ?5 _$ s, p
- 6 y; }! ?" j" s- |/ q& j$ f' x3 Q
- char *dmabufsrc1 = NULL;
& N. U) ?( ?2 b. ^- _ - char *dmabufsrc2 = NULL;
5 [/ _& O3 Y$ ? - char *dmabufdest1 = NULL;
2 E. Z8 I9 i1 z1 i - char *dmabufdest2 = NULL;
1 Z( J/ L7 |$ d& }! H4 ~7 i% _% C
$ L6 C4 r! q% n0 a1 ~' f( D0 p' O+ h- static int acnt = 512;# ~# |& s7 K# c% k; W/ l
- static int bcnt = 8;# B: C! m; T, T n* N2 g
- static int ccnt = 8;, S |( |- y2 E6 u7 [9 y
- ! C$ L" V6 v' F& C
- module_param(acnt, int, S_IRUGO);
* b) Q" n0 {2 p. }. G9 G' ` - module_param(bcnt, int, S_IRUGO);- z2 _6 S8 s, R7 E0 J0 z. T7 t
- module_param(ccnt, int, S_IRUGO);
复制代码
3 \4 v' y! K* u$ {) h
/ d$ l- F8 |/ k2 X! _0 S3 N7 M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 i/ H. B2 ~1 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 s3 s. {$ ]" H% ~! i0 q- ` e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* O3 h* d% E+ w' c& M
6 ?3 @: |7 L' p. L1 r4 {( l
/ D b; @ q; q4 G8 A
|
|