|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 z5 G/ Y$ @5 k) r8 m1 `) I- [code]EDMA sample test application2 d1 q) ^- G+ d$ R. `( C
- /*
" k; R) M7 a9 I# L- C& @, H - * edma_test.c9 \3 ~0 ] O$ Y F% `
- *
4 i% I8 q, R3 a3 K8 j; C - * brief EDMA3 Test Application
( ]$ T% S5 e$ _# u1 N1 y - *9 Q, i1 G* U* `% F6 Q, _$ y
- * This file contains EDMA3 Test code.
3 R. r, N( F+ E- f/ G - *
& a, g4 G- y0 ^5 ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 C+ t6 n8 N$ N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& b: H! N4 V5 u: ]6 D( w4 h - * TO CHANGE.' H8 H) H' h8 E$ F$ @8 e$ s
- *- n9 v1 U9 Q0 E1 C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 _9 x, |* s0 b2 o/ R% m5 L$ } - *
3 G& h/ r; p- ~3 A3 }) s) F - * This program is free software; you can redistribute it and/or
/ X" L( t# Q6 w% I7 D, Y2 i - * modify it under the terms of the GNU General Public License as
$ y( _( k# l3 `4 X" I - * published by the Free Software Foundation version 2.
9 i" \& B9 }) P2 C: x$ c - *; U% i2 c% T/ t/ q) A3 }/ _8 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& y7 I/ Q4 J9 f* K7 o' n) q - * kind, whether express or implied; without even the implied warranty
, S, z' a' f) D: y6 j& ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 |6 Y. N8 W4 h9 _# i9 B, F
- * GNU General Public License for more details./ D/ [( l" ~) m4 }$ O
- */
$ G: x) ^: g" j; K0 Y* \$ L" h6 E
~* u/ b" a8 A6 c9 W- #include <linux/module.h>
* l7 v% Y6 `; f; Z* }) U - #include <linux/init.h>
/ M0 C+ ]) u/ s( m# M+ |6 {. ? - #include <linux/errno.h>
) l3 y1 E8 B" ^0 Y8 @! M - #include <linux/types.h>% L3 Y1 y" B5 O. M# a
- #include <linux/interrupt.h>2 v* G* T2 k R! a! M0 R+ I
- #include <asm/io.h>
0 G/ n# I4 v" f" v2 _1 {1 q - #include <linux/moduleparam.h>" l3 s X- f( V* |$ Q' d0 g
- #include <linux/sysctl.h>9 _; s3 E* {' `* w
- #include <linux/mm.h>
; n$ n O. A1 I - #include <linux/dma-mapping.h>; |. X! y1 S& r3 S& i* v1 ^ i0 ~! D* i
- # c3 A& k6 a/ E4 r$ `8 U
- #include <mach/memory.h>
" E' Y" M3 H# S" [) M5 R1 R8 e5 S - #include <mach/hardware.h>5 W( u! @, n2 w: k7 v- w) _
- #include <mach/irqs.h>
; L( e& v6 h- c2 P/ D - #include <asm/hardware/edma.h># t, A0 h" _. {0 b6 r d3 y8 g3 M
- ) \* \/ U( Q* ^
- #undef EDMA3_DEBUG, H4 S8 E" ~2 W0 n
- /*#define EDMA3_DEBUG*/- T0 E% c& x0 A# Z/ r% }
- 8 q5 C/ w" N) K: f9 X8 D
- #ifdef EDMA3_DEBUG- j( J# w- F1 C3 Y1 I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" j2 ]1 P$ n7 x& P: s5 `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 R1 p) S4 u, z6 t' m k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 Z4 w2 N; J! s5 q" W7 C
- #else S* W+ a( O) [( ?5 d
- #define DMA_PRINTK( x... )
1 H, E+ \7 l' V. j; P - #define DMA_FN_IN1 I: D/ v2 x, L8 ?# ]; M; d B- z
- #define DMA_FN_OUT
9 m$ W0 K1 S/ x' q - #endif
- f: O4 G, A/ p2 {$ W n7 y
& d! D7 z! Q9 J: J8 H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: Q; k9 ]8 D% f8 T5 ^ - #define STATIC_SHIFT 3
7 @1 ^" @! P# e9 J' e: z1 M - #define TCINTEN_SHIFT 207 i. L: k% } I- X, [8 K" m: o w
- #define ITCINTEN_SHIFT 21% }6 L$ ?9 T H) h" K6 e
- #define TCCHEN_SHIFT 22% Q- P! G" K4 X6 L
- #define ITCCHEN_SHIFT 23
# Y& F5 z1 W+ X: U& k - . U3 E) L( I) H2 e' Z' Z
- static volatile int irqraised1 = 0;
! y7 s0 k8 n, G8 y8 ? - static volatile int irqraised2 = 0;4 O6 O; A4 F7 |- Q' z& T6 H
2 [& C' E9 z P) k5 _! w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
a: E n( Z5 s5 ?- _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 M& k1 H- Q" [ h& z% X2 c' [2 c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# `8 j+ _* x1 J" I! h) V+ ]
% `( e* {# ]$ i& g- dma_addr_t dmaphyssrc1 = 0;
5 ^, {$ z D) X3 Y - dma_addr_t dmaphyssrc2 = 0;! t! p# _4 b0 K% s, e2 x+ j
- dma_addr_t dmaphysdest1 = 0;
0 J4 T$ w% r, D" ]- J - dma_addr_t dmaphysdest2 = 0;
2 V! W0 l7 T1 u9 @. [ - ' l- `5 W( l% B, o4 o
- char *dmabufsrc1 = NULL;! @8 {1 ~3 u2 {% l3 z9 H9 Q: o) |
- char *dmabufsrc2 = NULL;$ y, s+ t; ]& \( @
- char *dmabufdest1 = NULL;
" e7 W* b! y ~9 Z9 }3 V - char *dmabufdest2 = NULL;. A5 S4 W8 L+ ^9 v
! I p: S3 Y; v: }% f3 V+ T- static int acnt = 512;: q, m/ {+ [6 z# n
- static int bcnt = 8;
: W1 L1 N: \( }; m - static int ccnt = 8;0 [; a l, w3 ]$ `% w( l1 k
' a- Q2 {: [; {. J) R# T8 C- module_param(acnt, int, S_IRUGO);
& ~0 y0 F$ C7 y2 h1 C# M - module_param(bcnt, int, S_IRUGO);) e/ e. ^' ^- H/ |
- module_param(ccnt, int, S_IRUGO);
复制代码
* K n' r* o' E) @* g6 m6 r( e; M- ?8 w! Q+ n/ `+ ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ J7 o9 m% M, G* {; Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 z0 v1 F# i: Y% e: {9 M0 g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ F1 }7 X4 q) J, _% G# k; B+ f0 q/ l: f7 S) \* }# T5 s; Q
8 n! Q G$ ]# S' s# A6 Z8 y
|
|