|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ U& \% ?# _ M7 P. W) K1 `- [code]EDMA sample test application
% a2 D+ E& [% a: j - /*
9 O8 X- t( T& M7 N3 k, ` - * edma_test.c7 J* b4 |+ A0 ]6 `$ y6 s
- ** g" z4 K: L# o+ ~( ]; F' }
- * brief EDMA3 Test Application, ]% z7 b0 \. t3 H; j2 f
- *7 g8 n& t: D) c2 k; |0 P1 ^# Z
- * This file contains EDMA3 Test code.0 H9 m+ m8 E7 n, _: d5 \
- */ `, ~% k( k. ^; W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 r" B5 k! W4 W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* M6 N3 p* A4 M7 w1 U- p - * TO CHANGE.
: J6 h( B. J# Y9 n" u: E p - *
- U8 {* J9 P4 w% f! H$ i, y1 a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% ^. }# O" d1 I! f5 ^ - *
! ~9 T& V3 v1 W9 ?1 V) d1 w, j/ S- } - * This program is free software; you can redistribute it and/or
- w5 L+ {# I7 ]* m8 z8 i% s - * modify it under the terms of the GNU General Public License as5 {7 n7 m5 H# {5 j! r+ v" D
- * published by the Free Software Foundation version 2." H+ n5 h" N/ \# a& S2 r
- *
0 g6 q L- _: @; w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 f o# Y- w4 }
- * kind, whether express or implied; without even the implied warranty* O+ X" |* k- X9 k1 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) s8 q6 R3 u+ ?% g* e - * GNU General Public License for more details.
- [+ O) a- `6 E( `( \ j! e - *// p; |" y0 U1 S7 {
. b S) e/ D3 Q1 A* v9 q/ d9 Y- #include <linux/module.h>+ x+ ?) {' J+ O2 Y5 A H0 N- `
- #include <linux/init.h> l; N' w9 p3 ~& X
- #include <linux/errno.h>9 y$ Q2 K7 I2 U9 U: F
- #include <linux/types.h>/ N y9 O" l# `; B4 ?7 W
- #include <linux/interrupt.h>" {5 ?- K6 T' @& D
- #include <asm/io.h>3 p% S0 P2 U* L* o. t5 }
- #include <linux/moduleparam.h>
; @) `# @ M& z5 }1 R+ N - #include <linux/sysctl.h>+ [ R/ k/ J3 |: \$ ?" y* x, N
- #include <linux/mm.h>' Z B# M; I! A3 q# Q4 F( D: d
- #include <linux/dma-mapping.h>
9 ?5 P) O7 ^6 q9 ~; h - " d% y, Y/ G" I7 s9 }5 G( j
- #include <mach/memory.h>
0 s& @* ]/ Z3 H7 I" i - #include <mach/hardware.h>, m. m# r7 r; d Z
- #include <mach/irqs.h>
, B6 E9 `4 R/ v- J/ }2 n - #include <asm/hardware/edma.h>. X- S) i$ F1 x2 `# o% B& S
$ O4 M! x2 a! a1 O1 U5 V7 g- #undef EDMA3_DEBUG
) q, M7 y* h% r8 Z V' L8 Y - /*#define EDMA3_DEBUG*/
) J* i* X% F Z; s) Y$ T1 D - 9 q- y1 r3 ^0 K. O5 I
- #ifdef EDMA3_DEBUG# z4 V! B c5 [/ B( j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ D- d e+ t+ q1 f% x% u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 P4 \) l0 W9 {, L5 ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; S2 Q' j1 ^( g: P1 |8 q. V, Y - #else
/ e/ r- F, V. |/ u3 F5 R - #define DMA_PRINTK( x... )3 ^0 L0 W1 ]1 u! g
- #define DMA_FN_IN6 E$ h1 B% i2 Y1 N! C! D! E/ ?
- #define DMA_FN_OUT; b; H' o% e* ~9 ~' y$ u
- #endif# P0 Z4 \9 q* p- X1 R7 U4 ]- _) ?; m
- 3 N7 F8 H2 y5 B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 t) k1 U4 O2 k8 d& ^
- #define STATIC_SHIFT 34 Q5 x( X5 x3 S5 o7 B H
- #define TCINTEN_SHIFT 20* n, b! K3 M9 M0 _' ^) U: X; y
- #define ITCINTEN_SHIFT 21
9 u# W$ t; x! m) W - #define TCCHEN_SHIFT 22
; D% S# h% w" D Y+ I - #define ITCCHEN_SHIFT 23
0 n; o- h; @# | ^. }
8 ~" d" V) {% K: c8 {! |# p- static volatile int irqraised1 = 0;$ P. T# V2 X# f8 l( u: L
- static volatile int irqraised2 = 0;& M( G# l- R1 {% \! r9 k1 R
- ' M1 p6 v2 @/ ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); z7 E5 r3 f7 [4 C: [0 N& t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# N0 F5 f4 t% B0 K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- t, C# Y& ^; U3 E% \ - 2 C2 y5 q4 Q$ C
- dma_addr_t dmaphyssrc1 = 0;
* H6 a, Z( T5 u- c4 \ - dma_addr_t dmaphyssrc2 = 0;$ ?' t6 u* p P8 v
- dma_addr_t dmaphysdest1 = 0;
& A+ k% p; w8 D0 z: l( V - dma_addr_t dmaphysdest2 = 0;0 B8 ~4 g$ E8 d( a
- 7 x4 b6 S9 B- q% b$ m+ x0 F! c
- char *dmabufsrc1 = NULL;
6 E8 X* U: q. r2 f1 y9 @. Z - char *dmabufsrc2 = NULL;
* c* O! h/ N; R& w - char *dmabufdest1 = NULL;# F0 j# N; p! L: N# `: j9 d3 K
- char *dmabufdest2 = NULL;
7 X% d$ Q5 e/ ~' R - # }: |$ d4 s( D2 R# q3 r% z
- static int acnt = 512;
$ y4 E, `5 E2 D$ d8 ? - static int bcnt = 8;
7 R" r1 W5 w9 R& E( l/ c - static int ccnt = 8;2 `. v8 J" C1 r' M. }( R$ ]4 T
8 J. c+ h" X& D- module_param(acnt, int, S_IRUGO);5 N5 Q* N. t2 T7 o# q J& u
- module_param(bcnt, int, S_IRUGO);
! {1 V: j: [2 h0 Q, s - module_param(ccnt, int, S_IRUGO);
复制代码 ) h% D" J& }# \* y r: Y. c0 `
1 S, C. [) [7 ?9 P+ ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 H# u2 A# O2 B0 B0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# u7 z1 f P# R: v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ V6 J# k+ g) X: p$ _0 {2 _; G/ e4 g' t/ S! R- K( K$ }' ] I
9 e/ |( z# ~- o& c2 Q
|
|