|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" ]( M" i8 Z! y" I+ X; }- [code]EDMA sample test application
$ i8 Q, t+ ~ k$ u! }, Z# B0 b - /*
: E; R. L' J5 E, ~$ }2 \8 T5 v( W3 E - * edma_test.c7 e1 J Q2 t8 \( m) L: l! h
- *. B7 [- c6 H/ B" h
- * brief EDMA3 Test Application0 C" G! q" x0 j% W- T8 V; V+ Y
- *
& }( o+ Y0 }; n+ I% R - * This file contains EDMA3 Test code.$ f+ }( P8 M. A& j, k7 q$ p9 m
- *
; L' d* w `0 p: K! r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% o$ W9 I7 Q# Q& W, c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( o6 m( D/ }" ^ - * TO CHANGE.
+ {2 a: |, s& s l2 A, s - *
% t" w1 Y2 _ ?; V9 l1 p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 U) l- }. Z% y
- *
8 c; @4 e+ D* x, P X - * This program is free software; you can redistribute it and/or4 H# r1 m# T) Y( j1 C
- * modify it under the terms of the GNU General Public License as
1 }" }2 S; `! L0 a. Q1 B - * published by the Free Software Foundation version 2.
: F; e( O/ k; I$ f( [. @ - *
+ m E8 ^# N+ J6 d7 j6 I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 X1 N- J1 Y9 R; @9 x& t9 ^
- * kind, whether express or implied; without even the implied warranty5 U0 F4 R0 U0 p' T$ \, B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 \) ~" A' T# D, I! y - * GNU General Public License for more details.7 R+ V/ i* z! l8 R4 n9 l; j3 X
- */
+ \0 j5 ^& C. }% h& g - {! @" Y. N4 [/ ?" {9 T. C
- #include <linux/module.h>- Q {4 E7 @! }+ J1 {, A
- #include <linux/init.h>6 [* n) F: @. s8 K% x9 a. E' Z3 s
- #include <linux/errno.h>
1 B" k9 Q* h8 S( P9 T7 n, N8 h - #include <linux/types.h>
! P' I; u6 w! Z% y4 F3 E7 D2 I3 f - #include <linux/interrupt.h>
! n8 U5 D$ I$ `! a& `, S0 [ - #include <asm/io.h>
f7 ~3 {' S9 t/ v# r - #include <linux/moduleparam.h># R8 h/ `) \: W" ^" B9 @, X
- #include <linux/sysctl.h>
/ Y! t5 F9 J. y, C* q - #include <linux/mm.h>
C) R0 R" ~* o* n+ O - #include <linux/dma-mapping.h>- J8 |/ u6 d5 Y- Y ~" Q& a
" I' l' C9 j! A- S- #include <mach/memory.h>
0 c- q" O* j" V) p, i - #include <mach/hardware.h>6 o" B$ u8 t% o1 L
- #include <mach/irqs.h>* F4 [2 ? r( r
- #include <asm/hardware/edma.h>$ h4 o' v4 V8 \/ C6 w
- s1 O5 c- `$ z- J- O$ j& _- #undef EDMA3_DEBUG4 U. f/ S, r7 {. b+ C
- /*#define EDMA3_DEBUG*/3 m& K" S( x: |
- . i- V. I4 N3 N% h, E7 D
- #ifdef EDMA3_DEBUG$ C; W1 y( i( m- l6 _2 V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 R6 B& O: F2 }; e% H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) b; e8 H; }( x# ?* K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# O+ n4 C9 U7 O& j. z! f, o - #else/ B2 H0 @' y% f5 s7 `9 C( ^
- #define DMA_PRINTK( x... )
, f1 h( I, f: C - #define DMA_FN_IN
) U; V3 Y$ d1 S5 c" h9 D- V5 k - #define DMA_FN_OUT
# o7 B) A4 ]9 ~! _0 j - #endif" r" i. X9 Q' R1 z8 |
7 X5 D! A5 T0 Q3 B+ A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ K4 r- B3 @. B1 C - #define STATIC_SHIFT 39 C# n8 |. a3 C9 X* Q$ d8 E
- #define TCINTEN_SHIFT 202 n: u4 m9 v' _/ o/ m
- #define ITCINTEN_SHIFT 217 S3 z1 c1 Y1 l& l
- #define TCCHEN_SHIFT 22
( P* }8 y) |& @7 ~0 k& n1 c - #define ITCCHEN_SHIFT 238 M5 r0 U7 t4 c( G
- 3 v8 N7 o! ?" J# v7 [
- static volatile int irqraised1 = 0;
/ ~$ V3 g: }' ~5 C - static volatile int irqraised2 = 0;
1 m$ ~0 f0 f; ` w, k& I0 n5 i1 G - Q5 {9 v& \! Z/ i, q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. y. f) j' t$ c0 L; t; }. A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 e) Z' I4 j# ]! H$ n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 V d* g( P( w% i
# o0 {; L5 O# ?/ e- dma_addr_t dmaphyssrc1 = 0;
, o' K) Z5 r: h; q# O' V* ^3 ] - dma_addr_t dmaphyssrc2 = 0;
# @' }# m: W* x. w - dma_addr_t dmaphysdest1 = 0;3 A9 W/ j+ ]/ B9 Q; d' N8 x* f6 d
- dma_addr_t dmaphysdest2 = 0;5 Q2 w4 i0 R: x' ]
7 y/ [' g- [$ b- char *dmabufsrc1 = NULL;
3 Z. k4 T2 ]& \0 t w9 Q: M- K - char *dmabufsrc2 = NULL;1 [9 r: ?0 s0 t0 f$ n6 @, w6 k
- char *dmabufdest1 = NULL;# M8 {) L; g: x1 B2 Z+ Q
- char *dmabufdest2 = NULL;
. `% ]" M+ \7 K5 v+ i
: c- ?* }& i5 e8 ^% t5 l- v9 b5 i- static int acnt = 512;
1 M, z F* t2 n+ f: h9 } - static int bcnt = 8;8 F) V$ x4 o' Q1 z, S2 O( b/ s6 O
- static int ccnt = 8;
4 E! U0 a' x. T+ I/ e2 o$ ^ - 2 [ ?2 U8 N( b+ m
- module_param(acnt, int, S_IRUGO);7 _ R4 G& U) X U- X7 A
- module_param(bcnt, int, S_IRUGO);$ l% ]$ @2 o" G5 I
- module_param(ccnt, int, S_IRUGO);
复制代码 3 Z7 H: n- R& `0 n$ w
3 j. E" q7 l5 g7 |3 u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. g7 W) ~0 _' p! u! G8 ?* |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- n: l# m7 c( e5 n/ ] n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ Y6 |% w" t5 G8 Z
2 Z- p+ y4 M/ f' i
- H- k- x: t" J- R' |5 E [ |
|