|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 v3 Z9 ]9 w& r) k$ B+ e. Q, H! Q- [code]EDMA sample test application
+ h( K6 W% o0 u - /*6 S- @6 f: E9 v4 v5 {9 |
- * edma_test.c; A6 F7 \3 t9 g0 \# ?. y
- *
/ e/ |2 T# L1 U r - * brief EDMA3 Test Application
) {' J! F+ J& v g- I8 x - *
/ y0 M9 Q' ~* j - * This file contains EDMA3 Test code.
8 |4 T4 E0 ]: x7 J8 s* ]4 m8 X - *; J7 b9 N$ J2 x I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% g! Z1 y& a7 K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 s5 u4 v0 _: [; f! q8 X
- * TO CHANGE.
2 `4 E1 v6 |5 [$ t2 c3 O8 f, E - *
) ]* S, U! n) s& } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 C) r- C3 z: ?: N+ c5 R* w/ l2 Y! T
- *
U; G2 x8 Q: Z }1 _5 I - * This program is free software; you can redistribute it and/or
. a; B0 x$ L7 ^ - * modify it under the terms of the GNU General Public License as
+ v9 h, F- P: |' w1 b: [ - * published by the Free Software Foundation version 2.. q, p) \% c2 O2 R8 o
- *
) Y I4 W) v- D3 ? - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 k6 o1 i. D/ F" Q - * kind, whether express or implied; without even the implied warranty
, Z( a0 f) S S8 r0 E3 P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: q/ T3 S; e& t - * GNU General Public License for more details.
4 y' q+ N$ D/ j1 P3 [$ R7 n3 v - */
2 d3 O" c+ [ Y, U
1 R$ N1 f) ~' W9 p7 j1 {1 _- #include <linux/module.h>7 D% v% \& q, N. ^3 Z& m3 b
- #include <linux/init.h>5 S- _, r2 ]5 x7 d. ]4 f1 B; |8 |, L
- #include <linux/errno.h>
' B5 R7 Q4 y7 P/ O - #include <linux/types.h>
4 f2 O3 N7 \; j - #include <linux/interrupt.h>% a, S" @) g t3 x. g
- #include <asm/io.h>, i) N* K, Y4 R7 y
- #include <linux/moduleparam.h>
6 U$ ~; {! C7 C! C* B3 N - #include <linux/sysctl.h>
8 N: ~) Y# j& e: p; }. P! w - #include <linux/mm.h>6 I6 U1 B& d! @" w, w
- #include <linux/dma-mapping.h>
. [6 _1 L' k, f& z2 E
, E9 [+ m7 m0 p1 ~- #include <mach/memory.h>$ a2 g5 d! W0 ], z
- #include <mach/hardware.h>' X$ f+ J' Y; _7 k
- #include <mach/irqs.h>
. }$ g$ l' s/ z) u/ [1 Q - #include <asm/hardware/edma.h>5 {! D/ K, F: ?/ F* K5 w+ v( f; ~7 s6 ^( y
- 7 Q* M+ g; F5 I! L# o3 Y
- #undef EDMA3_DEBUG* q3 y! z2 b( Z9 I' v/ h8 z* O
- /*#define EDMA3_DEBUG*/
* P6 C/ ?# p& y7 j - . ^+ j3 ?( t0 Z9 N- y
- #ifdef EDMA3_DEBUG( ~, E C s6 ~* ?3 X/ R5 e+ O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 C- c: s% h$ {1 Q. } R+ { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" f8 E$ ?+ Y' v$ a9 K4 A* s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( n; `4 ~# l5 z" q3 |- P - #else3 s/ w1 }/ l$ M. J: W; ^- v
- #define DMA_PRINTK( x... )2 [7 F8 \7 G) Y& b
- #define DMA_FN_IN1 @) C5 P5 X2 U5 {* M( U' h
- #define DMA_FN_OUT
" V) O1 j9 ]: ?* F* M - #endif8 H) d: r# U7 U, o& R
- ! W k7 |) x# z v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- G) Q1 c: t \' \# R - #define STATIC_SHIFT 3
! Q( k5 `5 T) t& ?2 u( V - #define TCINTEN_SHIFT 20- a7 C2 {& x4 |0 T- \
- #define ITCINTEN_SHIFT 21" _: H: @2 m% h3 _" I
- #define TCCHEN_SHIFT 227 d9 I# ?( q4 T9 c( M: R
- #define ITCCHEN_SHIFT 230 A' h) T" z7 D* c% s
& C+ b0 n4 j7 F- static volatile int irqraised1 = 0;1 \0 ]& ]9 J+ A( A8 K8 j
- static volatile int irqraised2 = 0;
* Y/ P! I5 b1 a5 s! S A; a6 g$ b$ V
[1 I7 W' A) C+ K G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Q4 N1 h4 i; Y0 P- |: p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; k% q l! G! c; i, f) F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) b9 `0 z5 A* @* v
2 N N3 ^5 `3 f( c- z) `- dma_addr_t dmaphyssrc1 = 0;
+ y, J7 I9 X1 M) P8 @( e - dma_addr_t dmaphyssrc2 = 0;* l( j8 j2 h, l- a* Y
- dma_addr_t dmaphysdest1 = 0;# g2 s3 _0 e2 D z( r5 ]
- dma_addr_t dmaphysdest2 = 0;8 w0 @6 O" `8 }, R6 S& O: T* D* O
5 w7 [5 A& A2 ?* S. g9 j- char *dmabufsrc1 = NULL;
2 n1 S" ^5 C+ v K+ e; o - char *dmabufsrc2 = NULL;3 p7 j6 I4 B F
- char *dmabufdest1 = NULL;8 N9 f6 K/ x. u' D! B: h
- char *dmabufdest2 = NULL;2 w5 e+ B# B4 j7 J4 ^# u) |3 I
' m- {0 p" ~; V- static int acnt = 512;
, P/ T( }5 V5 n4 ?& e - static int bcnt = 8;
: z( W9 U9 a4 e - static int ccnt = 8;
9 @! C# {; G$ p! x' ` - $ W7 x( \) j9 |8 J5 h
- module_param(acnt, int, S_IRUGO);" G2 F8 T4 o0 t f3 h/ E- u
- module_param(bcnt, int, S_IRUGO);
( v) L- s3 l3 F" I+ N - module_param(ccnt, int, S_IRUGO);
复制代码
; b, t& b9 Y5 u3 D) b1 N$ B; e2 ~- G3 p( {" y- G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% f: D; Z$ H# z. S# T. Q _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 D& q3 o& ?% ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ e# G i6 p( f, s8 b* o w
( z: M( E1 H o% x5 I
' N C2 H5 f% o8 y |
|