|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 }: }% n9 b& ^2 n/ b( j- [code]EDMA sample test application2 J6 A5 _/ z" m2 w5 I
- /*0 `% b8 D3 T! @- d# f: Y% Q% s
- * edma_test.c7 f& z& l& k: ^! h' t! Z
- *
0 D) z6 C* b( M N! u$ E2 U% w# ]! E - * brief EDMA3 Test Application+ M* z+ \8 r' v1 q6 y- b
- *
- k; g5 B( K4 h' v5 Z$ }& H2 o8 y - * This file contains EDMA3 Test code.
% o3 K, u [. i" L7 U4 z: } - *) K" N1 ?1 b0 `7 T3 E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: ^% e! f- O+ a3 N) C: F9 ~( X: w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( Y, ]: n7 |& i* g* O. M6 A+ u - * TO CHANGE.
9 R6 U* r/ }8 Q" Z - *8 Z8 L! L5 R7 {5 y; L7 } q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 o4 x2 {( A+ z
- *
# ]! d# q* | T! X# y - * This program is free software; you can redistribute it and/or
6 J; q: g& t$ r* |6 ^# ^0 q - * modify it under the terms of the GNU General Public License as) i* r4 K/ w3 g7 `+ w6 [
- * published by the Free Software Foundation version 2.9 J J! @ H* y# y' R
- *4 v& {6 N" k. u7 V( j5 d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 \6 m n9 D' F4 O: j5 T1 G# K: \ - * kind, whether express or implied; without even the implied warranty
* B! Z# E6 y- R8 x6 y4 R; p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' X. n( t( t: K1 @( ^& G# r
- * GNU General Public License for more details.
: y$ \- U* b' S( ^4 @3 G/ l - */
0 O; ^ }3 ]& L/ v( i - # d8 ]; s- } `
- #include <linux/module.h>3 f0 F1 ~, J: n% U4 j7 P
- #include <linux/init.h>( `$ e# a# z. I. R+ N$ r
- #include <linux/errno.h>3 ]9 S! f8 X3 Q# p2 U* ^: ? X7 P
- #include <linux/types.h>5 W k3 j- l1 e3 w% |
- #include <linux/interrupt.h>0 A& o+ p9 Y$ X
- #include <asm/io.h>+ ~# }, d& \/ J, U1 O
- #include <linux/moduleparam.h>% F- l6 P! a5 g
- #include <linux/sysctl.h>
& T9 D$ r1 f) Q1 c" b6 c4 ] - #include <linux/mm.h>
, }/ E+ x* y8 O" j- L+ R3 | - #include <linux/dma-mapping.h>
; x2 y: U* V9 N" e5 s - 8 ]0 Y+ R: R0 Q& L
- #include <mach/memory.h>5 y. C/ x; \! g. P
- #include <mach/hardware.h>
$ W" i) T) v0 ^ - #include <mach/irqs.h>
3 v$ t8 P) x! N4 V! Y5 [5 E - #include <asm/hardware/edma.h>1 ~7 m( G' {/ J6 A( ^8 T/ N
- : f7 h& `' X* u+ [- U7 P+ h
- #undef EDMA3_DEBUG) Z- k" O/ W8 h7 t; l$ e
- /*#define EDMA3_DEBUG*/
! X3 a# `2 u6 @9 V Y) [ - " F! p2 P+ c. t" a& ]6 K
- #ifdef EDMA3_DEBUG" U$ U- ~6 ?9 U9 u; y W8 O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' ~) X: ?% G6 j9 T: l7 [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 m2 G+ j; F) W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). f0 ]6 \2 o3 b$ C- r+ h
- #else
5 m: W: g7 a+ J - #define DMA_PRINTK( x... ): Z! I3 m- g" V6 q0 m$ M0 W2 T
- #define DMA_FN_IN
. \" m; \- [& S, V6 @ - #define DMA_FN_OUT
' c) ~3 \; \* |: u$ C - #endif
; d4 N5 T2 ?3 B5 u8 \. \/ f - 5 U3 P$ H. B# d! k! w+ g- |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 n3 W, b+ \: E0 {
- #define STATIC_SHIFT 3+ f" X* a9 H& d$ \
- #define TCINTEN_SHIFT 209 s6 _0 Y2 {# o& `: b$ L* y5 d
- #define ITCINTEN_SHIFT 21+ Z( [5 D" E$ l; G
- #define TCCHEN_SHIFT 225 e/ ]1 W! c' h( n# b3 Q& t1 F
- #define ITCCHEN_SHIFT 23
! W& ~% Q6 {+ o7 S
; n4 e1 e9 f4 D& k. L4 r- static volatile int irqraised1 = 0;
! j _8 M" |" o1 e) U: o# _ - static volatile int irqraised2 = 0;
+ o9 y6 Y% c) p9 S - 4 q# w M1 N! N5 ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& I) Z. F/ i' Z$ Z: |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 p. ?& a& E% O A+ [- O3 C, E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. S, }4 a5 F4 y% w5 i) e3 n& r; J" [1 O
" ]. }" e" [" T" ?' T+ r: I- dma_addr_t dmaphyssrc1 = 0;! Z$ q% D$ ]! i/ W3 x6 Q7 J+ Z
- dma_addr_t dmaphyssrc2 = 0;1 j3 o# R) F, S
- dma_addr_t dmaphysdest1 = 0;$ b- e7 n) M l! i v) n, ^0 |
- dma_addr_t dmaphysdest2 = 0;
+ A: c3 ?) H8 h, C- e! q
. q, m& I8 Y2 w& c( |- char *dmabufsrc1 = NULL;
0 @, i- h$ `3 U+ e! [" ` - char *dmabufsrc2 = NULL;
, @# V) a) Z5 t. B2 k; ~( O - char *dmabufdest1 = NULL;
) o! A" d8 _ S2 g" w' s - char *dmabufdest2 = NULL;
5 T, r2 D1 E K7 N6 G
! Q) }% t+ G9 _- c9 x# W% @- static int acnt = 512;, K2 D) N: A: B8 S2 y5 Z
- static int bcnt = 8;
3 p5 I% o% X- V$ P0 x - static int ccnt = 8;
7 x# r. L! T; f4 ] - / i# v! B: `# i1 f* a
- module_param(acnt, int, S_IRUGO);
* [) ^) n# `9 J; _; o - module_param(bcnt, int, S_IRUGO);1 _7 }" |/ k5 H
- module_param(ccnt, int, S_IRUGO);
复制代码
+ i- X: F; k N) E1 J
4 D( V- e+ _5 J2 z& m! c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- k: h' z _- @& X5 i. i: yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: ^3 r" Z# {4 c+ n5 \2 c3 S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. ~2 H8 Z( h5 I$ Q9 p/ ]
6 Y2 p( _7 B+ T) ~) d$ T/ X
1 b! o; x0 Z% S& Z! M2 t |
|