|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 U& l4 f, x8 `! U9 d. V
- [code]EDMA sample test application! u5 O [1 Y* z2 z6 u
- /*
; J4 K5 Z0 ?/ U - * edma_test.c5 y7 U: _! M( e/ \( N: Z& \; W; F* `, i
- *; p1 i7 x4 X S( e" t* E5 G- l
- * brief EDMA3 Test Application
' H3 ?' m9 J* t3 u2 \7 S! r0 t4 n4 b - *& h- D: M* ]) D$ U H. d
- * This file contains EDMA3 Test code.( t, ?2 x/ y3 q$ U6 s! F1 l+ Y
- *
( b9 Q) N% X- [- F3 Y8 _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 s5 l0 N5 G2 s2 O1 c/ I+ y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 Y& U/ F$ w+ O2 |$ |: g, g
- * TO CHANGE.
9 v0 u' U, Z. q, K/ O# ^ - *
4 R! U, }$ q( e5 v$ v# x6 g F- S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; t2 W9 Y8 x) [$ P N! y - *
; Q3 H9 Q6 y1 e6 e! u$ t - * This program is free software; you can redistribute it and/or
0 x( l8 |8 j3 @4 p4 r- N - * modify it under the terms of the GNU General Public License as: `3 X; u& B: M0 `' [
- * published by the Free Software Foundation version 2.' Z! k! X" r8 f; _1 s0 k
- *
' m) M4 W `+ B( i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 U5 @$ c3 z2 H8 g9 B - * kind, whether express or implied; without even the implied warranty
2 ?9 H4 K" U. \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 M$ Z' c8 {6 w$ s
- * GNU General Public License for more details.! Q& b8 @' w1 Q
- */. M0 M4 V- Q5 G8 H: E7 g0 j
- ^5 k4 l7 K- c$ J- #include <linux/module.h>
# Y- a! u' x# u# R( Z. r' t - #include <linux/init.h>! c7 Z$ ^ @: X' a [& D
- #include <linux/errno.h>: l0 `' w8 n, a
- #include <linux/types.h>
/ ~! O* D) z8 h9 f - #include <linux/interrupt.h>
) r4 w5 e5 w/ s: @+ Z - #include <asm/io.h>( B- y* \' Y$ a* |
- #include <linux/moduleparam.h>5 b ]& X+ @/ o: i; h! E8 Z8 w
- #include <linux/sysctl.h>
( h- o$ F" A' a1 B9 p, Q - #include <linux/mm.h>
" \" }8 J( |8 l3 B( w - #include <linux/dma-mapping.h>3 e! Z0 E( y9 |5 X
* M( F1 {9 V+ h' \2 i8 b9 v- #include <mach/memory.h># \. | K1 y1 a+ b! G0 m- C: v; ^
- #include <mach/hardware.h>
+ j# v- U B/ S6 O- T - #include <mach/irqs.h>
0 _/ f! L: I( ?* o - #include <asm/hardware/edma.h>8 D( V1 r' d. S$ g" g3 R
- 3 q! u2 @! r' n- M% [ Z
- #undef EDMA3_DEBUG# o3 W: O) u8 R# H4 X5 d
- /*#define EDMA3_DEBUG*/2 w6 d4 x' `7 [6 ]
5 r4 X7 Y+ D+ R V1 l; g! L- #ifdef EDMA3_DEBUG
' z) z( u1 ]3 I& O$ T, q( P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
Y0 @6 V" F. Z. e+ s/ f" J1 M* C/ G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 ?9 A. t& d* Z* t. p
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. @8 P9 b; Z: l, P( w; Z# M - #else
: c- c) _, G: _/ d5 A* ^2 R# j - #define DMA_PRINTK( x... )
( X& i5 ~% Z. A' h - #define DMA_FN_IN
- }+ D) t+ M v. I - #define DMA_FN_OUT
: I7 h3 q' B2 a7 T6 D* L- r - #endif! i; x5 ]% O5 l* h6 ?8 K
- * J: ~4 N2 \ X& n7 e- v% }! _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) K; Q \! F; F8 x2 L: _
- #define STATIC_SHIFT 3
$ @! V2 G, B8 O H T, r% } - #define TCINTEN_SHIFT 20
$ C; I7 k2 `/ R) N - #define ITCINTEN_SHIFT 21
. U3 s3 |. d1 b% q6 q' m% x - #define TCCHEN_SHIFT 22
$ t6 W7 [5 [- V" z& E8 f: T - #define ITCCHEN_SHIFT 23
$ t, I7 n8 p" _9 G2 ] - 9 b3 n* A8 V. @# ~2 N
- static volatile int irqraised1 = 0;
9 p2 C% n, s# I. @" g - static volatile int irqraised2 = 0;
2 J) ?$ D) t/ s, E - 9 g @' [: R# g! D1 }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ U1 Y+ P4 k3 z0 L3 i; o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% B# d" y9 L- u. U& |# B6 f D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% J8 x5 A- P7 L/ q! L% U J) T+ s
7 M( _. h# b% D8 ?9 M1 N5 C- dma_addr_t dmaphyssrc1 = 0;6 E2 S5 X0 E2 }" T; S; o0 g* |) x
- dma_addr_t dmaphyssrc2 = 0; D: |6 w* T K
- dma_addr_t dmaphysdest1 = 0;1 a9 |7 y5 w+ P2 E
- dma_addr_t dmaphysdest2 = 0;
( v$ m8 d% n7 F* C- ^ a+ p - 3 ^3 B) N: |) C. `- k
- char *dmabufsrc1 = NULL;* e1 C8 o1 x1 e$ @- q
- char *dmabufsrc2 = NULL;5 ~4 `9 e: g0 s# r. }+ ?: ?
- char *dmabufdest1 = NULL; I$ b- j3 v, x( G, k2 k: t
- char *dmabufdest2 = NULL;# n3 l2 J, R& r9 C ]* A
- : s, M: D# B I% a6 L
- static int acnt = 512;
" W9 g) R ]2 g' o( t/ E0 h - static int bcnt = 8;
# e4 P9 N4 n# a8 k - static int ccnt = 8;- w: D- d; n, g0 a w q
( P& r# y8 @! S; L6 l* e- module_param(acnt, int, S_IRUGO);
9 I$ d+ h% q$ D m6 O - module_param(bcnt, int, S_IRUGO);( M6 u/ R' t2 T( j: q3 X% `
- module_param(ccnt, int, S_IRUGO);
复制代码
% r+ W6 i7 X! A7 I5 o$ h
1 Q7 [ c- L, x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: Y+ y, ` v0 K% q' U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 {4 e g1 ~& I& o. p* K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ x- E; k/ G. M G+ [2 ~0 y) C
$ p) L! c8 S6 e. B/ }3 A' O' y* l9 u- n/ \0 t0 g# [2 v
|
|