|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . W6 K( v |. C! I" A8 G4 p* q
- [code]EDMA sample test application8 b I) g2 q+ C4 `6 Z
- /*# {7 [( A, o# A. }
- * edma_test.c1 [" c- J5 V; \3 x
- *
8 r9 s5 F% X/ q( z$ e4 f1 S! j: t - * brief EDMA3 Test Application5 G1 d1 j+ _4 ]$ j, X1 o% ^' p4 R. \* @- u
- *
/ H( b! a1 Z0 Y - * This file contains EDMA3 Test code.4 r; ]: C: d7 \2 `8 E
- *7 f, p5 s3 H/ [# Q2 }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; V2 [- \; j8 A% R( G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, X7 w1 X! r! S8 e. Y
- * TO CHANGE.
1 r# g: R. e D' Y - *! x! t$ e& A; l# q1 u: }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 r: `3 { Z+ s, @; I4 M; i+ s7 I6 s! K* Q
- *4 W! O' j0 Z. W6 b1 E( t
- * This program is free software; you can redistribute it and/or
1 j6 S% j1 R5 c, y - * modify it under the terms of the GNU General Public License as) {: @" r% O* i. Y
- * published by the Free Software Foundation version 2.
5 P0 C. M3 T2 t5 ^ - *, i5 V, N; x, F% r5 d" X% V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' r3 v9 p' z' c ^: V2 J - * kind, whether express or implied; without even the implied warranty$ B2 z" B& v" s2 f( j }. g# @, F, ]9 m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, S: }5 p4 x) m! J - * GNU General Public License for more details.2 D; k B( a. n0 a
- */
3 t3 A h- X! j
7 T D5 I3 {! ?: Z6 Y. I- #include <linux/module.h>
" n' b2 N( Z( R$ Q, ^ - #include <linux/init.h>% R- q% O, i7 W6 \: u
- #include <linux/errno.h>8 t& f: G7 [8 _; }4 f, N" r5 ^
- #include <linux/types.h>0 S/ J" q" t; w- A i/ ]
- #include <linux/interrupt.h>
; |- h, [& |! V& f% Z* b! E' ? - #include <asm/io.h>9 y- v+ V( Y; _; I
- #include <linux/moduleparam.h>3 v" @& y5 \0 N5 \" d; N
- #include <linux/sysctl.h>
z9 i, l! K, a6 F% u. { - #include <linux/mm.h>
5 u: o/ m7 y" l9 t) E" y - #include <linux/dma-mapping.h>/ {; j1 |* g- G) g' t
- % m' j- D* [5 m( D0 ~! g& |
- #include <mach/memory.h>$ d9 V( n) ]! m- P
- #include <mach/hardware.h>% v+ _5 s0 q" z$ }
- #include <mach/irqs.h>
6 {6 o! d' j6 N: ^. ~: v8 x1 _ - #include <asm/hardware/edma.h>% _+ r" O* o# u
) G& b: l/ p6 U) W- A4 @- #undef EDMA3_DEBUG
+ G B- s b# d - /*#define EDMA3_DEBUG*// t7 K. q( |" A$ A
* F4 k |3 f, b1 S7 d: W: k: ?- #ifdef EDMA3_DEBUG$ F) v- V7 f. D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' F. Y6 M. V$ d: m) M7 B' O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 U. e3 N2 B }0 A7 b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 X/ O, O+ r- ]* F6 Y4 ?' n
- #else3 f) `2 O2 L: o1 j7 h
- #define DMA_PRINTK( x... ) j! p; g8 _1 I& `5 b7 v; f4 f
- #define DMA_FN_IN. m3 D+ F9 N) U
- #define DMA_FN_OUT4 ]* r: h& l3 s2 p( |
- #endif: V- l# j$ B( ^5 f a1 l; w3 D5 H( X* b
- $ }8 w5 O K+ Y; [) m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# O' G5 b* m* n6 y# N" s8 v! M, ?# B
- #define STATIC_SHIFT 3
8 W( W2 b* o8 q7 d% Y& g/ Y9 o - #define TCINTEN_SHIFT 208 w! d7 w/ D; ]" I- S
- #define ITCINTEN_SHIFT 21- P+ Z+ X# |- S
- #define TCCHEN_SHIFT 22
T& y; K7 _& D7 r - #define ITCCHEN_SHIFT 234 e! \0 }; A2 R" W4 z) p) L
- 9 ]: G5 I2 A& r( I, e) }% H5 i, Z6 e
- static volatile int irqraised1 = 0;
: ?- j4 l+ }" u& x6 J- r6 x! }. D - static volatile int irqraised2 = 0;& q- B; ]9 e" e% K7 R1 z3 ^* T' p
) }" D+ a8 X0 O6 M0 @% |: ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% I E1 i/ p; g4 K) z$ t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 t* a. X0 N( v+ M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ?( `* K- {6 M. I/ ?
0 z, i; H: ~3 L1 S- dma_addr_t dmaphyssrc1 = 0;
2 `# n' l* t3 j# _9 j - dma_addr_t dmaphyssrc2 = 0;
- O* C) r1 @/ {, y! w0 y9 z, { - dma_addr_t dmaphysdest1 = 0;
! Q, Y4 W) S8 ]0 |- \ - dma_addr_t dmaphysdest2 = 0;$ x% B U% Z" Y0 J9 j; X; ?- y, x
G9 e0 g0 `2 H# @- char *dmabufsrc1 = NULL;
+ e. \! j+ d2 @8 t - char *dmabufsrc2 = NULL;
7 E( s5 V; z5 X - char *dmabufdest1 = NULL;4 v9 W5 H) M1 d {
- char *dmabufdest2 = NULL;0 F9 h' X8 Z( R0 w
- 0 M1 U d8 z2 M! U* @. J
- static int acnt = 512;' I% N- o3 u5 ^* m: R# g
- static int bcnt = 8;8 G' R4 L1 }, K& Z# V! x
- static int ccnt = 8;
! x# w/ U2 t" S, |0 a/ y3 U8 n
' G, Y0 }, Q4 |6 D4 x1 ]$ V- module_param(acnt, int, S_IRUGO);
! d8 T' d' J0 o7 g, _7 q# O2 f - module_param(bcnt, int, S_IRUGO);
p O6 F& G# @! U - module_param(ccnt, int, S_IRUGO);
复制代码 ( n6 k$ _. k3 h3 P: W- |
, R* J! A4 j' t' x X; y1 O8 F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ D. Y1 ]* ~/ h, _' B% g) Z; }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 z6 t4 e* l; U) O( q4 {# L# j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 I, @( I% G" {. k ~& |9 Q x
# G9 b6 l# |9 L. Z
' l* q5 _) ]! G& X- d3 ^ |
|