|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . _0 D$ \# u6 M0 M5 `
- [code]EDMA sample test application# M2 Y, O4 S1 j( S3 ]
- /*" t6 ?& G0 Z6 q) Z4 C `
- * edma_test.c4 i9 L# N+ G. Y) K. x
- *
7 c8 j& Y& V" T r& G - * brief EDMA3 Test Application
& A M% X- o& c7 `: @ - *
2 `' h% S9 Z7 T6 j9 n: ~/ n6 f9 u" { - * This file contains EDMA3 Test code.% n0 m. ^. ?: w2 @. o& N b
- *( @/ A+ V; Z3 N7 {( \& Z) ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 C: k2 |' z( U& a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 |/ [( N4 h1 u' O2 D
- * TO CHANGE./ i) v+ b! C; r0 S! ^; n, L
- *
' S* ~7 i4 M+ d: _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 {% V) r4 j" q% w, }* u - */ Q4 L8 T' _1 d" R4 k6 g
- * This program is free software; you can redistribute it and/or
. q/ Y" b4 ?: C1 B - * modify it under the terms of the GNU General Public License as
4 h% v( B, t3 j - * published by the Free Software Foundation version 2.
2 U1 [7 L' N0 D' U! H: H3 x* T - *! t3 T+ i5 r- Q* H0 N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 G* R% |8 D5 S+ r9 R: G - * kind, whether express or implied; without even the implied warranty
- r- s- g& C# z3 w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! x- j- I1 U( x @5 S - * GNU General Public License for more details.
2 V5 T6 \( O t/ [4 T/ { - */
* {+ {: U; W; w2 H4 R$ [ - " f0 t7 D, Y, t! N' q3 |, P/ R
- #include <linux/module.h>7 I, T3 r- L' h9 D4 n o
- #include <linux/init.h>. l. G. {$ r# _+ F b* F
- #include <linux/errno.h>
/ G" m( Y% m; W7 Q$ {- D - #include <linux/types.h>
0 d* |; e. U- c1 u9 t, B - #include <linux/interrupt.h>: ?' q7 Y0 |$ I: b& Q7 Z
- #include <asm/io.h>
+ }$ u. ], ^4 d: T2 a - #include <linux/moduleparam.h>
2 M! C. I" X& S1 f0 `. w - #include <linux/sysctl.h>
# l( d4 r. s. M- D - #include <linux/mm.h>
9 c7 A3 C" ^* a8 G - #include <linux/dma-mapping.h>
( E5 b: H) I- \: ?. f8 Q - 2 z2 u, r6 q6 E9 @
- #include <mach/memory.h>
" ~/ W- f# R4 s& `9 |, O# ] - #include <mach/hardware.h>
' ^% M, G, a" j2 s% n5 b - #include <mach/irqs.h>$ {, H; o1 d, m n" T' K$ B7 w
- #include <asm/hardware/edma.h>6 ?" y; j: k2 y/ j
- ! u' G/ `4 i! E5 @+ X- D
- #undef EDMA3_DEBUG
0 A( T2 G5 c3 |3 F3 j2 Z - /*#define EDMA3_DEBUG*/; j: F% W7 T4 i7 o% c
; M# `! A- N4 P- #ifdef EDMA3_DEBUG
+ {" Q! o) I6 i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 E" }- z( ?& E# y- w8 N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ [2 u5 z& a) E" p5 n( b1 o7 h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! F) V* d4 M1 w6 Q R5 L- D - #else
4 R# b4 v+ u4 I6 ]9 G - #define DMA_PRINTK( x... )2 F3 K% V6 I. ?( l# t# T
- #define DMA_FN_IN
: S& ~% n+ i% L" } - #define DMA_FN_OUT. Z2 V. a) V: T* M9 f
- #endif
9 P, y" E5 b3 G, X - 1 C4 K( d- n' I7 B/ m. O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; u, U) S2 r- M+ b7 v6 ?- B - #define STATIC_SHIFT 3
- R8 D; j+ N& u) A - #define TCINTEN_SHIFT 20
9 A6 L. Z! E/ S2 J' A) B1 f - #define ITCINTEN_SHIFT 21
5 |! q* E0 L. h+ }1 P - #define TCCHEN_SHIFT 22" C( ~# |) L% X [* b8 s, b
- #define ITCCHEN_SHIFT 23
9 ^. k+ n1 f# e; M/ h - \4 a+ b- s" J1 h
- static volatile int irqraised1 = 0;
' b* G7 s, U" `9 F+ ^8 B+ g# G9 ] - static volatile int irqraised2 = 0;
$ k: _; q& n5 i q - 2 M, y7 c5 U" Q: m, s7 u% j+ S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 n7 W0 Y1 }, q. s9 A. z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Q1 y E9 b4 F- h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: B0 r- D4 k: _6 c' b - , _1 A7 W$ r( S, E
- dma_addr_t dmaphyssrc1 = 0;( L' u5 H9 i' A. u0 U; ]
- dma_addr_t dmaphyssrc2 = 0;
' Y# g/ z( [. h- J; Q& |9 D8 | - dma_addr_t dmaphysdest1 = 0;7 p$ }0 @1 H+ s4 d( O
- dma_addr_t dmaphysdest2 = 0;& P( ?$ [1 P$ g7 t
- - D5 e4 |0 O& m! v" k+ r$ E8 R
- char *dmabufsrc1 = NULL;
, ]: K" W" Q. r' f6 H. h) H. Z - char *dmabufsrc2 = NULL;+ Q! Z% k8 V" m3 R2 o) }
- char *dmabufdest1 = NULL;: W* \' C* F" t4 Q+ Q
- char *dmabufdest2 = NULL;6 s8 B% N% j% R$ d+ ^- j) ~& T! @) Q
! ^. ]4 H: }# C4 r- static int acnt = 512;
2 h& {0 f0 J: h6 p: p: k - static int bcnt = 8;2 H$ O, u4 q9 x+ S7 b/ M
- static int ccnt = 8;
) f& s5 D5 _% i - 9 n. x4 c! p) x8 I4 k! G3 f
- module_param(acnt, int, S_IRUGO);6 W4 X* Z7 u# R C5 F, b
- module_param(bcnt, int, S_IRUGO);
. D0 k/ X/ K/ H; j9 f3 b - module_param(ccnt, int, S_IRUGO);
复制代码 / u% A2 T- b: K2 S/ R
2 K m, u" ^( y9 |* @% M2 T, s. j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 j, l7 |! K! o6 I- u
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' C9 U& X8 R* N. P( |& d) `" p; q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 G) z. Z9 t: U9 S \$ H( l3 w- I- V
. ? ~! g6 X7 C' C# l- h: f* @ |
|