|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 e1 P, B- T* o& t# h: g5 A4 g
- [code]EDMA sample test application+ G; e v+ k" B* {
- /*
" s- Z5 x$ [, V - * edma_test.c
+ f/ O4 h/ h9 Z' |+ O4 s - *
. r6 {! V, \2 v5 E5 Y - * brief EDMA3 Test Application2 Y; g, Z% u6 B' p
- */ k; J- r, [" a* D& X
- * This file contains EDMA3 Test code.1 o. N4 e1 t9 H7 {
- *
3 E% m6 p1 y4 i5 ~) [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( F2 V% R9 ?1 W/ F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 m8 F) I% D. [0 }% P - * TO CHANGE.
( q9 `, A6 H6 E& {& i - *- f2 T9 G4 r4 I2 k3 X" q+ ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 E& @1 K8 ?3 A I2 r8 d - *6 u% l$ B# F# ]
- * This program is free software; you can redistribute it and/or
/ h0 f: k1 ~9 k4 z) c% N - * modify it under the terms of the GNU General Public License as. O5 J: J! i( K& v' p) k h; p3 `
- * published by the Free Software Foundation version 2.
$ C' v# s" F; \, M) K9 D - *7 |" R% N5 |9 i0 n- o7 b$ ~/ G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* w& R9 z) N0 g* J$ Y" k0 L0 b- t
- * kind, whether express or implied; without even the implied warranty0 l; g; y% L" ~! ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% }8 `4 X3 G( z4 w
- * GNU General Public License for more details., |2 c! u% n6 M
- */
: Z- t/ j4 H7 T( Y7 V7 B
* R7 g4 x. w9 ?% Q" d9 o- #include <linux/module.h>9 E; g& R1 ?, Q( Z" h* F, y4 p1 f# B
- #include <linux/init.h>
6 j6 q7 h3 b. i. l* _( G! E! r9 j6 e - #include <linux/errno.h>
* r8 s e1 t5 w: q8 @# | - #include <linux/types.h>
. d/ T& A8 v+ e" T5 ^ - #include <linux/interrupt.h>: c9 X8 s' T5 y6 r7 H7 G
- #include <asm/io.h>
# D0 @0 v3 k4 A l! L7 O- R* T - #include <linux/moduleparam.h>4 F7 H6 I/ D4 G$ t" N+ q
- #include <linux/sysctl.h>
# w6 N9 R7 l/ \+ K- Q, U3 V7 M - #include <linux/mm.h>
% g( [1 Y% F& o( n4 Z - #include <linux/dma-mapping.h>
! D9 F: U1 V: a o! m/ U) m! N
0 x5 |" _/ _ w) x r% B- #include <mach/memory.h>
* e# o6 U) o2 {+ ]9 s2 N3 b6 {4 ] - #include <mach/hardware.h>2 ^, j, }; H4 X) G
- #include <mach/irqs.h>! d1 [/ Y* v3 |! N7 z l" s
- #include <asm/hardware/edma.h>9 z* S2 {1 Q" Z4 y
- 8 E2 Z. F- F }' B3 R% `, u
- #undef EDMA3_DEBUG1 n& e6 d! V- }# K2 |
- /*#define EDMA3_DEBUG*/# r' R& x$ W6 E4 Z4 C$ y$ `8 e
- 8 `; u( A8 D) X
- #ifdef EDMA3_DEBUG/ g% J5 t: j: ]5 N) B" ]# b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- Q* ~# B! k l! W% C) \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# m4 v" M1 x4 x8 I( j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! R2 X( D2 I# h
- #else, y7 K! ]8 l2 D2 q
- #define DMA_PRINTK( x... )
% S" ~3 }. A3 u6 x) Y - #define DMA_FN_IN7 y, i0 w. |2 t+ M% P
- #define DMA_FN_OUT
1 i+ g8 R) V: o- I - #endif8 U9 P" i; _+ \: l8 o. R$ {
3 r) }6 x' y- u. G, c5 l7 l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% W0 R# I; L. I, i - #define STATIC_SHIFT 3
: J: L4 X' P' X2 y/ V' O8 h- J, K - #define TCINTEN_SHIFT 207 U& y5 E) G" z; { z4 G( H( N
- #define ITCINTEN_SHIFT 21
6 x T& V) S, k) r- Q, b" B - #define TCCHEN_SHIFT 22, s; r& x3 A& s7 Q. [% v9 f
- #define ITCCHEN_SHIFT 23
% t& r* {- L) W) M - 2 ]% V4 Y! N2 j, w i6 \
- static volatile int irqraised1 = 0;
; E+ q+ a3 @' c9 p+ F* D p* e - static volatile int irqraised2 = 0;
0 W8 G ~9 u; ] - . S0 z7 p) L9 k2 D1 q& D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 _: C p/ [% v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ N6 h$ n8 X1 g& l! S7 R Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* `1 A2 Y/ |9 n1 l" ^9 H/ I
- ( a* `# m4 g2 K$ d5 T# X5 M
- dma_addr_t dmaphyssrc1 = 0;! T; x( T' w3 s |/ |2 g4 J% {
- dma_addr_t dmaphyssrc2 = 0;
- d# O4 x( u0 k - dma_addr_t dmaphysdest1 = 0;- W: q! `* g( u0 h- X- K* n
- dma_addr_t dmaphysdest2 = 0;
/ _7 N" q) }: L: {2 O5 Y5 h% R - + U: U! P+ c* l& L! t- t. L
- char *dmabufsrc1 = NULL;
1 v( M3 J0 t3 q. h - char *dmabufsrc2 = NULL;; a0 k( L$ O0 T- {3 c0 c' }& @5 L6 t9 a
- char *dmabufdest1 = NULL;
- H: p. w( ^8 U% c. A - char *dmabufdest2 = NULL;4 B1 O# e3 o+ c& A8 l
- + N7 l* _% ~+ M, ~$ q" @
- static int acnt = 512;
3 N. c+ S! U) ? - static int bcnt = 8;5 }% D1 d6 b# C" D; E+ ~
- static int ccnt = 8;
" \% x# H$ A7 T - / u) U& k# y" _2 Q7 F$ _
- module_param(acnt, int, S_IRUGO);
% D0 a7 y! U; p$ S! J - module_param(bcnt, int, S_IRUGO);( E4 W# h* C& G7 I1 I5 Y' F8 u
- module_param(ccnt, int, S_IRUGO);
复制代码
/ [; j/ J2 z' b% z$ f' ~4 c3 R6 r8 y! @1 \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 U- E' X" R( F9 x* ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& W* N1 l( Z( z ]- M) W' e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. H9 W& X& a% \) T+ O
+ ?, z" D6 t; h4 ?2 J0 |
^% [- k% \1 T) ]0 ^ |
|