|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; g4 S/ I# J9 O r- [code]EDMA sample test application
; h( K( O! J+ R p - /* H: d1 y% t4 m& t* i2 d! r
- * edma_test.c
9 K7 P2 i3 {% m* e, j - *4 s2 U! S6 Y: X5 E, N' j" ?3 p
- * brief EDMA3 Test Application
" B' s& ?) v& `: h( s0 S& e - *
4 t J! U! r! x2 F# J* Q5 W - * This file contains EDMA3 Test code.$ J) n3 I3 f: c( B
- *
1 f7 k6 ^) A4 N1 q4 U$ [2 f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, F% S; ]( B9 I& J$ [- m8 p, r8 W2 F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 s! u' Q, D8 e3 R; N+ D
- * TO CHANGE." W' i% H$ B& a7 u9 k1 j
- *
# v4 J" V7 _* d5 e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- A; }+ h/ I# }
- *( {4 B8 f$ D4 u+ W4 H j! g
- * This program is free software; you can redistribute it and/or
$ F8 Z# ?: i0 F9 ?" M - * modify it under the terms of the GNU General Public License as
`' P5 l" X8 J" `! z% V - * published by the Free Software Foundation version 2.5 S& G) z2 }: b& e1 Z
- *
2 {1 O9 ~+ n" P% Y' c& l" W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 W# x$ P/ L9 L) P3 j/ o - * kind, whether express or implied; without even the implied warranty% l1 ]2 G) @& O4 ^( B) D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, Q9 S4 x$ z: i3 V6 m k0 x
- * GNU General Public License for more details.+ L( Z6 V8 M' u) n! ^3 I k
- */
% w6 x- F4 {/ w$ z' m4 t/ G
' M% A- d- I6 g6 Q' q% E3 d- #include <linux/module.h>
7 F' r" O4 m3 g3 h, Z - #include <linux/init.h>
' {- z$ ]5 I/ A8 |/ E0 O) _5 m/ s - #include <linux/errno.h>
# }; ]+ _( y J3 [' z6 x$ Q2 ` - #include <linux/types.h>
- S5 _* L Z$ x& ~, m: } - #include <linux/interrupt.h>( E* X$ u8 _: \& m8 q) H
- #include <asm/io.h>/ P0 @3 V6 `/ w* c
- #include <linux/moduleparam.h>
5 O, _8 D4 |1 r0 w, [$ F) b8 _ - #include <linux/sysctl.h>
# j$ Y6 q! c0 U, z R2 T - #include <linux/mm.h>
" s% h9 K8 E6 n - #include <linux/dma-mapping.h>
. V+ G: l; X7 \ - ; o; [8 V$ k3 O/ j" X& m* }
- #include <mach/memory.h>
0 K/ ]# u7 [# U3 s3 ^. f% ? - #include <mach/hardware.h>
' } I0 ]( ]& q) B* c0 M+ d- z/ ] - #include <mach/irqs.h>
% @9 D1 m2 O! s8 L! E* E - #include <asm/hardware/edma.h>
. t9 O, _( A3 y/ g. l; N2 ^# ~ - 3 W V. j5 |, w% J
- #undef EDMA3_DEBUG8 l( Y; u/ e- l. B+ |
- /*#define EDMA3_DEBUG*/! q; i H! B4 J+ ?# H5 h/ `
' K$ D1 G2 j/ h5 ?1 }# y- #ifdef EDMA3_DEBUG
7 ?9 B% A4 I9 ~9 k; a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& r/ U. n3 l3 W8 O L3 ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) F3 q1 C/ r7 x5 r, Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 w0 y% Z* i2 D! G) d: D - #else
' g+ U7 L7 E" S5 W2 D& Z, z0 E2 K - #define DMA_PRINTK( x... )3 u' O5 V. L* V" Q
- #define DMA_FN_IN- i! o. ^% L0 f6 S9 R
- #define DMA_FN_OUT T, K7 E# `3 u; ^0 U, _
- #endif
9 ?' J7 f: t$ r; j R# l - % y( ?$ F" V y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); S- b* t* P! b- h% M
- #define STATIC_SHIFT 3
8 K: ^; K, @5 b0 \- o% z - #define TCINTEN_SHIFT 20* c# ~3 `3 Z; e. w* P! K
- #define ITCINTEN_SHIFT 21
4 Z' P% {5 o! v5 |1 r4 K - #define TCCHEN_SHIFT 22- h! f& F: W: ?9 V9 s# s
- #define ITCCHEN_SHIFT 232 I: E$ x- c( n' v( i% Z! j" r+ N
- , B& ]" {0 ]$ F4 c# p) [6 K; N
- static volatile int irqraised1 = 0;
/ L1 J4 e. h9 s# C0 x, k - static volatile int irqraised2 = 0;
6 }4 I6 J" ?/ \2 B0 X/ |7 Q- k - ! G1 T9 y- X9 J- |: P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& F r7 e7 o2 j9 B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* p1 d! i* B# ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 o1 e7 p$ | B6 n! l
- 4 k# u9 t+ F- ]/ b8 z
- dma_addr_t dmaphyssrc1 = 0;5 M( _- ?8 B8 e1 T0 q# H6 u+ {6 X; @; f
- dma_addr_t dmaphyssrc2 = 0;- O- B7 B9 u& j" h7 \
- dma_addr_t dmaphysdest1 = 0;
* V8 n9 r6 i5 i5 @/ \1 k' ~ - dma_addr_t dmaphysdest2 = 0;
( \# ~" O8 a/ m* ]0 H0 m1 h
' m, j% _7 n( z2 ?+ j' r- char *dmabufsrc1 = NULL;: o6 \* A& G2 t3 y a
- char *dmabufsrc2 = NULL;3 S% ?% k( c y2 v3 a1 F
- char *dmabufdest1 = NULL;7 n- i* w7 s% F, ~
- char *dmabufdest2 = NULL;2 l' Q% c/ o$ D4 y" `
& [+ o I$ R1 }: y# F: M! s- static int acnt = 512;1 p0 G7 P6 C5 h! t9 ^8 c6 k
- static int bcnt = 8;6 S8 A2 ^ o5 Q3 b% H
- static int ccnt = 8;
7 x7 v7 U8 D& C( `/ u0 Y$ T - 4 v0 R3 G: R6 {
- module_param(acnt, int, S_IRUGO);6 | y) | Y$ _5 W* G
- module_param(bcnt, int, S_IRUGO);+ T' ?1 Z W+ p# T
- module_param(ccnt, int, S_IRUGO);
复制代码
6 s8 u9 X) R5 \8 q- U( ^1 u9 K4 c3 f2 \$ Q& b3 w7 U4 g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; X" `; K0 K2 [ A% P6 parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 Y# a; z. O8 ]- W% o7 W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) D7 c f5 X% ~6 y. x$ `- ^' a9 y( k( E5 w
, I) }# T4 T) x1 ^7 Q- u$ R |
|