|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: s" ]. C6 `# U0 m( g- [code]EDMA sample test application
3 V! j! Y+ j, k - /* F' R) R5 v9 U5 q0 `8 q& I& W
- * edma_test.c$ a3 ` N5 Q5 [2 m3 J
- *; c( G- ^& G+ o+ @ Z
- * brief EDMA3 Test Application
5 O: F- j# z' m! W8 S5 b - *. {3 ^1 S$ Z% x& R: G
- * This file contains EDMA3 Test code.& n3 q* |% T5 w/ X: L }$ _
- *
! D, u4 J7 S5 b8 i7 h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 Z! X* J4 E- b6 e4 s& H( ^3 f9 K, v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ c# p3 d0 ~; b# a* Q
- * TO CHANGE.
8 ~2 p: _6 w5 [: c2 p" Y4 X+ ~4 s4 t - *) M6 S/ F2 O& X+ h( R" P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 x3 r. t* ~0 s& s - *
3 T4 n" _8 ~- c/ R0 V% l% w( r - * This program is free software; you can redistribute it and/or! s! R6 i9 A8 v2 E
- * modify it under the terms of the GNU General Public License as
: a3 d! x: Z. B' M! R - * published by the Free Software Foundation version 2.3 Z' I# O$ I7 _/ \6 L1 H) O
- *
; p$ L+ M4 `2 S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' A% n& |3 g. l/ d- e
- * kind, whether express or implied; without even the implied warranty
; V8 f0 m; e! x' O4 A, P/ p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% z9 v+ ~/ ^' d, m1 h+ B9 T( l
- * GNU General Public License for more details.2 t( W7 r, X E# i3 s
- */2 l9 J! i' \/ L5 @ _
- ! I2 B/ F& ^/ y
- #include <linux/module.h>
, s6 I0 `6 U2 L+ ?* J - #include <linux/init.h>& w- ^ N2 t9 g3 L* y0 b. A
- #include <linux/errno.h>
! s: K) ~8 {8 V3 Y7 w1 S - #include <linux/types.h>
* f3 n1 X& V8 C5 G3 _ - #include <linux/interrupt.h>, S! C& a' \9 [/ E' G- b6 |- h9 y
- #include <asm/io.h>
+ Z2 v, E: M! L" u - #include <linux/moduleparam.h>
% j% e3 e# ?$ f+ A. Y, ~+ X$ X - #include <linux/sysctl.h>7 \% X& K2 B( a5 S F
- #include <linux/mm.h>
( M5 S0 F9 B- p& }6 C - #include <linux/dma-mapping.h>6 x- j, A+ |2 L% a: O7 T
) P3 W: a6 F% Z% ~' z: n1 y8 Z+ Q- #include <mach/memory.h>
5 C( @; |2 q3 d) ~ - #include <mach/hardware.h>
6 Z; G: c% s& Z* }6 q. V - #include <mach/irqs.h>
( H3 s. O1 Y8 s/ @1 W# g( f - #include <asm/hardware/edma.h>& ]' n9 d1 a8 e9 m$ m
3 m, V) u! T) t1 i# e- #undef EDMA3_DEBUG
# \; K7 u! Z7 u: Y+ Q - /*#define EDMA3_DEBUG*/
! J0 v" u7 }! j* A+ I - 5 J( t; f2 K1 P! a* C p* h0 j
- #ifdef EDMA3_DEBUG& \" M) C4 g- G+ L# d# I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, j2 u; L, Q" \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
j& [/ g( L0 S) q$ k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 _* d: F$ G. a
- #else
1 y; t, v- @7 Q6 g* P3 v9 N - #define DMA_PRINTK( x... )! u/ ?* x; E1 D+ g) h
- #define DMA_FN_IN, q: o7 X6 S7 u: p; h5 Q9 I
- #define DMA_FN_OUT
4 N* D7 V, a2 d - #endif
+ D9 M: |% U: M+ T4 }1 A1 H! t- q - . x9 c$ Q% B2 g; b3 f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* P0 v1 j- Y/ p5 O Q. @
- #define STATIC_SHIFT 3& u4 s, A8 Q3 J% z+ Q* {/ G
- #define TCINTEN_SHIFT 20
# k- V5 ^, A* |, Q* \; K0 q - #define ITCINTEN_SHIFT 21- n: X. p) [# T7 c% a9 k1 }
- #define TCCHEN_SHIFT 22: T% w. E) F" A6 M) V8 x% _
- #define ITCCHEN_SHIFT 23
' e& _2 T+ v2 S/ C' H6 O( q
" d; I) z# S0 h( O5 E! w8 M0 j1 Y- static volatile int irqraised1 = 0;6 m5 T% i+ S5 U3 W1 F# ^+ `
- static volatile int irqraised2 = 0; i' Q& C7 j& x( j+ Z
+ |. w* o3 U2 f8 c9 A3 n- s; D# `- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 G; z# x$ G5 i, L, |7 J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
g, t. `* S6 L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 {/ F; t' G. m2 a
; z" Y3 r$ ~' A: V& t6 j! H- dma_addr_t dmaphyssrc1 = 0;9 Y) v3 W( v/ y. h0 c/ M
- dma_addr_t dmaphyssrc2 = 0;3 `' ?( `. C- ?$ T# c6 X2 G
- dma_addr_t dmaphysdest1 = 0;) V. R3 f% H f. |- F4 n J7 p
- dma_addr_t dmaphysdest2 = 0;
% _( } j# N, W v" _
) G. N+ z/ _/ q! l3 m9 L6 x4 D- char *dmabufsrc1 = NULL;
7 O% A [- G1 N6 O1 U - char *dmabufsrc2 = NULL;. A1 ~# s! a6 [* Q
- char *dmabufdest1 = NULL;
3 V8 I' m' D; ^3 A - char *dmabufdest2 = NULL;, n0 V' \1 X" r# R' u3 x. P8 X
- 2 r* ?! s' w+ G
- static int acnt = 512;) X9 E. k2 l+ j* ]# \) h/ L
- static int bcnt = 8;% c% l9 ^8 o# P
- static int ccnt = 8;; S4 r& P3 P8 |
1 a, o1 \$ f& s4 M- module_param(acnt, int, S_IRUGO);
7 E4 Y0 H- e0 s- U - module_param(bcnt, int, S_IRUGO);- A! e3 ^1 W, k4 v* x
- module_param(ccnt, int, S_IRUGO);
复制代码
/ i) [1 D* \* h+ H( z- S: B1 f
" A, ^/ y/ j# ^0 n. J' T+ Z) n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* k# T6 M# G3 y% m; xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& j8 s% W4 d* V7 q. T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 c3 X. w V( Z' i, S4 Q' a2 C0 l% B% E' m, E
1 f( ]0 }6 L2 e C# U$ S# q
|
|