|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 |# ~! \* u1 C$ ?, A' g! x- [code]EDMA sample test application0 n' S( g" }; ]2 v: N2 D3 C
- /*& v; s" O4 R2 m5 _7 B2 c5 V
- * edma_test.c4 `" k3 ~7 b& `% ?) q
- *6 W3 E/ q! ?& e3 ]& w8 E9 h
- * brief EDMA3 Test Application& d" Y' J; } q, l/ T5 G
- *& W3 C' |! L: g+ u( S" t" J
- * This file contains EDMA3 Test code./ ?) t$ y7 U" {9 w1 N4 O2 G& z9 _
- *
_* o4 e& w1 h4 o5 m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 S+ l* P6 ~! V9 ?" S# Q$ I3 _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, {( J) M3 Z9 b& d - * TO CHANGE.6 W$ f, I# h( M# c2 n2 D
- *. s! Y, T3 c; K q L% R$ ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' i- X F: d, o( Z" n9 d4 } - *% ~ W% H& Z1 B2 \& H8 T2 x
- * This program is free software; you can redistribute it and/or, n$ I! u4 ?" q: \; M, [9 N2 Z: a
- * modify it under the terms of the GNU General Public License as8 b; M, } x) K/ }4 [
- * published by the Free Software Foundation version 2.
9 ` a3 m" R3 E7 ] - *
! ?/ N4 y1 ?7 Z1 }' o! f: E" | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' e+ W3 {1 U. b; b+ u+ p
- * kind, whether express or implied; without even the implied warranty
, f' n& n" p3 B/ _4 F7 S/ Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# C8 x) `/ q M6 n/ b( i7 Q7 u$ P! z
- * GNU General Public License for more details." W2 h6 L/ U+ l6 P0 J K
- */4 }% B! L! v& i; C+ l
- 5 s( N8 j9 `+ ]0 g. B6 k4 B4 h
- #include <linux/module.h>
9 N4 H/ n. d, {$ g G - #include <linux/init.h>
) d$ \2 l0 R L% q - #include <linux/errno.h>
Y7 U. ` e2 W A1 c+ j$ h% W+ L - #include <linux/types.h>
. [7 i$ d3 z2 W4 G7 a - #include <linux/interrupt.h>
; o9 s v) o# Y: p5 Q! ^. g - #include <asm/io.h>
9 L! x; h# j% ?* B - #include <linux/moduleparam.h>3 v2 k) k: J1 i; r
- #include <linux/sysctl.h>
+ v8 O+ m# o0 U u - #include <linux/mm.h>
) R7 t( N6 O3 ^- \! {5 i - #include <linux/dma-mapping.h>
H. ]8 X& G2 ]9 x6 m
# @( [: C: Q* C3 G5 F- #include <mach/memory.h>
) \1 `$ d% {: E$ y" \ - #include <mach/hardware.h>$ ~/ ~- |. S3 Y* O _/ T% ?
- #include <mach/irqs.h>
" O" j% k$ U$ y - #include <asm/hardware/edma.h>! e- C1 Q) [, o4 X% L5 p
8 [% r! L1 `9 B# ]1 \$ U2 }! h+ H6 U- #undef EDMA3_DEBUG
# U! H& x: I2 t1 G& o - /*#define EDMA3_DEBUG*/5 v) {8 F& l. u2 E
- : p7 q0 O- t% b0 R/ z
- #ifdef EDMA3_DEBUG* Q) s# I `1 \$ h/ z& Z- T, h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ K3 s4 `, [- w, C7 j5 \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 w) @7 u' e- C$ w7 [/ n0 } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) T# f9 Q0 k" W8 o- s - #else9 x: T' G6 D1 r0 E9 G
- #define DMA_PRINTK( x... )
- W) r1 B9 J( Y - #define DMA_FN_IN
7 O/ I B# @* ]: a - #define DMA_FN_OUT. X1 [& J" {# W7 w2 {9 D
- #endif
& o: k) h7 n/ V - 3 M7 i$ ~5 U- r. B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& k+ w2 i" F. `7 c6 G0 G9 ^
- #define STATIC_SHIFT 3
, ?1 J2 T. @4 Y2 v8 `$ I - #define TCINTEN_SHIFT 20
0 m' w# v! L, z: i5 K, n - #define ITCINTEN_SHIFT 212 [6 ]# ~+ i( B# U6 E- _
- #define TCCHEN_SHIFT 22
- P' K: `0 `% R/ L# t - #define ITCCHEN_SHIFT 230 q4 T' Q- f Y& F% h3 @* ]
2 s. r9 ~ u1 e! }. [- static volatile int irqraised1 = 0;
0 s! C5 s* K- a1 p L+ q - static volatile int irqraised2 = 0;4 d, ?4 ^ ]) D& Q
$ ~3 w, \6 E B" o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ b4 }: X( ~) C# \% q6 q, R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& T' N4 M' T5 I" M2 T) q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 p6 @$ n' X* f: W; N2 D t1 E
, {/ _. T% u; S; Y0 d# X7 a- dma_addr_t dmaphyssrc1 = 0;( D. a; Z0 p+ Q0 L( d6 h) l) L
- dma_addr_t dmaphyssrc2 = 0;3 y" ^! C% b! C. L
- dma_addr_t dmaphysdest1 = 0;
2 Q7 D1 ^. g% V6 S: |0 p) j - dma_addr_t dmaphysdest2 = 0;/ K* P! ` Q& e6 x3 e3 o8 N
( d7 v- l4 v2 Y+ |" Q9 D- char *dmabufsrc1 = NULL;- ^/ s8 C. {0 T% @# c$ f- O) u
- char *dmabufsrc2 = NULL;& ^( j N' ~/ M( t0 K
- char *dmabufdest1 = NULL;: i5 e5 u* K( _: S8 V9 y( J
- char *dmabufdest2 = NULL;
+ ~# R% F0 a1 W' b - & D8 h# ~. ^$ [9 W$ l, q) b
- static int acnt = 512;, F7 u0 }! a9 S; ~1 U% F
- static int bcnt = 8;
, D( i; ?' l- N - static int ccnt = 8;: |1 G4 A% d5 [" f1 x3 K! i H
5 O; Y9 c. f* H- module_param(acnt, int, S_IRUGO);, Q# z/ B* I1 r
- module_param(bcnt, int, S_IRUGO);( w' E9 _5 O% c" y% I& |
- module_param(ccnt, int, S_IRUGO);
复制代码 & u5 d* E! q. N
8 t O1 q( ?; l* e9 X7 b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# Y2 S1 ?: D: q2 w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, z- j8 D& Y8 K& m: K# p* z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' Z, o% q) G% U" V( [
- Q* n$ F: ]0 g m3 m" I/ t4 D' a- A; P" P( n0 q! o7 C; x
|
|