|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * n1 [7 c1 ?" W8 P0 `( P( D
- [code]EDMA sample test application3 D# c1 f7 T7 ]) Q {
- /*
, I# g( z8 V5 j v5 R - * edma_test.c% V# H# [3 ~3 e
- *
" ^& w1 U" B& G4 L& ? - * brief EDMA3 Test Application2 P- M7 o0 E. `
- *
% e9 g0 j0 |. j - * This file contains EDMA3 Test code./ }3 C0 A/ |; [4 H( s
- *: D* ?8 L" g- W+ W$ r! _, y; Q+ C) Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! r/ o2 E' n, `* a y, I: l; |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 r4 f' i* M- d- t" R, P
- * TO CHANGE.
9 u# d* ~* d* ^ - *' i) j+ v% F" L% g4 E; b; k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// k* J% \* h3 k) X! k/ l
- *
9 C" c5 `3 |3 Z7 y7 S - * This program is free software; you can redistribute it and/or0 }- f. _6 z* _- y1 Z! i
- * modify it under the terms of the GNU General Public License as6 A! j G/ i3 P% l+ r4 l% t
- * published by the Free Software Foundation version 2.5 V3 N8 ?6 l8 H" _) K
- *
2 q. K1 |' Z& K' F( S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 `; m4 H- i& p6 s0 R4 I
- * kind, whether express or implied; without even the implied warranty9 r. a3 o6 D$ t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ i3 a( u- k& v- [ N" R - * GNU General Public License for more details.
# s- i9 F1 s6 n- W- A - */# ?+ O7 J$ Y5 s! E4 Q* I* B
- ! Z) G( k6 [" }8 O- ]
- #include <linux/module.h>
$ e, H$ ~* ~* g5 I. a - #include <linux/init.h>
6 t9 q! y# z, X7 Q$ ]1 I/ N/ j - #include <linux/errno.h>
; H* U7 F7 }7 E0 X6 i - #include <linux/types.h>
/ U( g/ r. l2 u, A1 n1 X - #include <linux/interrupt.h>
2 y% _+ F, q( K$ _7 `/ ~: h/ V& L - #include <asm/io.h>
$ F: V; |" M5 A7 `5 h' ` - #include <linux/moduleparam.h>( ?8 k" e. {: q
- #include <linux/sysctl.h>: j( D7 l% S+ v/ v! F
- #include <linux/mm.h>
7 U, M5 v' O4 P$ ]1 b/ G - #include <linux/dma-mapping.h>, b$ g: w T4 r, b5 i+ S% {
* D" L% B, S$ I* E1 c6 o- #include <mach/memory.h>
5 G0 a9 p5 r, _5 h a - #include <mach/hardware.h>
2 B, |- O0 Q/ R5 G+ o1 P& X" q - #include <mach/irqs.h>
, A+ x: v& i" v. d @ - #include <asm/hardware/edma.h># P a: X! ^( Z
- * G, B6 y6 b1 D. J2 m* ?1 D7 d
- #undef EDMA3_DEBUG
. x+ `! y# r9 Z - /*#define EDMA3_DEBUG*/
% [0 U+ T0 X! _' S( [( a9 Y
3 s- O' j1 ^! s- e4 s$ \; t5 p: _- #ifdef EDMA3_DEBUG: q- L" a9 V7 A: i5 I* T" [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" O) l- T# e% ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" n8 x8 m2 u$ h/ t. m" x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 B- }) r- F8 { j7 q - #else
2 k) d: r' A* ?; z! d5 w - #define DMA_PRINTK( x... )# G" B4 k, {+ N" D `3 H
- #define DMA_FN_IN
. [0 \; g5 P8 p6 M5 L' [ - #define DMA_FN_OUT
# g- \* t) P( m7 E, u - #endif
( b3 z+ V7 r1 b! c8 e6 n - , j Z. Q6 Y% X" w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 S6 y5 |0 n! w1 S( h# r2 b
- #define STATIC_SHIFT 3! ] a% B8 H. f- s( m6 {5 y) c5 u
- #define TCINTEN_SHIFT 20& b* B/ Z% n* v
- #define ITCINTEN_SHIFT 21
; M/ s \* G- p3 L% k0 j3 L- N - #define TCCHEN_SHIFT 22 V9 w8 o0 _* H% |8 E
- #define ITCCHEN_SHIFT 23: n" a, W8 \% n w, h
- 9 L: u4 A! g; ~* p% y1 e1 D9 [: {
- static volatile int irqraised1 = 0;
3 U* z* E( t$ O s& ? - static volatile int irqraised2 = 0;7 T' m: }# J( t6 B* [- G$ n/ d6 b
- 1 H" k- u. B9 y4 s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 m& p& f$ |5 a' m7 j$ Y5 q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 q4 u* f3 f9 F& ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( q+ w/ k2 R; \: \
- ! e. j% W+ d4 F2 h& O* v4 q6 d
- dma_addr_t dmaphyssrc1 = 0;
1 F# a) r, J: k$ X, V9 b( R - dma_addr_t dmaphyssrc2 = 0;1 d2 ^, U, B; J( q* P& T8 a
- dma_addr_t dmaphysdest1 = 0;
# F$ [; ?" ?/ z, @ - dma_addr_t dmaphysdest2 = 0;6 B6 T: |. F# b. x, ]" E/ {7 x
3 l4 ~$ M" ]. c6 S! [4 r- char *dmabufsrc1 = NULL;0 M. g! o J+ b1 ?. @" M
- char *dmabufsrc2 = NULL;, K5 r/ n& X* N# y$ g4 \6 N6 c7 f
- char *dmabufdest1 = NULL;7 k2 o" K: @2 P3 K, P" K
- char *dmabufdest2 = NULL;1 a5 R2 N7 c% x# `9 r0 X
B+ ^6 `" p1 h7 v. X- static int acnt = 512;
- \; U, m" n9 ~- Y' `- L" c - static int bcnt = 8;2 e1 L, X! z g+ u
- static int ccnt = 8;* _5 K+ h9 b& V* q n# f
! L' L6 `8 H2 S7 x6 M9 ]9 p+ {- module_param(acnt, int, S_IRUGO);
3 `/ r6 Z Q7 P$ _7 R5 x - module_param(bcnt, int, S_IRUGO);7 J8 f" H2 B, x C6 P% g
- module_param(ccnt, int, S_IRUGO);
复制代码 ) [- i6 U) `! ~9 p/ Z
0 |* Q% a/ X E1 A; R- i, L$ K% p5 Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( _6 s8 }* l% V1 H# k2 t4 jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% o* p; Z0 l z$ f0 h& e6 U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 H; w4 R9 |8 n0 j1 ^0 w1 J- R X& Q" z, l6 n- C
^+ Z* h; w% y2 ] |
|