|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & X3 R+ M) x- z6 W) y. w1 \
- [code]EDMA sample test application" s1 M# A; S {* N% ^, |) E
- /*
7 s# _& E, f6 j4 R. N" ] - * edma_test.c4 l2 ~9 u0 r }' T! y
- *) ^2 H9 [3 v2 C& d7 e8 a
- * brief EDMA3 Test Application0 r# i/ K' D1 L
- *, J9 t6 D" V6 t3 D
- * This file contains EDMA3 Test code. _' ^5 f: d0 o& N2 R! R F
- *
/ ^/ X7 s+ y* P9 |& x1 ^3 L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 Z9 ?, t& V5 F, q, w9 ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% h( X0 S+ S+ x - * TO CHANGE.
& m' T. e& V) o0 n - *
& E7 D9 M& M$ \3 u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ j Z! S' {8 R- j( H: X; { - *6 P5 o0 \+ h' C3 n+ [
- * This program is free software; you can redistribute it and/or
1 H0 ?2 L5 S* c - * modify it under the terms of the GNU General Public License as
6 [' Z5 b$ ^- J3 L0 K - * published by the Free Software Foundation version 2.
. i; F, P) E' g. v' H" ^( X - *
9 U& \' u0 B9 M0 u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 E% X3 x! Z* O# z7 ]9 T - * kind, whether express or implied; without even the implied warranty3 P$ N& L0 x. B( `' o9 {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 Z/ I7 Q! l* \7 _. }
- * GNU General Public License for more details." O- W" c) V+ h
- */
3 c0 H. g" z) t3 M5 I0 S& V - , ?: J' x" P# J4 R
- #include <linux/module.h>& d6 D! p/ p" d4 s. K6 N2 h/ i w$ k
- #include <linux/init.h>! n9 Y$ l) N) J9 o; A: e( X/ g/ B
- #include <linux/errno.h>
/ G+ c9 C# B; C" H5 V - #include <linux/types.h>
" Y5 n& R% ~; j) P2 X3 x1 a - #include <linux/interrupt.h>
/ x) b3 u5 n- @( o% o - #include <asm/io.h>0 P% M9 \6 @6 A h1 i7 j( e
- #include <linux/moduleparam.h>* } r2 B- A4 I
- #include <linux/sysctl.h># Q6 y5 V, R9 z# \( K8 K- e
- #include <linux/mm.h>
/ B* O, q* s) W4 t) p' I' k - #include <linux/dma-mapping.h> s$ G$ a7 j. [8 D
4 _( g% U2 H$ F1 p3 ^1 N- #include <mach/memory.h>
4 M2 R! V1 H+ r8 j3 g - #include <mach/hardware.h>
2 Y6 P' D- K$ \ - #include <mach/irqs.h>
; b; M+ V; o1 p! D1 n8 d4 [ - #include <asm/hardware/edma.h>* }! a( r! ?7 X C0 S) w
8 t8 j* X4 J1 W# F8 C7 H- #undef EDMA3_DEBUG6 H% M0 ?+ V' E( K, F$ u6 y5 [. {+ y
- /*#define EDMA3_DEBUG*/- q" w# m( [4 K8 T% q+ j
: q6 s+ Q8 ?2 I a4 o- #ifdef EDMA3_DEBUG
) V' Q; K8 u* Z% E, n7 s8 S: a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 b: g3 M& N8 m& {1 g. R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& Q3 B1 R7 C% j& H# e# D' e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
b; k% L8 g9 g4 H - #else
7 \% v6 x, t2 |5 O; D0 o0 @9 D - #define DMA_PRINTK( x... )7 C' B, u( Q3 \* G
- #define DMA_FN_IN
4 C9 @4 p$ W3 u: e - #define DMA_FN_OUT3 w9 Y; t0 k. u, e J E, W
- #endif
! f* q9 |" z9 ?6 ]8 K; T
( o5 A2 C- \ A- L" s1 O1 G( q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* N% z8 p h. L; U3 W" X - #define STATIC_SHIFT 3$ x+ V* R& M+ c9 v% C
- #define TCINTEN_SHIFT 20 F3 z* u) v a3 {9 P+ x
- #define ITCINTEN_SHIFT 21
' C$ c2 U& B1 k6 k3 _ - #define TCCHEN_SHIFT 22. v% |& a! Z4 o/ Y$ [
- #define ITCCHEN_SHIFT 23
; A6 F3 T! ?" o
$ ?6 P: A. K6 k* M- C& C! [. y- static volatile int irqraised1 = 0;7 d; o' ^ R; t e, e- y) j5 u
- static volatile int irqraised2 = 0;& C# k! X3 W$ M
- % L$ h: g- @% `0 @5 x8 w* e3 O; r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ?0 |, K. t3 e# b8 f0 {0 `( _, J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ?7 f4 D3 K2 f8 A7 U+ \8 P& F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; {: }1 w( T& D4 E, P; C- A1 O8 N) M
- 9 o& ?5 Z) s# i- S
- dma_addr_t dmaphyssrc1 = 0;
- ^1 d8 F7 {* b9 w - dma_addr_t dmaphyssrc2 = 0;4 y6 v6 o# p/ M* w
- dma_addr_t dmaphysdest1 = 0;
; ?: c! L6 p8 S2 ?! ] - dma_addr_t dmaphysdest2 = 0;. J" k4 z( {+ F. v# {1 _5 D
" q; j, o0 s. v5 ?2 J- char *dmabufsrc1 = NULL;
& U# K0 C) D7 T* j& f - char *dmabufsrc2 = NULL;3 C, p: a r4 I0 I, x& ?) w" b& N0 Q1 L
- char *dmabufdest1 = NULL;
% C! }0 ]) W( A& W, v6 T - char *dmabufdest2 = NULL;# r- P+ f$ V& n& _
- " A* p0 w; P% m% s6 B. K% _
- static int acnt = 512;2 U/ r# E- D$ n+ v" m; P) o. y
- static int bcnt = 8;
' m9 w: {/ ?- N$ T: p - static int ccnt = 8;* {; _% n7 y+ J/ p0 B4 a) H4 M N
. h. c$ g) R. E; t8 @/ R- module_param(acnt, int, S_IRUGO);
% H8 R% M; ? m8 o2 h3 B y- Z9 _ - module_param(bcnt, int, S_IRUGO);
2 j0 ?! {, _# @ - module_param(ccnt, int, S_IRUGO);
复制代码
- `; i: K' N q; s8 A2 N4 q2 t
' _/ d! N/ P8 s* ^ A, [- x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ f, k3 m4 z5 F) ^1 y. V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 h. Q- [# P7 C a& S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) B+ U- e! K3 f* g+ L
) f) D' ~" @% J7 G+ D W/ J1 x$ p
0 |+ I3 D/ |' n8 `( `. E9 u4 K8 }
|
|