|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" s; U" c# g; u+ |' F% J- [code]EDMA sample test application6 r5 q- Q; h; a( v2 Q3 o) }
- /*0 W& N( o; \0 j2 J+ b
- * edma_test.c: j% t2 A2 j) ?( N) D8 a, `% W8 w
- *
1 W$ ^5 V1 d: h: _8 O! ~( t - * brief EDMA3 Test Application
6 ?6 c& e. O! b/ U/ A* O. v - *
4 X- ~1 [8 V `0 G - * This file contains EDMA3 Test code.$ ]$ F9 s: @7 E! G A) i; A6 d
- *0 s5 M. U9 @- i& H1 O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 j3 B- S8 P& O8 j3 X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* Y) O% c5 j; o9 r
- * TO CHANGE.% { x, \# }5 F
- *
1 l' j b2 h g& m! s c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; X( ~/ z( P" \ \. K- U
- *% w" B: Z- o, Q9 E
- * This program is free software; you can redistribute it and/or# ]. A, D- p" }4 T& A' N! L
- * modify it under the terms of the GNU General Public License as
3 f! F# I. z- f* f7 T7 Q) L, E& f - * published by the Free Software Foundation version 2.
; W' m2 Q; n) \; \1 s0 A* G. a, q - *
6 |( J, b8 w3 K8 @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 |4 f' S8 ^9 W* J - * kind, whether express or implied; without even the implied warranty7 h8 Z3 I$ _- z8 E" F% m D3 t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: y. `6 [1 ]# g6 u - * GNU General Public License for more details.* p- b3 u. H8 e9 V) x8 F! r# A, Y5 A5 O
- */
( _4 t& g# R: U0 q3 n* M! ^8 s$ e - : Y0 q, d U! E' H. k
- #include <linux/module.h>
5 K+ d9 w* C' O- ?* D- C1 @ A - #include <linux/init.h>
0 }8 N9 q/ Y* h, g - #include <linux/errno.h>
% C( _: U7 B! n" ~. C - #include <linux/types.h>
+ i0 z$ E% p g8 C A h5 H+ V - #include <linux/interrupt.h> X+ n' d* L# q6 @+ h3 _
- #include <asm/io.h>
& U: b+ o" D' S' L$ i3 L H# G - #include <linux/moduleparam.h>
5 Z5 E. s% ?2 c* h0 P; s - #include <linux/sysctl.h>
! t. h1 h( n' E* C$ J - #include <linux/mm.h>
2 G9 u. F" t5 v ~9 R# ` - #include <linux/dma-mapping.h>
) k3 P6 t# a7 [. X
1 I M) e% [9 Z# `3 |- #include <mach/memory.h>
) [# @9 W/ X2 A" |5 x0 ] - #include <mach/hardware.h>
* ?* T9 G# C, M6 Y3 F- y( { - #include <mach/irqs.h>, b0 t" r! R9 B9 g
- #include <asm/hardware/edma.h>( w, K1 i( w) T; O; f2 ^
- 7 }( j1 v& n1 S4 ]* d+ n
- #undef EDMA3_DEBUG' y- Y$ ~5 I4 f: i* s
- /*#define EDMA3_DEBUG*/
+ t" o- }) I) P - + ~* p) |3 A, Y+ r2 d4 d0 T# }
- #ifdef EDMA3_DEBUG
2 A) _4 k* @0 T; \+ N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, g; c" J9 c: O" c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ X$ U( I) p9 f' r' N6 r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 t: s$ e- P8 Y/ s' L5 o) A
- #else z) s7 j; P H0 ]- r& W
- #define DMA_PRINTK( x... )
8 y! _0 h+ F* q9 N7 S - #define DMA_FN_IN/ l: @5 ]3 P/ A1 u# O
- #define DMA_FN_OUT
5 J0 b Z* [/ d! ~# s* b - #endif5 w4 O: J& h* N0 k1 C5 }
- 9 O9 A4 M' J6 p0 [$ i. G' z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 |9 z' X2 v) o3 [4 s& U
- #define STATIC_SHIFT 3- f# g w. C- y9 k/ L& `
- #define TCINTEN_SHIFT 20
. w+ U3 D4 F" }' H% v' m+ ? - #define ITCINTEN_SHIFT 21
& Q) Z) d: c- N. C - #define TCCHEN_SHIFT 221 d/ v! b& C9 F- C
- #define ITCCHEN_SHIFT 23
4 t/ c( V8 u: K- u O9 U - 0 t! E/ `0 Y3 F' S# g
- static volatile int irqraised1 = 0;; P v8 x8 B. A( o9 G2 R+ U
- static volatile int irqraised2 = 0;, y- z% n& C% N
1 k3 t) `! }$ A% H3 w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( T2 H6 \0 Y5 P- E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 B3 v7 c, w( }' V( j/ g& C% t& _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 p5 x% h; I9 Q( L' {
- H4 H/ X( f6 X! q$ ^8 K
- dma_addr_t dmaphyssrc1 = 0;3 n; [/ g: t0 B1 y$ H3 P
- dma_addr_t dmaphyssrc2 = 0;
1 c6 i5 V w, G# j, F. _$ F6 q$ \ - dma_addr_t dmaphysdest1 = 0;" W* o4 w% ~" |
- dma_addr_t dmaphysdest2 = 0;
3 n2 F( R# j2 [% S) Z- s( D4 }
" C" m& D. l' e, r( K& G7 v- char *dmabufsrc1 = NULL;
* i2 ?" V- V9 q$ D1 E7 ~0 v# N% |' ` - char *dmabufsrc2 = NULL;
- q: d7 M' p; R- k. J/ N6 I - char *dmabufdest1 = NULL;
0 S4 {: L' J% J. k6 }' H, w5 e3 l+ @ - char *dmabufdest2 = NULL;* F5 H, U3 W% K: X
- 5 S2 d5 I1 U8 ~4 G8 L1 v- c4 a. h+ I
- static int acnt = 512;
/ Z# i! G$ {: B" P2 Z- A& W - static int bcnt = 8;! f+ o/ I5 Z( h3 u
- static int ccnt = 8;
; X. `% K% b% Y - ) e' G) L. A: M* ^ v) i# t" S9 y
- module_param(acnt, int, S_IRUGO);
7 p& d5 q. S* b9 ? - module_param(bcnt, int, S_IRUGO);2 h# X. {; Y9 F( B
- module_param(ccnt, int, S_IRUGO);
复制代码 ' X, v; H: z7 V0 U8 X
0 ^9 e% i+ v- b) q% @7 w: n8 o1 B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( T7 `7 y, n$ S4 ~, ?; l& k+ c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 ~! ]6 f) Z1 W( }& g$ U& l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; N9 d* c: E9 z0 \2 j* }. Y) |2 z( w. }
+ z/ v5 t* ^* O# [2 ?# T
|
|