|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 B! l1 v8 X: _! N
- [code]EDMA sample test application, r3 K& V0 A9 b: _2 L
- /*1 r1 e% F9 u7 d$ U: Z
- * edma_test.c
! V) X5 R6 |; O) K - *
; g* ~% [$ B8 d$ w" T; o; G - * brief EDMA3 Test Application$ Z) I" V+ l3 N
- *# l* F2 D$ T6 `* g% H$ g5 P# r, m
- * This file contains EDMA3 Test code.
( ], e& `8 t3 n - *4 T8 ^' n, A5 ?) Y2 |: p; |: s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 W0 X7 H! m- _( [) L6 J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* A; `' u" J; m8 U9 N
- * TO CHANGE.. c: \# m2 |; }
- * A5 P5 C( U! M7 x1 d: y/ V8 n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% I4 }2 P* B3 p& ?) E - *
. \2 a I( `, _ G - * This program is free software; you can redistribute it and/or/ L) {7 Q* y, H: E6 }6 H
- * modify it under the terms of the GNU General Public License as9 E3 s I ]7 D% }+ w+ E# k, r3 X! K
- * published by the Free Software Foundation version 2.
) s3 I5 E0 m* J# r3 i6 r5 N6 F - *
1 N6 ]0 B0 \% }$ [9 Y( K! @% f2 x* _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# c$ K+ a( \" t: m+ m- R, C - * kind, whether express or implied; without even the implied warranty
7 y C& J! x0 V$ i2 C2 J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* `8 C' [" R q$ o% V& k0 z
- * GNU General Public License for more details.
# F, O0 B& V1 p - */
; }' C( l# |! H - % }* e0 ]- p: o- _
- #include <linux/module.h>$ s, [9 Q4 A9 N
- #include <linux/init.h>
0 k+ X8 B7 j. S - #include <linux/errno.h>
$ G- p0 _/ u7 l0 B0 @1 I$ W - #include <linux/types.h># w I0 f( P- y2 K% `6 R6 O9 L$ y
- #include <linux/interrupt.h>
" E/ J1 T- h7 T, Q& i$ {7 O - #include <asm/io.h>$ S: y) b \5 a% {) X# q5 j1 x4 a
- #include <linux/moduleparam.h>
3 t( f1 l. P: I; r/ i - #include <linux/sysctl.h>
: w n! l6 D. D$ P- D: B W! {1 v - #include <linux/mm.h>
7 B, o7 J# G6 N1 n3 j7 a# O6 | - #include <linux/dma-mapping.h>
( [3 D5 e6 X/ K; U% z" U7 D7 {% W$ r - 4 ~2 [" l( w$ R$ j
- #include <mach/memory.h>- A/ f( e' J2 @' F
- #include <mach/hardware.h>- o" T' a9 P+ v- S8 s) P1 u
- #include <mach/irqs.h>5 H$ l! [6 R T1 U0 \' a4 ^
- #include <asm/hardware/edma.h>' D) I7 ]* K, T& Y; X/ i
7 @6 t7 X9 c8 `: o& C- #undef EDMA3_DEBUG9 ?4 i/ R: M; O, M3 M5 u6 @9 M7 |
- /*#define EDMA3_DEBUG*/+ S4 F# f( y% w9 t! p8 b8 O
, @ E2 j! _& [) m5 {8 h7 `- #ifdef EDMA3_DEBUG
( m1 W, C2 v; {3 V# V8 z7 p! Z9 X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), [9 A- ]8 W1 s2 y( _2 P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( o" n/ e# f" Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 y& x% F2 {" { - #else
! W' }) |* k; ] o% V- E - #define DMA_PRINTK( x... )
; J( J- R9 C j - #define DMA_FN_IN
; |. Z9 K' k/ Q# E2 f! F- Q - #define DMA_FN_OUT
" h& b7 A+ K6 V* N9 z; Z - #endif
4 M' X9 r% y, z; Q5 q# r9 N0 l: v0 s1 g3 L - 0 q, Z. K, s+ {2 T4 e( a& R6 R5 w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) i3 H; k2 I: a - #define STATIC_SHIFT 3
4 X) O5 [# E7 ~ `' E - #define TCINTEN_SHIFT 20
6 D. N5 u+ H# T( J, F - #define ITCINTEN_SHIFT 21
" J# p( [5 W* U% I$ g# x8 r# u - #define TCCHEN_SHIFT 22: B6 `+ J( r# P
- #define ITCCHEN_SHIFT 23) T# Q" d+ S/ t) M. M& v0 I
5 f* Z' u3 I" E P- ]* }( E- static volatile int irqraised1 = 0;
2 v0 i3 w, e3 c& I8 C9 l: C' m - static volatile int irqraised2 = 0;
2 u* r4 r, A$ A$ F
8 J) K2 x8 V6 [0 G5 D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ D$ ]$ `4 ~) }5 J! p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( m. Y+ o, G. B6 \! u. Q$ |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: f u2 ~! O1 v5 N( x' ^* a
- 2 i4 O) O" s; N1 X" V, v: Q
- dma_addr_t dmaphyssrc1 = 0;
# D- g7 j4 a# `! b! M2 q) {" Y - dma_addr_t dmaphyssrc2 = 0;
; S/ a- r! e; {) v! N7 X" j% ^0 P - dma_addr_t dmaphysdest1 = 0;8 M, p) Z8 l2 [, @. P E) C
- dma_addr_t dmaphysdest2 = 0;5 H+ v l# N& I& H% d9 j1 I- T% B
- + t) s1 N- w" [4 X) j) t
- char *dmabufsrc1 = NULL;
! i ^5 y0 T! p- H" P/ N2 \ - char *dmabufsrc2 = NULL;$ p' X U$ t# \) w
- char *dmabufdest1 = NULL;+ T/ i6 a3 n5 P! z6 h7 E4 r
- char *dmabufdest2 = NULL;7 T& B) M8 q) W( s
- . W i% e$ ^. r+ U1 g4 I
- static int acnt = 512;5 B0 x. y1 r6 u& F3 R
- static int bcnt = 8;& Q4 R! @+ p2 [( L
- static int ccnt = 8;/ P9 ~" f8 {9 t% d* C- y& g& d
- . J5 r2 N# g) s8 U
- module_param(acnt, int, S_IRUGO);
! s) ^% M( e& U, ~. d - module_param(bcnt, int, S_IRUGO);! ?2 {' A# c7 w% \5 U
- module_param(ccnt, int, S_IRUGO);
复制代码
! W* s6 f# P7 F) E( W0 c' [. A! S6 H% g' p5 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 t5 a' y( _. Z- _+ J1 p! C4 M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
P9 J. d7 J8 e0 O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- V/ H- Q1 ~( H" H6 f7 m1 }1 F. d7 l+ U- ]( D0 s2 E
/ O% C' Y& N8 B. B. g2 X
|
|