|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* |" i+ ?2 y# u2 M+ p' U- [code]EDMA sample test application1 X1 `- o( |' `" f: ~6 l
- /*0 n* a/ a ]% n1 @) v) ?
- * edma_test.c3 F$ ^0 n0 g, }- L8 v
- *
9 ]! c" {3 L# ~8 w7 w7 L - * brief EDMA3 Test Application, z f& Z5 t- v; m& |: o& l
- *" t' A5 h" e; q4 h+ T
- * This file contains EDMA3 Test code.
! z) L) P" ?, z. [! E - *
/ b8 D7 W5 p0 |8 I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 G6 D: {' |. R- C' A4 R1 X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 D5 T+ q, w* c- F0 u0 w* x - * TO CHANGE.
$ s; `, T5 A; } A( a0 m - *
; e5 \( T0 N7 T6 D1 t0 d- Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 D9 w: w; Z$ @ d4 x- t0 _) H
- *5 Y$ n- a+ H3 \5 \" `
- * This program is free software; you can redistribute it and/or8 S' ] F: L" T" h& o m, Q& W, i5 q( n
- * modify it under the terms of the GNU General Public License as0 \* n5 \. x' X& b7 @3 W
- * published by the Free Software Foundation version 2.. f. _# y' F4 i8 E% |- V
- *& R) q6 f8 d* ]. ~; S% k6 F. U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- M) }0 u- S4 ]9 D) H! a: s - * kind, whether express or implied; without even the implied warranty
% n4 N$ Y0 ^( R4 ?0 e& a8 c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) q* Y6 O p5 ~! X
- * GNU General Public License for more details.5 ~; C& S& F$ r5 y* O
- */
+ F. O. P# _6 H% Z$ F- l; K/ y g - - N: x' q2 L' C0 \; `# F
- #include <linux/module.h>+ C' _" j3 g5 S, b
- #include <linux/init.h>' Z- r2 Y( B1 k+ Y- o
- #include <linux/errno.h>
0 r. Q/ X4 D/ @7 a$ a9 [ - #include <linux/types.h>, X; ~2 N8 j) [, m* Z+ i
- #include <linux/interrupt.h>
" [2 d, t3 V; s* v - #include <asm/io.h>8 G) {0 g0 {4 f1 P9 W" K" ^
- #include <linux/moduleparam.h>8 a. g) d8 |2 }: L& O- l( y( w
- #include <linux/sysctl.h>( d, ^ H; I4 O5 Q
- #include <linux/mm.h>
5 f: p! l# W: m1 d$ O) P - #include <linux/dma-mapping.h>
9 w% y* s4 X5 y- m4 m6 o; V
$ } P% L2 B& ~( Z- #include <mach/memory.h>
# N, A# M9 v5 l4 k - #include <mach/hardware.h># `: S& Z; c# D; s( D0 @
- #include <mach/irqs.h>
; ~$ _, J% S" M! m, B - #include <asm/hardware/edma.h># L/ u5 g+ c; j8 l- r
- 1 M! v% m2 H/ n' e2 s0 B
- #undef EDMA3_DEBUG6 L- P8 k0 o/ N3 G3 \, a
- /*#define EDMA3_DEBUG*/1 l. i# J1 H9 y! |' y6 a
t$ L5 C. P$ v2 p, I( J- #ifdef EDMA3_DEBUG
& e- \# L/ e7 n0 y4 a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 v+ I b) B- F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). e) S4 b( |5 q' N) N8 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! J1 E5 F3 x z# N& A0 Z6 c
- #else& E+ F: G5 j0 h' ?
- #define DMA_PRINTK( x... )
/ N" ^. `# D3 c% f# T# k - #define DMA_FN_IN6 x* L) u# F3 W6 D
- #define DMA_FN_OUT% o/ n' Q3 _- Y# r
- #endif, R! D6 u" d% w% E$ [0 ], t
3 y0 m1 z; ?: H# @2 J1 c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ `. B/ f, y0 R. o% Q
- #define STATIC_SHIFT 3
) ~& j$ }& v7 G' i2 I8 j - #define TCINTEN_SHIFT 206 b1 @* `" f+ p
- #define ITCINTEN_SHIFT 21
1 V% C7 X8 m* F, r5 _. C - #define TCCHEN_SHIFT 22) I7 b: r8 F" M$ a% k
- #define ITCCHEN_SHIFT 234 Z( O+ P6 {0 Y* x5 E, s
0 W, N3 r$ e) B! ]7 y- static volatile int irqraised1 = 0;) I: Z# T, B+ Y0 C' q
- static volatile int irqraised2 = 0;: N9 f* `' n# U' O: ^6 e2 [
- 7 j8 O. `( X1 I- Q# O5 k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( ~+ R4 e" {8 r3 L/ |8 ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" U6 j+ D0 _! L- K t- Q. u0 c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 s( c- B8 {- E3 e* \2 O4 c
4 R2 p; `+ k( H6 N! _- dma_addr_t dmaphyssrc1 = 0;2 |/ G7 ]4 a7 T$ `% g
- dma_addr_t dmaphyssrc2 = 0;
! V+ }2 e: {2 A- u1 j! f: X - dma_addr_t dmaphysdest1 = 0;
) v5 ^: b9 {" L9 X; r) p1 y2 D - dma_addr_t dmaphysdest2 = 0;
7 p0 _# C, h( J, m7 b8 @; m - A+ L, t2 S) N0 e
- char *dmabufsrc1 = NULL;4 ]; x( d! V$ F- B* M) H
- char *dmabufsrc2 = NULL;9 V" \& H7 M0 T7 V9 O
- char *dmabufdest1 = NULL;' n' T3 y8 Z9 P/ @1 J* [( Q
- char *dmabufdest2 = NULL;
5 q1 k+ x, B: F f1 B9 R
5 v8 \/ i/ j* |: e7 F& _- static int acnt = 512;
- ^" @7 P1 `+ Q& a; H - static int bcnt = 8;
. J* d$ ~, d1 F* `2 j7 s" E - static int ccnt = 8;
7 Z' h% o$ `- \% i
' G0 O$ @- j- g9 V' D6 [) ]7 N8 ^' z- module_param(acnt, int, S_IRUGO);
2 G- I3 k* m) {1 }0 Y( T - module_param(bcnt, int, S_IRUGO); h: s/ d S5 y2 u; A" ~5 l
- module_param(ccnt, int, S_IRUGO);
复制代码
. L! A% z+ h& o2 z2 }' T0 _0 Q& g& x8 i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 X7 D+ h$ A. l/ o3 T8 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ p4 V2 j) c4 X q `8 @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 w% D% v5 S; f4 |0 L7 ~+ C6 U( C0 P
n# j2 S2 `2 n# G& b$ H5 ^" O- i2 S! F" b+ C
|
|