|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 q& l) _4 P6 v! i& J
- [code]EDMA sample test application
6 k) e3 H! D) m. R9 f$ t( [$ b - /*. ^9 k' Y& N3 S) X0 R, e0 j$ j
- * edma_test.c8 _7 O% @) x& U8 G [3 [6 s: z
- *% F0 j2 p; @6 w+ c
- * brief EDMA3 Test Application4 E* C# B$ l4 T9 X! W$ I, C
- */ ^0 W% w) B) p% A% I
- * This file contains EDMA3 Test code.0 d* i# B" N2 m$ m
- *! Z% C& {; G l4 t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) h: D. N$ K$ `7 C# ~- z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 a) y8 J! E, h Z6 b5 R* u - * TO CHANGE.
6 y( K( B& o5 Z - *
) @ S! N5 B* I l! c! I8 v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 m- T7 n$ \& A0 R/ f - *9 p2 s, R8 p; r+ p Q1 J" f+ k
- * This program is free software; you can redistribute it and/or7 B* @. Y1 s; W' m
- * modify it under the terms of the GNU General Public License as
0 K- S0 o- f, v" z( g - * published by the Free Software Foundation version 2.3 c! v( G% Q( V, \8 A, |
- *
- V# k8 P, o, C1 m0 y% P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, e" a+ r, D! R! R8 p
- * kind, whether express or implied; without even the implied warranty
4 z7 x3 Z' {6 M/ C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 }/ W6 P$ B$ [! [
- * GNU General Public License for more details.
i7 P5 O# s5 y4 s7 M# h - *// |! K8 ^, f' Y5 Q4 `
- l/ W& z4 u/ g Y; b) ~
- #include <linux/module.h>
+ x% ?6 r* V0 ~/ @. _/ E - #include <linux/init.h># c6 i3 _" A) [- n" N* M7 G
- #include <linux/errno.h>+ {' I& h P5 D- D) V. ~6 @
- #include <linux/types.h>
$ d* O3 Q! y5 m, z+ i4 q) ^) \ - #include <linux/interrupt.h>
8 z& G# e% v. N: B( ]5 K* Y - #include <asm/io.h>* U7 F* r o0 P
- #include <linux/moduleparam.h>( u; S2 g5 v$ `
- #include <linux/sysctl.h>
- O, ^! y$ K2 I5 V$ J - #include <linux/mm.h>* p0 I( p( _6 ^- h' c- I% H7 ^, y
- #include <linux/dma-mapping.h>1 c- p3 @$ r' B
- * |* l2 P8 G9 t e5 {# f
- #include <mach/memory.h>5 v. _! O7 M& V+ s% H
- #include <mach/hardware.h>: [0 C1 m& l/ ^9 W. F
- #include <mach/irqs.h>, G, e- \5 v2 |9 S
- #include <asm/hardware/edma.h>
: }! r3 D, D- A. \. U8 n' Q* h
1 @8 w0 @$ t6 h$ ]3 { V$ X- #undef EDMA3_DEBUG6 h$ }# S [! Y q
- /*#define EDMA3_DEBUG*/$ t3 i. h% ]0 M, Y- W h
- n/ s) x! } e0 V- #ifdef EDMA3_DEBUG) i# l( k/ `* D3 ?* j# s) p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: `, r! ]$ p ~7 j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ |; \" |2 F" Z( n* K7 r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ e! w% L/ i# A# R; ? - #else
. Q s) t" l9 e - #define DMA_PRINTK( x... )
+ h- k% d, U* K3 ^: z+ P - #define DMA_FN_IN7 x' x/ l1 s2 f& G; {
- #define DMA_FN_OUT5 r7 _; a2 [3 k* E" j; P1 P
- #endif; E% y4 v/ y: V5 z+ R. T* [
- ' S/ [, e! H. `" u3 o) @, I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! T& U( L U- t/ }" V: u5 O4 f5 U! E
- #define STATIC_SHIFT 3
1 g6 a, V. Z2 h7 D! P) e& I - #define TCINTEN_SHIFT 202 L5 R. m: P) J: `
- #define ITCINTEN_SHIFT 21! r6 M; d5 m5 F6 x+ P$ s
- #define TCCHEN_SHIFT 22
; M d( F. _1 }6 j; i' b - #define ITCCHEN_SHIFT 23* j* s+ U1 t, k+ u C, H+ d
( _+ x) s4 f8 B$ u/ l- static volatile int irqraised1 = 0;& K5 {5 g5 j% ]9 d
- static volatile int irqraised2 = 0;
7 }) {" H; o! F! O - $ L! i' |& C0 f6 K3 a, o- E! w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* e+ K+ y1 ^/ y8 N3 Y! | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; E! y& H& ~4 b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" Z5 K7 v* t, d! ~* P! G - + S. B% ]" M T1 }% V
- dma_addr_t dmaphyssrc1 = 0;
4 H& `! u. n6 @0 X+ Q- N+ z - dma_addr_t dmaphyssrc2 = 0;5 I1 d! e2 `* R( e1 s
- dma_addr_t dmaphysdest1 = 0;! d/ o( G( }) H
- dma_addr_t dmaphysdest2 = 0;$ f& p3 b: N8 R) j/ q3 S
- : d- Z% o0 m1 h$ L) w
- char *dmabufsrc1 = NULL;( G5 A4 z1 P q2 @
- char *dmabufsrc2 = NULL;/ Q( I+ h1 i( y
- char *dmabufdest1 = NULL;: U! B! O. d) y# A# C
- char *dmabufdest2 = NULL;8 z [2 E: z J# g
- ! ~3 `0 G/ Q* ^- ~9 N/ ^! r$ t
- static int acnt = 512;/ O4 }( X# T4 S5 v: }. X
- static int bcnt = 8;6 {/ |& M! ]: ?' T g9 g( ?1 L
- static int ccnt = 8;
; z, V' c/ x' ]
3 {8 [/ y1 P; p- U+ ^' D. u- module_param(acnt, int, S_IRUGO);. z5 u" g; m. K, r, `
- module_param(bcnt, int, S_IRUGO);
5 I1 c3 k' t7 L! Z" |7 t - module_param(ccnt, int, S_IRUGO);
复制代码
" i7 P* J L9 M4 _ M7 r# W9 J" T8 Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. N" K6 }# K. z0 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& B! k& g5 L" t( j+ Z0 o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! ?0 ?: I) ?* }4 j5 F3 W
4 h4 X. u8 y3 h2 z& ]- L
0 r! @: R) r& R E# h |
|