|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; U$ S$ _* S7 W/ n6 m) s
- [code]EDMA sample test application/ j- `8 ~: a, g& a1 A" C: x5 U+ [" _
- /*6 r& t! J$ o# Z+ X3 I" {0 G0 D0 |2 B& [
- * edma_test.c
" g3 O7 o% e5 P) K. I - *
8 c3 k6 B( j7 F - * brief EDMA3 Test Application
9 x( |7 c. Y+ q$ T O) k/ n - *
0 V0 p) f) Y2 ~( G, D f$ C# V - * This file contains EDMA3 Test code.
8 A9 |& Q- {. h' d; D) `$ y1 ~ - *
- b+ B- I* s' h5 ~5 Z, [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* e6 ]7 D: R, j( e, R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 G$ o& j+ L% T# @) P: p - * TO CHANGE.
) u: F0 `5 I; T) t4 g - *% w" S l4 E+ d& a0 D: y0 w6 q4 c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& y, B9 E* J# A3 |+ ?+ b - *4 w" V5 N% N- g% K% V
- * This program is free software; you can redistribute it and/or/ U2 X) O. q- ?: [' k# [! m( J
- * modify it under the terms of the GNU General Public License as5 m9 S/ A) b& A' X% ]' ]* {
- * published by the Free Software Foundation version 2.% v$ p, ]2 o" y
- *
/ P( `3 {1 p5 c6 C* [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, N! Y" r1 o' U) w, i$ p! R - * kind, whether express or implied; without even the implied warranty
7 Q& z% ~# u! x8 x! H( X f \ ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 O* X% P: d1 U3 F, N) f - * GNU General Public License for more details.! z9 O' t2 j; o+ W
- */
% q5 ~( O! y, j1 }! j6 g; k/ X - 8 ~% Z1 b9 D- k( }9 F
- #include <linux/module.h>, m: e7 K7 e4 @' h! a7 ?, M. p8 u/ O
- #include <linux/init.h>
6 [3 A4 f9 r$ M6 X& z - #include <linux/errno.h>0 {6 ^5 V: K3 P6 l# P7 R I9 e8 I
- #include <linux/types.h># }1 [# X" w8 n8 @, [2 l7 l7 Z9 h. ? ?
- #include <linux/interrupt.h>
4 \* I* |; N; t5 Y - #include <asm/io.h>
7 ]& v2 B8 f* }; P - #include <linux/moduleparam.h>5 ?& u' \7 S6 U" B6 c) i2 i
- #include <linux/sysctl.h>
7 d9 l3 A7 {8 `, R; W) Q8 C - #include <linux/mm.h>" O' ~4 `. k% ]
- #include <linux/dma-mapping.h>$ K, I& N/ G8 V! }; @0 L3 t
- I6 k" l+ p& m K" a1 {- #include <mach/memory.h>8 [+ Y( } J1 ^# h
- #include <mach/hardware.h>
9 m+ E; R* b/ U2 N7 k1 O: h - #include <mach/irqs.h>
6 L6 g( A& | }$ V1 D - #include <asm/hardware/edma.h>
# q6 Y$ m" F: Y. Z3 p - 7 z8 C5 L2 ~* u4 |, z
- #undef EDMA3_DEBUG
; l0 x9 d) p4 l - /*#define EDMA3_DEBUG*/$ ?* B. w! y: z! Z8 f
* [# @7 t* E, x8 u- #ifdef EDMA3_DEBUG; n, s+ h( P- K( m; u, h& q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* ~! s) g6 Y6 u3 P* x% ?' S j' C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' K# {0 e% g5 p1 k* B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 `) X4 n( X# L2 _7 I9 r6 ] - #else
& H7 @, w9 ?/ K( v - #define DMA_PRINTK( x... ); a6 s/ y0 h) K) f
- #define DMA_FN_IN
" g0 r7 C& U i9 T' @ - #define DMA_FN_OUT6 ^7 f& k, W1 J
- #endif4 M8 S) s5 c) Y% H+ c0 n
- " `) T$ b& u3 }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: S R% O/ o7 Q6 o9 K - #define STATIC_SHIFT 3" L8 b, R# H5 V9 e7 |2 o
- #define TCINTEN_SHIFT 20
# R" v" Z. b0 c1 r8 u1 j4 D# h - #define ITCINTEN_SHIFT 21: m' M2 P% Y8 ]$ ?
- #define TCCHEN_SHIFT 22; W. ~: p1 l8 e8 }/ j2 n
- #define ITCCHEN_SHIFT 23
2 I) i7 G" z) _
& j' K7 C; s$ b0 ~- static volatile int irqraised1 = 0;* m' K- X: u: W9 C' A
- static volatile int irqraised2 = 0;/ I5 g) }$ g0 A- O/ T
- " P2 J* ^' n+ D% Q6 j5 ^3 j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& O. F. y% M' w. C) |/ u, P. N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ p' j) w( B" x6 `9 |% s7 X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, b$ r% @9 {" ]5 ^) w0 [8 ~
- 1 q6 t ]$ J& ^9 `9 A4 \
- dma_addr_t dmaphyssrc1 = 0;' n( x8 ?& |$ E! L2 G/ {1 K
- dma_addr_t dmaphyssrc2 = 0;
, @: P' c) {$ ]7 M - dma_addr_t dmaphysdest1 = 0;0 g) b$ d1 ]# B8 D' Y4 R( o% W# \( l y
- dma_addr_t dmaphysdest2 = 0;
" l. B. ^' x; R d7 C( K5 o$ k
, b) J6 J" w+ J8 F- char *dmabufsrc1 = NULL;
, |3 A4 e- r2 w$ \( i3 k, K( P0 ` - char *dmabufsrc2 = NULL;: M2 N- c2 Y! F! f+ U3 B
- char *dmabufdest1 = NULL;/ p, F5 a; P, `
- char *dmabufdest2 = NULL;
- x# Z& c- ~; D* I - 2 H9 n2 A$ m8 M7 o1 B' R6 w
- static int acnt = 512;
3 A& ?. Q2 | I0 o - static int bcnt = 8;1 Y. C! k4 g/ {1 d; w( L
- static int ccnt = 8;6 o7 p7 R% v7 R; a/ F! }: g/ s
- ) y7 |% T8 M: ~4 c3 n6 P; [ p4 C
- module_param(acnt, int, S_IRUGO);
" T' Q6 ~/ g5 Z; h; q& C+ c; N - module_param(bcnt, int, S_IRUGO);* O! i" G# x5 U) J/ w
- module_param(ccnt, int, S_IRUGO);
复制代码
1 z, o4 u% g7 r( a( _7 A8 y$ M" ^' q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- m$ G) @/ T6 L; D; |1 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ N2 t0 D! Z7 p6 e+ X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# H3 [9 w& m7 h& _" ?' v1 q7 `8 S
0 f/ b+ z, O0 x4 O" V$ T H- J
|
|