|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" x/ m# S% M& r/ o c2 z4 t# @( p- [code]EDMA sample test application
6 Z/ p: K% o1 V' b/ v - /*
5 o3 b3 }$ I; h( A6 H - * edma_test.c
+ Q; F6 W4 o* G2 i- k ` - *
5 W" t$ x4 p* G' I9 T3 } - * brief EDMA3 Test Application
2 A' h' q% ~/ A2 f# d/ z" d - *
0 f! V3 M- B3 `$ H4 z - * This file contains EDMA3 Test code.
" H& o7 N# P2 W6 B6 Y) z9 ?0 P - *
9 w# {: U( Z8 p# B- @2 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. h2 b- P- X7 x6 u2 ^: E& g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; I C& [/ X2 e' A4 o$ r - * TO CHANGE.& |3 Q0 e5 L- j L ?
- *
C% ~, J# t& d; h+ G* w% v- y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* t0 I7 s; W4 O. i' B2 B7 R* j - *
, r7 \6 q% `* @% Q- L' r! Q - * This program is free software; you can redistribute it and/or$ i( a1 Q& l" P6 K- K0 [" z
- * modify it under the terms of the GNU General Public License as
: ]; k+ R! S" a - * published by the Free Software Foundation version 2.
1 T, T- Y% H9 @" f - *6 Y8 p7 E! B4 h5 E# d: D; k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: W& r8 l; p( b3 p4 E6 j* H0 o' B - * kind, whether express or implied; without even the implied warranty( X' _6 |/ L, |2 J6 B6 J$ @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- Q- N9 J1 I9 E2 `/ [ - * GNU General Public License for more details.' G3 q9 G3 ]7 M4 L
- */! V9 K" U% k* w u
- 4 x1 o7 ^" P: e
- #include <linux/module.h>
6 ]0 B$ m) T6 B# P$ O - #include <linux/init.h>, s3 k8 h3 N* `. m' i" g' N
- #include <linux/errno.h>4 S- a H. e4 Y z J% H
- #include <linux/types.h>
1 _0 p/ {# h+ M: Y - #include <linux/interrupt.h>6 a3 m! T8 L6 `/ s+ I
- #include <asm/io.h>
; B5 V' Z- P9 T3 Y - #include <linux/moduleparam.h>
7 F* g# z+ w5 v - #include <linux/sysctl.h> L( l, l0 X- e1 U r4 c
- #include <linux/mm.h>( i: R2 T; ~% l6 q
- #include <linux/dma-mapping.h>2 N+ Y9 G) Q w- K0 g3 D
0 o* x% E9 ? X+ X/ M- #include <mach/memory.h>% q5 }5 j- {" }7 [4 f7 j; J
- #include <mach/hardware.h>* F/ @. @" N& s* U3 r% ^
- #include <mach/irqs.h>
7 C0 J+ D2 D8 g. ^, _& r - #include <asm/hardware/edma.h>
) D1 w" q y) C& i8 ?/ ~" c - 0 H+ Q; X7 M+ I4 \ z! l
- #undef EDMA3_DEBUG9 B0 o7 J" p# R: w1 Y
- /*#define EDMA3_DEBUG*/
. y `4 |* X }
8 S$ f1 Q- b# Y: X3 R, c- #ifdef EDMA3_DEBUG
7 w: K3 F: n3 x) d( R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 S: _, Y8 r$ T/ W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ ^+ D1 h# v% _# S9 s/ U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 R8 ?$ o3 }- t W7 r( r# L* T& v+ L - #else
* Z$ Y8 o6 r" `/ L - #define DMA_PRINTK( x... )
5 S4 U8 q8 R/ t1 `' l - #define DMA_FN_IN
5 \' n2 I) k; h2 z% i; X0 P - #define DMA_FN_OUT
$ S, e+ M: r& n: q) g - #endif0 b: {$ ]! O* M$ _% L5 d, A& p
( T# y. X K p8 t( I' F, `9 [9 ]" B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- O( N3 v! t% j: {' `1 W, L - #define STATIC_SHIFT 3
* ]. _ R( s0 _3 V! d3 K" c - #define TCINTEN_SHIFT 20
- E) M6 V& H5 C1 [ - #define ITCINTEN_SHIFT 21. C* w, f- @5 ], G# s
- #define TCCHEN_SHIFT 22
, x. r; ]+ `( m - #define ITCCHEN_SHIFT 23 w$ k6 h& Q& J' d/ F F
- 0 ^ n, j3 _% u
- static volatile int irqraised1 = 0;
- ^: ^) t l# s C( K: `3 R - static volatile int irqraised2 = 0;/ K6 ]* m! g& p- e! L) v
- 5 T |. w$ G' }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( Z& p3 S; ~0 V" Q B5 i4 D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 m: t$ Q) u0 U# ]7 f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ E* s8 A8 x" ~9 D- _2 {. O
- ! a) H" n8 ]1 [# o0 [2 H
- dma_addr_t dmaphyssrc1 = 0;7 s6 B. b8 c9 A: r
- dma_addr_t dmaphyssrc2 = 0;
6 S N9 C9 D3 q- @% }) ~% e& u - dma_addr_t dmaphysdest1 = 0;7 P) [0 h' O- d
- dma_addr_t dmaphysdest2 = 0;6 N! p2 i+ {& }5 B0 l& e3 ^/ F
- 7 {6 ]2 h, Z8 Z* j6 {+ H
- char *dmabufsrc1 = NULL;
. b$ T* W, [# X) X* l! T) s9 ] - char *dmabufsrc2 = NULL;3 ?, |6 L9 D3 L, n1 s, s
- char *dmabufdest1 = NULL;. D8 g! c* w, H+ d$ @
- char *dmabufdest2 = NULL;1 Q5 n0 F% K4 l* Q0 d7 x
- 2 O. ?& ]! I2 a! d% x; _3 D/ G; k1 B
- static int acnt = 512;
0 j6 t, H. P$ G- s0 a! b - static int bcnt = 8;+ [ {' X n h+ k& c8 D4 W6 g9 |% Z% r
- static int ccnt = 8;; r2 A' I6 A5 J; {: ~
- % q! [. K$ d% h& t" k1 W
- module_param(acnt, int, S_IRUGO);
8 ~% r" d* A2 I. L6 O2 } - module_param(bcnt, int, S_IRUGO);% N6 L( B) W/ l i+ \; _
- module_param(ccnt, int, S_IRUGO);
复制代码
- Z2 x) w* j" h2 I0 E8 J5 Q
5 i' q) V2 `# j0 ~1 z6 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% [# O+ m- T) a; W2 @' W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: ~: U3 P% J5 D" c: M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 `1 h" o. U# c& B" s# g$ S
2 }" @9 Z( o8 B! D5 e5 o( T4 `# z
; o2 ?, q4 _; u6 P# R |
|