|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % X7 `) G8 h; H6 U% c( J
- [code]EDMA sample test application
6 \" a1 j+ D: F; W: g4 q" Z - /*- K& r' C1 ~! e8 B0 X
- * edma_test.c
0 J l4 p% G; y; a# B- [* k - *
! v6 J- h& q+ n. F! | - * brief EDMA3 Test Application
2 i+ |2 C& X3 M% k7 ] - *& l/ t' O! q. a
- * This file contains EDMA3 Test code.3 Y. ]7 _$ W; U# W1 j7 ]8 j- J
- ** R) O0 B5 q3 }, n4 n# S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 ` ^) u4 e5 `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- j' F1 U3 h; z( H
- * TO CHANGE.
* o% R1 r' r V% E - *7 `2 w1 Y J( l- a: C* x6 F* O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! T6 W7 M6 x3 y" |' @0 i8 h7 J$ K - *
9 ~! v% I K1 W4 s5 v# C& N" [ - * This program is free software; you can redistribute it and/or% U2 I9 @( ]; Z: n' `1 e' a# S
- * modify it under the terms of the GNU General Public License as
8 R: B1 ]2 F! c - * published by the Free Software Foundation version 2.; i" | R+ S0 w5 z9 T; n
- *
. E* E% {2 ?! _6 W T: b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. r0 U+ W4 U4 f+ v6 ]/ e - * kind, whether express or implied; without even the implied warranty. ]2 t. h+ T$ [! o6 D7 N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% q) u. w9 t" G' H } - * GNU General Public License for more details.6 a, M8 F; \4 {" R! k
- */
" Q' U& F% w+ N; _: Z
, X2 ~6 |6 ^, R4 s6 f: m- #include <linux/module.h>
4 i) t5 _8 E) Z: f1 O - #include <linux/init.h>
8 B: V* n7 H& J9 i4 F& Z& ` - #include <linux/errno.h>
. l9 ~; l( r# G1 a0 L( ?7 y - #include <linux/types.h>! i- V. b+ K g U
- #include <linux/interrupt.h>) A. K& r" B7 R3 A
- #include <asm/io.h>
d F4 I8 \- c6 f1 P - #include <linux/moduleparam.h>
) a; k) U1 Z" `$ J1 a4 X - #include <linux/sysctl.h>
0 m# P5 {+ `" n! O0 `# k - #include <linux/mm.h>7 _" p! s4 r$ g( t# r
- #include <linux/dma-mapping.h>
: E* v; T& h3 ^+ ` - ) ^9 r/ R# D+ e3 |
- #include <mach/memory.h>, `/ w5 m$ l1 C
- #include <mach/hardware.h>
- {0 S8 Z8 U, u- H) x8 c1 T - #include <mach/irqs.h>
3 E% O5 a+ a# ^, ]2 s# e - #include <asm/hardware/edma.h>. |% ^/ [) L' ~& f
! l! ~7 I X% r' T$ E y' P% Z" L- #undef EDMA3_DEBUG( ]3 B) Q9 G6 Q, T8 `( P N6 n* S4 a
- /*#define EDMA3_DEBUG*/( g7 K' e2 U& q3 ?" Z5 m9 j: Y* e( Q+ A
- V: D" U8 L4 N7 f) e0 ^1 l7 a- #ifdef EDMA3_DEBUG
5 ~1 \9 X; n+ H; Y* _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- G* V4 R. W* G: v# A& Q( X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ U/ @* q+ z8 n7 ?- V' U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 u- I9 P E) k' V$ o
- #else, {4 }/ h' r1 c+ n
- #define DMA_PRINTK( x... )
# @, A# u7 R% t( w - #define DMA_FN_IN, q: E5 D4 D: D6 ]7 k+ Z
- #define DMA_FN_OUT
( n4 ~, E! r7 E4 _ - #endif
+ X- g+ _5 }. E3 U! L - 8 H' y0 N; s5 ^- h3 L1 v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 u$ T! f$ A/ ]& @ - #define STATIC_SHIFT 3
! [1 d2 ^, n, B+ o - #define TCINTEN_SHIFT 20
* D' n4 S4 t" ]% e) P - #define ITCINTEN_SHIFT 21
/ r' k6 P1 m- f! n - #define TCCHEN_SHIFT 22
0 c9 p3 s+ V( p, i0 s, j - #define ITCCHEN_SHIFT 230 X- n8 j O* N( X/ T
E) j/ c$ A7 {$ z$ |0 d- static volatile int irqraised1 = 0;& x t0 `. b4 m. B' ~
- static volatile int irqraised2 = 0;4 T4 m' _% B. @( \- G5 q/ S' v
6 K e8 q4 X: X$ h/ I. I! e% m* I5 ?+ g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, s6 }+ k& Q( d3 r& b- K# I. l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, O& L' V& d, o+ p) U8 r2 t# D# b( ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% i( d. Q, I8 a5 v7 V; H
, T4 b( y% `3 m2 R' B3 e- dma_addr_t dmaphyssrc1 = 0;; n7 X( \1 a) y \ `4 _ f
- dma_addr_t dmaphyssrc2 = 0;. P; Q- A5 x" b, h
- dma_addr_t dmaphysdest1 = 0;
' E, @- l# z: o5 |* D$ a$ B - dma_addr_t dmaphysdest2 = 0;6 n, Q' d M6 K( o) ]+ W$ _4 c
7 _" \. k/ m% I% G6 C, Q( Q1 V+ f- char *dmabufsrc1 = NULL;
& J% R+ G9 I; J d" K - char *dmabufsrc2 = NULL;; N7 O0 w p3 Z: [8 e- d+ t8 n
- char *dmabufdest1 = NULL;" J3 @8 Z. e7 }9 p' ~5 X, b) j
- char *dmabufdest2 = NULL;% u. |9 n7 g4 l! t- i& B
- . v5 R* ~# k. h M' j
- static int acnt = 512;! N, H$ ?3 z% T% c
- static int bcnt = 8;
4 u" }/ e2 R: b) j+ \ - static int ccnt = 8;9 _. G: x1 T: I; ]
- + o, ]" G n0 d# V# Y8 c
- module_param(acnt, int, S_IRUGO);1 L' g! \" a7 }( q0 c% F
- module_param(bcnt, int, S_IRUGO);2 p. M, S; {& R N7 j# x8 T0 v
- module_param(ccnt, int, S_IRUGO);
复制代码 ! h9 `( Y, B7 p& g+ N
3 c' K3 p) o% j" b/ v8 J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ \4 E. S" C; u4 @+ a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ ?+ Z3 J4 {5 \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( d% G8 `- Q f0 D' ~- X
( h/ S" R0 s# h: c- y+ G
7 r3 l4 Y! |7 T$ o: x3 b8 C1 X |
|