|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; h2 m3 Q9 l* n" e: L4 Q
- [code]EDMA sample test application+ }' m# P+ x3 B1 Y4 n
- /*
6 r7 m/ ^" c5 |0 |6 ` - * edma_test.c
) Y |) _( r. J9 c o - *
5 g- T" @' M0 i - * brief EDMA3 Test Application3 Q) D) b/ {+ p* B$ z, D7 k, E# x5 \: l
- *) y% S# W; B6 D% M; r
- * This file contains EDMA3 Test code.
$ d9 b4 U# m& }. c - *
1 f3 V& U% X1 r( v5 p/ n3 R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
k3 Q( [! ?' ~) H0 E" e- I- a, _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, a2 P+ A# K* q - * TO CHANGE.
: c* m( e2 G$ q - *
( @3 {' C( @1 l; r/ O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 v: u5 u+ K- H0 ^ - *2 O) W- T. H. D, z$ |+ l. s
- * This program is free software; you can redistribute it and/or
7 r& A- Y9 _- a7 H; c5 h3 x - * modify it under the terms of the GNU General Public License as4 S; r" n) G( X6 o, s; K' a' C
- * published by the Free Software Foundation version 2.% m0 @9 }$ L- j9 l+ X1 m
- *
9 ^( g' o% {9 Z: k1 K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) R* W4 b0 _- p* p& k: t
- * kind, whether express or implied; without even the implied warranty
6 z2 x' `% a8 v1 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 Q$ w4 S, i' C$ w. { v - * GNU General Public License for more details.! o! q6 O0 ?" f9 Z! E
- */
; s) \2 Y9 r8 s B) [6 E
9 F" r) T2 u @# y7 C- #include <linux/module.h>
2 z2 {; V, x" \& D6 @6 x: Z0 W - #include <linux/init.h>
7 K' ^+ O/ ^6 Y" l* M) U - #include <linux/errno.h>
. e# t! j3 V( N- e4 J; B - #include <linux/types.h>
7 y8 K. C6 f8 W) K( V; U: U - #include <linux/interrupt.h>
+ H7 D& }1 z: p - #include <asm/io.h>: h2 w0 K" m% K0 m# g; I2 ]* r' m, |' U
- #include <linux/moduleparam.h>
# I. a8 G& o* y/ r' v. q+ _4 M$ c - #include <linux/sysctl.h>& z% j+ Z, V3 H) z
- #include <linux/mm.h>
9 ~! U7 B5 f7 D& K1 j( g - #include <linux/dma-mapping.h>5 [: ^& z* p7 K1 r/ z: r
- 5 e. |* H; ~6 j9 d4 r$ K
- #include <mach/memory.h>0 X" n) A, _9 H0 |; ~# G4 U
- #include <mach/hardware.h>$ w+ E2 T( K: E
- #include <mach/irqs.h>
1 }. J2 z* E8 D$ ^! o - #include <asm/hardware/edma.h>
5 Z4 G* n. k( \/ L( K% v - ( M& p; n1 u* B- I9 W
- #undef EDMA3_DEBUG
$ J0 k( }$ Y/ D+ v2 G7 ^ - /*#define EDMA3_DEBUG*/2 T5 n) ]3 c! K X4 R
- ' |) q1 |) \) X& T
- #ifdef EDMA3_DEBUG5 Z9 \* f \% H+ |: ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 V/ x: f8 @' `* d3 n5 `" r, F0 Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): E0 V5 J/ B, K: @- v: q& B! p8 B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) |9 {0 R v- ~# n+ I - #else
B9 Q9 n; Y7 _( W8 b/ Z1 V( z3 I - #define DMA_PRINTK( x... )" Y. h: Q! K3 ?5 b
- #define DMA_FN_IN
0 v4 H+ O7 v6 o( n- \! _ ? - #define DMA_FN_OUT/ A2 Q% V: s! |9 `0 z
- #endif
7 F% a4 _& d N
4 x5 J) h/ [! C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* h4 d7 ?0 @* Q5 F& q - #define STATIC_SHIFT 3) s4 S& M `1 q Z1 f
- #define TCINTEN_SHIFT 20
6 X* Y5 A5 h" E5 h* m - #define ITCINTEN_SHIFT 21
9 O1 O5 r+ q5 ^7 L& G) R, A1 y - #define TCCHEN_SHIFT 22
2 l# G; F% ~+ o& i' J2 l - #define ITCCHEN_SHIFT 239 c2 H' ~& h) x+ j6 ~4 r
- ) ]* m! c) L/ r
- static volatile int irqraised1 = 0;
, Y" }: d3 v9 c4 |1 ` - static volatile int irqraised2 = 0;
3 j# B. q% H8 o1 A0 |
9 z7 ]) |5 x2 k/ f( A% f) J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ?5 G4 d% S3 W) f B4 N) ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% J5 z S8 _- O0 f& S- @" ?. h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ C0 [4 R9 X8 b
! ]6 Y1 Z0 `/ o5 j. ?5 Q! t& j- dma_addr_t dmaphyssrc1 = 0;
5 u9 ~* d0 q$ ` - dma_addr_t dmaphyssrc2 = 0;
( x' G$ _0 G" X( O! c - dma_addr_t dmaphysdest1 = 0; Q3 P3 s; ^ z9 _
- dma_addr_t dmaphysdest2 = 0;
; W( T* c! S% g, w* X4 \! h
/ k1 k' D- n# R# D7 [' o( z- char *dmabufsrc1 = NULL;
4 y1 I* Z5 B* E9 i3 K" I - char *dmabufsrc2 = NULL;
; ^3 @3 x* U3 D* Z - char *dmabufdest1 = NULL;) @7 t% @% e8 K/ V) [
- char *dmabufdest2 = NULL;
3 k# F# t8 X9 U. I" n5 g - 5 k( {* a/ Y: L: Q
- static int acnt = 512;: E6 W- U0 i+ S9 x1 R2 n
- static int bcnt = 8;% w: \6 m, J' ]& P/ P8 d( @
- static int ccnt = 8;5 x# M& s1 E9 |$ U$ t) e- q" ~
; M9 x! n: v4 |* [" ^- module_param(acnt, int, S_IRUGO);
) V# f8 D8 G, m3 _! K9 A - module_param(bcnt, int, S_IRUGO);
( g6 z; u' q' E+ _ - module_param(ccnt, int, S_IRUGO);
复制代码 + `% y! w, d7 F0 ^3 E) M+ Q
! s8 l2 o1 P9 i8 u% R! D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, h! Y4 m! t; S" G3 G( i( marm-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! O% d+ J& B8 j6 _+ z- e+ f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' b ~$ F, V& e0 D2 O7 P. a4 y5 W, b2 Y2 M; ?6 F( \
1 h) Y, V" p; ]3 Z. V- x
|
|