|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 x! @2 A2 y4 D; H6 t9 M) Y
- [code]EDMA sample test application9 v }3 n v( O5 K3 E
- /*2 J( N' C# |) S" c
- * edma_test.c% {" s: Z8 j. M3 G+ J7 Z i
- *6 n2 p) }- |3 m$ v
- * brief EDMA3 Test Application5 Z) m5 j; v0 K9 N8 @
- *
2 l( n% X3 v" s Q- d: E - * This file contains EDMA3 Test code.4 n' F/ g& X5 I3 j+ a8 A" X* A
- *% g) G8 k6 c3 P) G& \3 i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 C# f% K9 j0 D0 a; z0 s' N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 Z1 R; V* U {- L - * TO CHANGE.
9 N( S3 f+ j& W4 ?/ b - *
4 |: n. f8 l. n0 q' @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! ~1 c' M- [7 S `, S - *
0 q/ ]7 i; D! b9 L$ J6 A& X% x# q - * This program is free software; you can redistribute it and/or
3 p( a0 P4 p2 E! K" { - * modify it under the terms of the GNU General Public License as
' G6 h0 E) C5 Y4 L2 P - * published by the Free Software Foundation version 2.; u7 B) f9 ?$ b* h, k8 ]' [& g7 {
- *
5 p+ T* T* h. F2 K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
W' |2 J ~9 q& c+ V/ F" ^' e - * kind, whether express or implied; without even the implied warranty
! [/ w, V' R9 a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 g( o! ]2 G" z. _ v3 K0 F a - * GNU General Public License for more details.
, h! t5 T" S o3 W - */; p1 d, C+ O; m
- 0 Z/ [! k# o6 V8 }) i8 j |8 m
- #include <linux/module.h>1 G( l/ U) p* @. ?$ `
- #include <linux/init.h>( r: G9 J' q! Q, J/ r2 U
- #include <linux/errno.h>, ]4 ^& P0 Q, f/ s4 U' Q
- #include <linux/types.h>* s* p- W5 d" V5 C C# ^
- #include <linux/interrupt.h>) z; [- L2 D Q' a/ t0 _
- #include <asm/io.h>
5 d# F# P. e9 e5 z) M4 G3 f - #include <linux/moduleparam.h>
5 v" a& ^9 b& h/ P. `& d: C - #include <linux/sysctl.h>4 f) T" y2 U6 ~2 n# S1 h9 P% ?
- #include <linux/mm.h>
. J9 N) y( W) x$ _1 D, y - #include <linux/dma-mapping.h>
5 O1 R2 f7 x" Y
7 r0 P- D8 j2 A% [ b: n4 i- N- #include <mach/memory.h>
* g* G4 Q# R: q3 i& S3 X - #include <mach/hardware.h>" w7 i- ]+ t6 n: E
- #include <mach/irqs.h>1 @1 n+ I/ u7 [
- #include <asm/hardware/edma.h>
6 H, |6 m9 T" x, O# K5 o - ! q4 _# H% l1 B- ^7 q) c
- #undef EDMA3_DEBUG5 J7 U6 `! ~) C+ U2 a
- /*#define EDMA3_DEBUG*/
4 i `* q- `( o* C - 2 l( @( n' ^ c& u
- #ifdef EDMA3_DEBUG+ M9 I, \% @+ F( h" q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) r" F! H4 N9 W! ]0 {# e4 x& n; j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ t$ f* G" ]6 h0 R: H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# V; U9 ]* ^) a- N" ]/ c% p- k - #else
4 c, }: C+ @9 l$ W) q) r - #define DMA_PRINTK( x... )9 |5 d4 W' N) X
- #define DMA_FN_IN
8 [2 C. v/ @4 s! l7 r. H - #define DMA_FN_OUT4 j: l, i8 \4 j! }
- #endif, Z# {' d5 V; ^& ~) t, C' r/ n
, A/ a+ w- _0 J/ O" P4 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% Z/ X6 r( ]" C+ J. p
- #define STATIC_SHIFT 3
2 F" t5 k* Y* @# e0 [/ g S - #define TCINTEN_SHIFT 20
7 d$ G9 }( ]( H+ O; I+ R, d# B$ Y- R - #define ITCINTEN_SHIFT 21* l% W# X* Q0 ` j3 v
- #define TCCHEN_SHIFT 22
) y8 n7 s& \( c6 l8 _, k+ a - #define ITCCHEN_SHIFT 23$ z- G: j' m9 x, r
- 4 n' U# w! ]3 H8 U
- static volatile int irqraised1 = 0;
' F# D9 }% k1 A - static volatile int irqraised2 = 0;
* u3 P& D5 i/ c. M/ x7 T
; b( B& y, _2 c- x) y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& U# o. {0 @. Q. b, ?* P* Q2 Q! e0 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 L% w& _/ G* M% T% y# P3 g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 \+ r" J5 `: A! Y
) q7 t4 x s+ {- dma_addr_t dmaphyssrc1 = 0;* V+ l3 T; D3 g7 t- ]5 n# [
- dma_addr_t dmaphyssrc2 = 0;
c7 @* T, B& \; `# G2 p, C( } - dma_addr_t dmaphysdest1 = 0;4 Z4 F8 }1 M* L3 B
- dma_addr_t dmaphysdest2 = 0;
& M7 a/ ~; W& }+ U. _ - 0 j8 V6 |, r- h* L; Z* n
- char *dmabufsrc1 = NULL;
$ _0 s/ k5 \7 i& p8 B - char *dmabufsrc2 = NULL;
; p$ o7 \1 a5 Y+ B5 p+ O - char *dmabufdest1 = NULL;* f3 S9 W, d6 z- a
- char *dmabufdest2 = NULL;7 [; p# y4 D" R! ]
2 L5 G$ y4 P l: G( ?1 x- static int acnt = 512;
: G+ r# ^" T2 b - static int bcnt = 8;
7 }0 m' O& m4 Q - static int ccnt = 8;( K7 C1 _) a' _5 ^; U2 @, c3 }. k5 z
" r$ ?9 f6 `) J, {+ i8 n* q- module_param(acnt, int, S_IRUGO);7 H1 V+ @% r2 }$ D: B: P
- module_param(bcnt, int, S_IRUGO);3 X5 ]" R/ q5 }0 i1 U/ j( R
- module_param(ccnt, int, S_IRUGO);
复制代码 1 g& Y* s; x* `" x$ W8 `
0 N, ~9 y( |: ]# l& X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) G; g A4 U' Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ o& O4 j% ~/ ?% h) j r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! V- W, \8 n! n8 a: E* ]
% G# J- j2 m# f. D5 Z/ u
: O3 j* J) A3 d
|
|