|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 B& _+ S! j4 R% c. h" p- [code]EDMA sample test application2 W; r- B2 Y; F0 ~1 T: ?
- /*9 t/ Z% |! g# b2 {
- * edma_test.c2 |. T3 _2 @/ W4 r; M+ s/ K
- *1 T( E- O0 Q& s- i8 ], t, {- X0 E
- * brief EDMA3 Test Application, S5 X: b3 M( T
- *
! N! E4 ?8 r+ |" n- D3 H7 r3 _2 ` - * This file contains EDMA3 Test code.$ p4 O3 Z7 G) J( ^
- *
4 }8 u0 h4 @# N& q/ t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* V7 I+ U# K K, ^% G8 L4 Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 H3 f/ k- K* ~! y
- * TO CHANGE.0 j( v$ R& d( |3 r$ r
- *
, O( }; H7 a, ^' e( o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. \8 q) {+ S* w+ R# `! x
- *. f; T; [3 x; }' V
- * This program is free software; you can redistribute it and/or
" v" l8 j1 i' w0 w - * modify it under the terms of the GNU General Public License as
' t7 S; M& k# s, r - * published by the Free Software Foundation version 2./ a& w2 M% B) i& x4 Q
- *
[" f8 [$ m0 `6 _# R6 x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' i/ D9 q. p- W$ q1 l N% @ - * kind, whether express or implied; without even the implied warranty
- f. I. V9 T+ H, q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. f- {0 F0 E" r
- * GNU General Public License for more details.
. X5 K% s/ @! G ^7 C2 C8 E, B - */
3 Y' V) V2 j' C3 E7 W3 B# G! L - . L4 X! l r1 \: P t! k3 u/ d
- #include <linux/module.h>8 V W( l4 i+ P0 e& o/ Y' n8 N. w
- #include <linux/init.h>
* B+ C2 z0 [% k- b - #include <linux/errno.h>
1 K" {* R7 T8 w! C7 u6 t9 q - #include <linux/types.h>
) ]: u% D, x. n9 ?5 e - #include <linux/interrupt.h>$ T% M, e* @2 H( M% H! D$ p
- #include <asm/io.h>2 s3 V9 V5 ]' S' h& H. A" r. g6 t0 M
- #include <linux/moduleparam.h>0 X5 \9 m5 z5 Z9 f+ w
- #include <linux/sysctl.h>/ \' `$ l3 W/ r# p6 e
- #include <linux/mm.h>7 }+ a8 S7 b4 W+ P
- #include <linux/dma-mapping.h># k6 _* x; F( s& M+ H* c
- ' x8 W: }/ R- D) [5 E; S
- #include <mach/memory.h>
' Z9 X& u; n9 j+ m5 M' |7 O - #include <mach/hardware.h>! N3 Y) b8 A" P: t8 ?% Q5 _
- #include <mach/irqs.h>3 u+ u A. ~0 n' C
- #include <asm/hardware/edma.h>
- G4 g* u5 v6 p* Z: v1 P+ W
6 u- }5 z& |4 `7 k" `- #undef EDMA3_DEBUG/ O5 R# e2 s3 ~ A5 _9 P
- /*#define EDMA3_DEBUG*/
. p. s. o% P/ B) W2 {& o
4 q; j( S1 N# j7 K; [- #ifdef EDMA3_DEBUG
1 G" ?, W a6 U- r' r. j$ ]- y4 f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 v; ^% z# Z* m9 H$ Q' N* S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 d5 ^7 f1 K7 c0 W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& B1 D' O( x8 k8 J: r - #else, ]8 C i& T& O- H9 d8 Y
- #define DMA_PRINTK( x... )
- j2 k d3 [* H% H - #define DMA_FN_IN* B/ d C( A @1 g
- #define DMA_FN_OUT' A9 i, Q; w, I0 l9 ^2 Y
- #endif
* B2 ] L! L6 w! a4 e$ V
/ f9 F* U4 h7 e6 K3 U* w9 e) y* t- @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ W5 u7 @1 c9 Z8 Z
- #define STATIC_SHIFT 3
8 c8 S9 H- g5 t6 } - #define TCINTEN_SHIFT 20
" V, A. O* C# \3 A( n! s# o - #define ITCINTEN_SHIFT 21
9 {$ O6 g# ~( ~ - #define TCCHEN_SHIFT 22
4 ^) [; E4 `" J3 O5 g. \# B# N - #define ITCCHEN_SHIFT 238 Q5 O9 E \! \0 q
- 9 ?( H3 @, G, s" ^2 |4 Y* N
- static volatile int irqraised1 = 0;: e6 I$ \0 z6 z
- static volatile int irqraised2 = 0;
0 r9 E) c \$ U7 \" C# T' o2 z
, R! Z/ I& u- e: D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, Y; ^0 ], O% p2 {. W. i, k9 B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, h/ X, y) Y# P8 q3 K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); E& j3 ?- k& Y6 f& j2 O
- : c2 {" |% Z& ]7 a
- dma_addr_t dmaphyssrc1 = 0;
$ D7 Y$ W4 g7 c. L5 i+ Z5 r - dma_addr_t dmaphyssrc2 = 0;5 y; g3 Q. q9 s1 \. H; }
- dma_addr_t dmaphysdest1 = 0;
! G7 [) v m# I6 b Q# J - dma_addr_t dmaphysdest2 = 0;
. w2 I! J% i4 E - * u3 k# n( Z, I X( X: f& A
- char *dmabufsrc1 = NULL;
& P/ u7 c6 h" @/ X# F1 I - char *dmabufsrc2 = NULL;! s& u4 s" B+ A# q0 o$ R
- char *dmabufdest1 = NULL;
3 v# L& _! | F# s0 [! q - char *dmabufdest2 = NULL;% y4 n, a, y; n# p6 o+ S' c3 |
- 4 \: R( H" f6 q1 u
- static int acnt = 512;( T2 Y2 L* W- l
- static int bcnt = 8;+ q" N" W* n' e" H
- static int ccnt = 8;
" z {0 d7 V! @8 Z* }! S! g - 1 k$ G" a% v/ }
- module_param(acnt, int, S_IRUGO);
; M" J w3 J! O2 X$ V+ Q - module_param(bcnt, int, S_IRUGO);
9 \6 O1 y% Y2 F d- A - module_param(ccnt, int, S_IRUGO);
复制代码
! C- |4 Z0 X5 _' a4 u
2 N0 f) n6 J( I: d8 s$ t9 _* ~- Z5 l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 e3 P1 c6 Q" K& [2 F8 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 c, O1 ]( ^2 A, X# f; y5 y, G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( k, K+ G) S) ]: u
, a5 C+ y( h4 `/ u# X# O0 n3 @0 U. a6 F6 I$ f
|
|