|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 B) i+ C" S3 u
- [code]EDMA sample test application6 ~+ k8 H. x9 \# X7 R
- /*7 M: m8 Z" ~! |
- * edma_test.c& Q0 y5 U2 ]/ y' r. M
- *
4 o7 @- V- Z! B+ D - * brief EDMA3 Test Application0 v7 t' N8 [% ~3 L9 K
- *, F5 g8 F( r$ Q" D+ v! n: s' l
- * This file contains EDMA3 Test code.: i+ e$ z) Z9 J9 \ y
- *" I2 ]+ C# F" P2 h( D6 j3 h8 h; X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ L5 d- I5 l) k: T; ^# G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT Y8 T! c% b3 G3 _ G
- * TO CHANGE., p C, A& Q f( @- _3 k8 S
- *' n. O! O/ c. ]" a' ~- `0 O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 u$ F: u) h2 y5 [7 i* S, Q1 Q ?/ [ - *
, z8 \ K( Z& k$ T& ?! V - * This program is free software; you can redistribute it and/or
4 M; A6 M/ f; ^$ m, M. Z - * modify it under the terms of the GNU General Public License as
( U2 Y7 [7 ]( K a) j% v' q0 \5 S - * published by the Free Software Foundation version 2.9 F$ U- P0 z: @
- *" f8 n- G$ B/ D5 h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 Y" x6 R# \1 T& P+ G, w
- * kind, whether express or implied; without even the implied warranty
" `( P1 O9 n( `8 i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 g. E7 @ X+ r# p5 s - * GNU General Public License for more details.
; q. G @4 T6 _! B+ B - *// j: e" r2 a% i9 ^+ X1 N
3 L: T9 r5 j6 [* K4 h- #include <linux/module.h>! j2 E/ y5 O% q7 A! H+ U4 j
- #include <linux/init.h>
" m3 ?1 H& O8 n9 x( ^. n - #include <linux/errno.h>
@4 h- C+ P. }. F6 f+ a6 ]* q$ M' f - #include <linux/types.h>
0 F5 ~ @" Y3 N' N9 ` - #include <linux/interrupt.h>
* o/ w; Y3 n: t0 Z+ u - #include <asm/io.h>; f4 n' k! N& V0 F) K
- #include <linux/moduleparam.h>
) ^% O: X7 w& g* P {$ c# N - #include <linux/sysctl.h>
' Y4 X* _ ]8 s# u7 i( f - #include <linux/mm.h>
; k: b0 a. T3 Y; c( f - #include <linux/dma-mapping.h>0 f' F K& B# E8 `2 g
" J* M$ ?! a/ b+ l$ H- #include <mach/memory.h>- J. c3 V G* F' [0 `; u
- #include <mach/hardware.h>6 i( O+ s9 S3 `" k/ k
- #include <mach/irqs.h>/ {4 Y \" {% Y1 P9 B
- #include <asm/hardware/edma.h>4 Q3 @4 `" ]$ |4 X
* @5 n2 f$ Z* @5 M+ l- #undef EDMA3_DEBUG# S4 D( P: m8 s& i# M5 ]
- /*#define EDMA3_DEBUG*/* k4 V5 B$ u, u, M; O
- 3 v3 r8 Y: }; D* f7 w6 c2 H6 L
- #ifdef EDMA3_DEBUG
3 v9 I% n2 d# J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* Y$ @6 B, @! U; T* I3 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) ~4 i& N# J6 ?( A& p0 n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ q: C$ l3 w* ]/ R
- #else
^" R( |- p4 K6 l4 k" F. z$ ]1 z - #define DMA_PRINTK( x... )$ c& d L' k4 I! z' W! n
- #define DMA_FN_IN
5 r! G5 V. L# w1 z4 f - #define DMA_FN_OUT! Z# n$ |0 Z4 |1 S9 ]
- #endif
W8 ~$ r9 ?( }! X1 [' h; J& P - . f3 d) _3 g6 L1 a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). Q& [6 z3 e8 {, ]" B( e
- #define STATIC_SHIFT 3
6 @3 w9 c+ L$ [8 m6 f - #define TCINTEN_SHIFT 20
4 w# q! w% Z7 G - #define ITCINTEN_SHIFT 21
5 H9 [' V$ x+ A# z: Y$ o" h. V, k; B - #define TCCHEN_SHIFT 22
0 ^7 l( B' e0 |0 C - #define ITCCHEN_SHIFT 23+ O8 @# p3 r [, j2 w5 p5 V
- 6 @' p! O: O+ Y" I) A# N+ E
- static volatile int irqraised1 = 0;& k' N' }0 |3 m; m/ s( t
- static volatile int irqraised2 = 0;
% p7 L* x7 d9 U" ^8 u8 r - : A$ h! i% ^. b5 [3 c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 u* D1 f5 r) K. D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# ]* d, Y8 q/ [* C: {" N- ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' P, b+ _" m: q+ `
2 a) v0 B) l( O0 x. w- dma_addr_t dmaphyssrc1 = 0;# Y6 K; _" P( d% C
- dma_addr_t dmaphyssrc2 = 0;
3 I7 |1 J Z3 x* Z" ] - dma_addr_t dmaphysdest1 = 0;
& l2 P/ B- }2 j4 R2 ]8 g' w. e: z - dma_addr_t dmaphysdest2 = 0;
, o1 g! { w/ N% H - $ Q9 O3 d; t) O n: L# R: N
- char *dmabufsrc1 = NULL;
0 q' u. S. P K" X h& S - char *dmabufsrc2 = NULL;9 Z4 K) e5 Z3 Q& s* Q
- char *dmabufdest1 = NULL;
+ K4 q' I* B6 Q# e& t - char *dmabufdest2 = NULL;
6 B2 h& e0 ^1 o0 R; G# r- w H
7 O6 P' B0 P/ a1 v2 O, i4 D5 D- static int acnt = 512;
* ~/ Y* ?: o* I; \ - static int bcnt = 8;
6 P$ i7 J, e9 T* F - static int ccnt = 8;
`$ `# [" m1 Y: r" B& u& K* E - ' X# ] q) D' }' b1 v5 |% J
- module_param(acnt, int, S_IRUGO);# [& e+ w" J5 X# W, q4 g8 Q$ G
- module_param(bcnt, int, S_IRUGO);$ b" \: j: A6 r6 B: x) U+ j% _
- module_param(ccnt, int, S_IRUGO);
复制代码
+ e( X$ p. I4 h0 J+ i2 [0 p; A# X& C3 g2 \, S$ J4 A! J! C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 h+ T0 ^2 X7 G$ i" L* ?# ]% T
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 P+ `3 K6 w, _& T8 U8 F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 R+ d8 D& o& P8 S( w' V% c
+ \* ` {. {) v. B
* t, C9 K, Y) Q# C |
|