|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 L9 u7 G" u7 t) I) m: R) X+ H* I3 b- [code]EDMA sample test application/ Q% e8 a$ }/ z, r
- /*
* L4 A- |1 y4 `7 O8 T# o - * edma_test.c1 t( |; R8 O/ C- Q9 c
- *& k; P9 a2 m* g D6 a$ [8 W
- * brief EDMA3 Test Application) L8 D6 ~4 A/ R+ y3 n
- *
0 S+ R2 g" M. Q5 E1 ?" D% ]- y - * This file contains EDMA3 Test code.9 ^: ^, j! f& c4 c; u
- *
" y. C7 x0 I/ d7 w8 G$ D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) v( K/ W; \! Y& Y3 x& n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 ]$ H9 F: x. k/ X+ _ - * TO CHANGE.
8 `7 V7 t) {5 C5 t B( j+ ? - *, @3 G# ^* G# y1 y6 p! e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" O3 g- @5 n, H! C- l0 r
- *
$ s* V* s; T7 P - * This program is free software; you can redistribute it and/or
( I* z$ H& L# G; P - * modify it under the terms of the GNU General Public License as- W& R# \; q- u g- T
- * published by the Free Software Foundation version 2.
. r# A: Q/ g0 v$ x/ N* x6 r+ U - *
5 i, R0 f0 J& J* z* p' s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) K6 G8 Q: x% k- t4 X3 n* r* p' b
- * kind, whether express or implied; without even the implied warranty. P* d% K7 x' g7 y/ m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 S; i5 d$ j! R - * GNU General Public License for more details., Q o$ H/ Z2 @8 B6 @& ]
- */0 |$ \; E8 \" i. \9 ?- l
7 Q* c# V0 w C/ c0 m9 ~- #include <linux/module.h>
% u, b" ~* `, ?7 l3 q - #include <linux/init.h>5 ]9 y M, w9 _% c! j% b
- #include <linux/errno.h>' Q, U s1 @. D% ?% P. h& u! e2 {
- #include <linux/types.h>! t3 S7 H" F% ^' X9 ]# F' V/ m2 t7 n
- #include <linux/interrupt.h>
9 r8 x, M# s: D7 n - #include <asm/io.h>' f1 [5 \* ^9 I
- #include <linux/moduleparam.h>3 q* o! a) Q' \& u
- #include <linux/sysctl.h>0 U% \/ ` }) z* a$ N# B" z2 `
- #include <linux/mm.h>' n% X: e! ]' v7 x/ X) R8 k
- #include <linux/dma-mapping.h>1 I6 S5 C4 i! N$ u; u4 R, L
* o! ^( K# U o& j; S+ \- #include <mach/memory.h>+ y: Z! o! J; H3 L7 H: t
- #include <mach/hardware.h>4 u. U+ G$ X+ V+ `' D
- #include <mach/irqs.h>/ N+ Y5 g* j9 c2 Z% P" ]% w. U( S* M* u
- #include <asm/hardware/edma.h>1 l1 H. L7 ]$ m
- {/ v! V4 l( M! i- #undef EDMA3_DEBUG
5 J- ?) [& P1 b - /*#define EDMA3_DEBUG*/
6 I) X# D! p6 R. h
/ F7 k& a6 f9 n/ @# G- #ifdef EDMA3_DEBUG
$ c+ E6 R8 }/ ~- K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* I9 U+ Q# R' A' h! P9 r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, M# g- }" z* n. e* _/ e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% |" C. _& m" `% l9 Z$ s
- #else) z" x( H, F: [$ m$ t
- #define DMA_PRINTK( x... )
; r+ |, s h0 {- y* R3 P) N- l) l/ P - #define DMA_FN_IN" b+ f D9 u" n V5 r( d5 |& }
- #define DMA_FN_OUT: m- Y( E0 B6 E# u& ]6 R! o0 n
- #endif
3 c4 T. U. l. ~ N9 i, i! |3 @% e
+ s& O! Z) ^9 W, V$ H2 G; M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% v( q. H; S! a v+ m9 L, V - #define STATIC_SHIFT 3
, s: W6 \0 R: a. x# P& q - #define TCINTEN_SHIFT 20
3 E( f- F' b/ g! ^" m" w - #define ITCINTEN_SHIFT 21
9 }" k* c1 J. \- b - #define TCCHEN_SHIFT 22
& g; W! H. i" \8 _. L: D2 P8 o: c - #define ITCCHEN_SHIFT 23
" [! c1 a0 H! n# Y6 O
' |4 S/ S; ]; b# ?, a/ `- static volatile int irqraised1 = 0;' O+ l6 Y9 c3 N' ?% c
- static volatile int irqraised2 = 0;
! V% J- G6 I4 z) W
6 Q0 [( d: g' D6 o8 s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ ^0 P1 P* c- ]* Q" w- w$ W6 z4 k# ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, q0 V. ^+ Y, s' O, g; d% r& h! A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& {* r: H& _# ]: B+ K. h
+ p" c- k# x& s. n- dma_addr_t dmaphyssrc1 = 0;' Q1 R2 Z) a& F# V' C4 `( ?
- dma_addr_t dmaphyssrc2 = 0;2 m2 H7 v6 V4 h" y4 l e: b8 L) ~
- dma_addr_t dmaphysdest1 = 0;2 r5 ~# l% a- C n
- dma_addr_t dmaphysdest2 = 0;! B, B+ o) y+ S6 L1 n5 b$ o; `
' i' y6 y% a, p5 D! E/ e; |+ ]- char *dmabufsrc1 = NULL;7 `* N1 A( ^+ j B. d) a
- char *dmabufsrc2 = NULL;( R$ A( a8 R' @
- char *dmabufdest1 = NULL;
9 n% j# K; `2 a n - char *dmabufdest2 = NULL;5 g, D( g7 y U! v) `- D# G
! X- o+ E, F: y( K2 l* `3 J4 O- static int acnt = 512;$ a6 T: z4 p9 [- a
- static int bcnt = 8;
) d8 m) u3 o; U. Q( |9 p3 o - static int ccnt = 8;) S& n0 V' R# B D, `7 f
' T0 Q- ?8 J7 l' c/ Z# V- module_param(acnt, int, S_IRUGO);
& u3 j7 e: m, b8 g/ P" P$ q, L - module_param(bcnt, int, S_IRUGO);
& d+ c' d9 J4 A3 z - module_param(ccnt, int, S_IRUGO);
复制代码
3 j( W+ G5 I' [5 u/ b! t n' K
% j: ~( F, C( V( u( I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 L2 [! G8 T2 J# qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 _6 ~, T1 T# Z: i; p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 n) m: K1 l. Q: R
8 ? W2 z0 h1 K5 o% u: z5 ^: ]+ v/ d- J* S" Y* P& y
|
|