|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # y! ^7 S) }/ T. n
- [code]EDMA sample test application
5 L' p0 F# c9 W( a" c% U - /*- N* N- Q9 V4 r6 |* H2 d$ |
- * edma_test.c
& h! T( I( a* |+ N" ^4 c/ X - *1 W7 |# }% c8 j$ T( ^' K, U
- * brief EDMA3 Test Application: u) R' U* _1 j2 r% k
- *& b3 l+ _1 n3 J
- * This file contains EDMA3 Test code.: h; Q7 G9 |% |! H2 c/ W8 J
- *
( r' l8 E8 l$ h$ W8 {% t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) F# {$ O" v/ r+ w+ a2 C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 Z5 }4 o- R+ _1 R2 q1 @7 S" J5 H - * TO CHANGE.
( X( D' K$ ]1 u, j/ ?% j9 [ - *
Z) n7 N$ M2 g2 d( B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) ^, e) m0 X8 m9 K2 ^ - *5 u% L' s) s- X8 r
- * This program is free software; you can redistribute it and/or# O( S& D4 W8 |: v1 D) a
- * modify it under the terms of the GNU General Public License as" M9 C* g$ s* [2 t& z7 u
- * published by the Free Software Foundation version 2.
5 B: i6 h. G$ m7 |4 m9 G" w% Q4 u - *6 ]$ X2 g! n6 ]0 `' a* w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: `2 k& O* _' y- b
- * kind, whether express or implied; without even the implied warranty. L" O2 c" R: `/ ?, l2 @$ w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 ~1 ?% t; H+ z) R; n
- * GNU General Public License for more details.
5 n5 t3 Y, Q j1 j7 q* | x - */- l( Z( l {+ F
# k3 H0 b- f4 C$ _9 W- #include <linux/module.h>
: Z& u2 I8 i, L0 p9 m: e) S H - #include <linux/init.h>
+ d& E) e7 g5 l @9 g" [ - #include <linux/errno.h>
K- P/ b& o( I. `8 Y1 c - #include <linux/types.h>
y$ I! n% D( O' [ - #include <linux/interrupt.h>
% r( H: v1 h5 g- Z8 l5 \ - #include <asm/io.h>9 x' I! K% Y) ], S* _6 c6 V- y
- #include <linux/moduleparam.h>) m7 _& l6 q# c Z3 ?& ^' p0 r
- #include <linux/sysctl.h>
$ M2 Z$ m1 N: G6 s' _ - #include <linux/mm.h>7 ]+ ] o2 W* x1 m5 o% a
- #include <linux/dma-mapping.h>* t+ s* [1 ?) u4 x
- 1 @5 d& X/ ]0 a; \9 {- Z+ K
- #include <mach/memory.h>
& n' m! y; |9 w* J9 P: z - #include <mach/hardware.h>0 N$ g1 D2 m% L# c
- #include <mach/irqs.h>
2 z( H6 ]; J4 W7 A Q5 Z; G - #include <asm/hardware/edma.h>
* w) M4 {9 p( J# }) E! ~% V
7 N, r7 V/ i$ J! t4 t- #undef EDMA3_DEBUG
7 n4 r Q9 {# X. x0 J - /*#define EDMA3_DEBUG*/
4 n* E/ L6 t( @: I. a' c& d, M; X - 2 L7 q* H6 Y7 d6 }( Z% g+ H
- #ifdef EDMA3_DEBUG7 M$ H6 J1 S! f9 K* w- E* \" d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). ^# B, N) f$ M" Z5 ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# c+ R: W; Y9 }! o- ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): J9 \1 f& A% m8 f0 B/ F7 u% J
- #else; G; F9 }. }3 R0 N% R) M$ C
- #define DMA_PRINTK( x... ): c. p8 T- h- a& L$ _
- #define DMA_FN_IN. Z( W% v" ~" D, Q! `5 \) m3 b+ ?
- #define DMA_FN_OUT/ [: j2 o! I$ }
- #endif
) o2 y7 D: s [( A+ m
6 U3 I6 l9 e" i8 t, r0 K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% L5 a. o) _% w4 b' F: ^2 n( j
- #define STATIC_SHIFT 3
$ f0 P4 x4 V/ w" i* b - #define TCINTEN_SHIFT 20/ m8 T# `( o: z: k V: g
- #define ITCINTEN_SHIFT 21, R, t7 o: f$ |. ?" x0 F
- #define TCCHEN_SHIFT 22
( ^6 P4 X' ^- m - #define ITCCHEN_SHIFT 23
* E9 `9 @4 Y; Q3 o, @ - 4 v: E/ m; o% a/ [ [9 N; h
- static volatile int irqraised1 = 0;) U6 G; |" S0 q& Q: n9 b
- static volatile int irqraised2 = 0;5 K( C, N8 f+ ] a$ U4 J# m
- 4 S) i9 s% ?. a4 p5 g# Q) M0 x+ h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ^$ b& p3 \; o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 ]( N% H% h7 `3 c( R! V- M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ~2 E8 m& M! X. S$ o
- ' k5 c0 r% d' K5 R0 F: D3 s' \( n
- dma_addr_t dmaphyssrc1 = 0;
, M- o! u. S/ W - dma_addr_t dmaphyssrc2 = 0;& @5 S/ Y$ Y% @- N8 D
- dma_addr_t dmaphysdest1 = 0;) Q( y! A2 _! ? T
- dma_addr_t dmaphysdest2 = 0;6 C: @% X5 M- U: Y
0 p& I/ ?8 U1 [1 h% O; S% \2 Q9 d0 A- char *dmabufsrc1 = NULL;* ^. j f/ D6 w1 l
- char *dmabufsrc2 = NULL;
3 ~$ N/ e' {" h4 _7 B6 I - char *dmabufdest1 = NULL;
$ a. h- ?( L) I& z6 d1 Z4 x - char *dmabufdest2 = NULL;; Q" |2 v; w/ o. P" i
$ g- C# I' G: G5 p- static int acnt = 512;
1 q a4 H; Z1 d2 v - static int bcnt = 8;1 ?( i7 i Z- W( c s
- static int ccnt = 8;
9 _5 h, D9 |; }) C( Y - " }# G4 v- \# M' d; _) \( b( G2 m
- module_param(acnt, int, S_IRUGO);
& F% j8 _! h3 D% A - module_param(bcnt, int, S_IRUGO);
8 [' `1 d' r1 h5 X8 L9 V6 R - module_param(ccnt, int, S_IRUGO);
复制代码 + i9 s- Y t2 l/ d
4 k7 z4 U) N9 S* s! J. X+ Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' | l- @+ t9 ]2 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; R* {3 C4 B5 r0 D9 @( _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 H. ?& {; m6 w8 w; M, m
, A) X+ F0 H8 N- W
( q% ^+ F. R0 f% g! m2 y$ a |
|