|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& K" `& u$ Z1 i4 @7 ~- _; m- [code]EDMA sample test application% }. L: [* j+ x& a
- /*
9 ]: ]9 Q$ V, |! N" j- y) ~2 L# j - * edma_test.c
" U. R9 n# Q3 }3 K - *
. |" K8 _1 ]: P+ u - * brief EDMA3 Test Application! x. t/ P2 J: D# J( [2 l; z
- *- o, o4 o d# i2 g
- * This file contains EDMA3 Test code.
$ ~' _' |, `0 A( P, k3 S - *
$ n8 _0 K5 ?* T% S; o# k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! h! n& K. G; @, A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 e8 C- h: o2 T {, P( T - * TO CHANGE.7 `; t7 I& O$ e& v1 \, J0 w
- *% @1 A. p1 } x+ c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ U2 \, Z$ H+ u+ p8 c - *7 [& ^+ v" Z5 C+ h* k1 S9 G
- * This program is free software; you can redistribute it and/or2 a' H% O: X. r! h# Y: P
- * modify it under the terms of the GNU General Public License as
+ p( [* H( Y* ^' u& { - * published by the Free Software Foundation version 2.; q( z2 l; l c" D* {3 V
- *4 o* V3 u6 B) k: J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 \& |2 o8 K3 ?: z: a1 t( Q
- * kind, whether express or implied; without even the implied warranty
# O7 Y% \' ~% g/ i% v" h; ?, Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 m1 K8 N0 ~1 D3 z5 t - * GNU General Public License for more details.
' A7 T- C0 O. H- R- N: E - */) D& G; n* x( \; b# }0 u8 Z
% X2 g+ G8 D7 o* g; Y- #include <linux/module.h>
; |7 D; W2 u5 a7 ?6 L - #include <linux/init.h>" k8 m/ A& |- P o0 c! f3 C7 \
- #include <linux/errno.h># q( t: M7 v0 u. x$ n
- #include <linux/types.h>
- m! l5 M: m# `( T+ t - #include <linux/interrupt.h>
0 ^$ F- U/ {# c) d# @9 \ - #include <asm/io.h>) v* b% T! Q$ J
- #include <linux/moduleparam.h>) f; i. D1 P9 i4 P8 a' `8 K
- #include <linux/sysctl.h>
( M5 x4 ]2 u% c - #include <linux/mm.h>% Z0 n4 t L- ^/ F
- #include <linux/dma-mapping.h>; ^' g l" L0 x4 M0 J
- $ I9 J0 X7 ^1 x
- #include <mach/memory.h>* [, E2 L9 X' o! z1 X8 i! l2 h
- #include <mach/hardware.h>9 d% ]+ y$ r. y# G* m* \ g/ }2 h
- #include <mach/irqs.h>
0 s: S; F- Z2 z$ ~ @, l6 m5 H! M - #include <asm/hardware/edma.h>7 z* y- u& Y) P5 }& o% S
+ [& C6 \4 u$ O2 I; B; n- #undef EDMA3_DEBUG
6 _3 {+ V* h$ g- T2 `( `: U - /*#define EDMA3_DEBUG*/
/ `6 g4 f# ^7 X - 5 m. ^3 e3 ]0 o. T4 S; o
- #ifdef EDMA3_DEBUG
* G& H% i. m- r" b5 E1 ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). s) o' Y( I+ L: y' v% \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( ^% X; L z. M' b* c0 A5 m! I8 D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 e- i8 A" G: G4 }5 |, v* r' E
- #else ?3 z b s* q E* [$ k# H: z
- #define DMA_PRINTK( x... )
' V- G! ?% y& I( U - #define DMA_FN_IN
. N* b0 C1 L6 H9 _ - #define DMA_FN_OUT
& s5 H I! h0 r5 K - #endif, x! n6 v- u0 L2 W5 d6 u2 W% F0 `
6 p8 f+ { y9 j1 G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, H" a3 O9 _4 p$ q - #define STATIC_SHIFT 3
4 `1 g- J y& B+ h& V - #define TCINTEN_SHIFT 20
% L( }/ h7 [. x: u0 F; f - #define ITCINTEN_SHIFT 21! n3 i- c+ }. Y J: Y# v- w
- #define TCCHEN_SHIFT 22
5 k6 @6 f3 L* u; n; X1 o& ? - #define ITCCHEN_SHIFT 23
- u( E' o3 W+ ~ B2 S - G' V' F6 p$ ^; d" v" H7 A# K6 R1 Z
- static volatile int irqraised1 = 0;
8 k, V- Y: N* p# _% p - static volatile int irqraised2 = 0;
: `# j' s, {8 Y" n, \) R6 J - , t$ _4 ~* x( v x1 K4 y) ]) n- w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" H; K& d0 o8 {9 }# h: Z: t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); l$ h$ ^6 A9 N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ k4 o' E/ a6 m0 Y- M" x
- / J/ r" g' C( m/ c S9 }! c
- dma_addr_t dmaphyssrc1 = 0;
J. V1 ^5 L4 H2 J( ~* e: U - dma_addr_t dmaphyssrc2 = 0;. v7 v8 k% Q2 g9 v6 ~4 i
- dma_addr_t dmaphysdest1 = 0;: l1 r) _! x* F. M m
- dma_addr_t dmaphysdest2 = 0;
# Z7 s, Q2 R& }# m/ P. ]
( W, W4 Q( {7 R2 }3 h s- char *dmabufsrc1 = NULL;; P" u, V6 P$ P( B3 P1 \; m, e
- char *dmabufsrc2 = NULL;- k& B0 U3 s+ U/ O5 F1 c& O
- char *dmabufdest1 = NULL;
( }1 a4 X6 ?/ U3 F- B - char *dmabufdest2 = NULL;
! S" c' K3 y% s - 7 a: p: b+ Q0 S7 r& r$ ?, o3 d5 h
- static int acnt = 512;3 \2 D4 B8 n9 u8 t. L$ v
- static int bcnt = 8;. W" ?6 ?2 y( p9 Z
- static int ccnt = 8;
' b1 u. V& E0 ~1 h. A; l \ - ) o; ^! L8 _( I& w% S
- module_param(acnt, int, S_IRUGO);$ B5 P0 z4 q; l- I# q! \; t
- module_param(bcnt, int, S_IRUGO);6 A, N& c+ ~% @; {% q
- module_param(ccnt, int, S_IRUGO);
复制代码 A0 I7 z' q9 q' D& S( a7 R
; [$ s7 l7 m/ b( }$ c% d5 H6 \8 ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# g7 n) V6 F( h0 c; _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 w- p1 T. I. C2 C& ]( W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) K# w# j a* z5 k% c$ o6 e: M
9 y8 l" F) q0 u$ [" Q$ b% N
7 G0 S* G" h) o2 x. I5 _
|
|