|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 Q( @# C3 I, Y, b# r! h, R
- [code]EDMA sample test application
$ E2 V6 ?; T6 y1 I - /*- i$ H8 u$ U1 l9 D4 H
- * edma_test.c
" u) w8 l: l1 K" s: W/ g& t% E4 a0 d - *5 g2 C b" f5 ~
- * brief EDMA3 Test Application3 Q* G- z7 X+ x2 j0 B( t
- *6 k. ]1 w0 Z# L5 F ~3 z2 k9 T; _2 y7 e
- * This file contains EDMA3 Test code.
( R% e- a U, z. n6 w0 V+ I0 g - *
( O) A: T& F) p- C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 Y% `6 U4 Q4 E b% E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, r2 f+ Y% t# X: ] - * TO CHANGE.
% X% I h9 y# s# L3 R! P - *
9 t- o. t+ I8 ^, b4 | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: k& h, p- j! O. ?. O
- *) ^& _- C7 F. v6 W, Y
- * This program is free software; you can redistribute it and/or
7 [8 z* y2 s- j3 J - * modify it under the terms of the GNU General Public License as6 D# r5 G) \9 t% z) L
- * published by the Free Software Foundation version 2.
# Q; S5 H0 M1 b+ ?8 J9 k - *. g1 f: \$ v9 m+ m& p+ q+ U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ Q& @* p: T2 n d9 H - * kind, whether express or implied; without even the implied warranty
4 ^4 @' K0 \) [$ e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ \ ~; s+ Q" t, c" }" ~; v
- * GNU General Public License for more details.) k$ B3 m! z2 t" y1 ~
- */; t( J7 w- v+ ?* \
- 8 {; h" l! G5 P
- #include <linux/module.h>
. T4 P7 p7 {9 t/ N" P - #include <linux/init.h>
1 \8 c1 {# v# h2 d' m - #include <linux/errno.h>4 S: o3 @, F4 {/ V; C% Y- j2 X% p
- #include <linux/types.h>
K( m& c9 L* O1 D& {3 U - #include <linux/interrupt.h>+ X! {8 g: K' n; z I8 \
- #include <asm/io.h>' o% W; @2 C1 }: n, N8 x! n0 q
- #include <linux/moduleparam.h>
0 Y. [' E4 F& G4 R, p - #include <linux/sysctl.h>
& m2 i) @ Z# Z4 [5 q! j0 Q - #include <linux/mm.h>+ n X7 @9 h7 }) L( k5 X
- #include <linux/dma-mapping.h>
: F9 E6 K( |. C7 u2 B
- Y* L/ @; S' D E: E `% y- #include <mach/memory.h>
) }) ~+ p. X" M - #include <mach/hardware.h>
1 N# X& T7 U* P& A. t% Y" w - #include <mach/irqs.h>
5 s6 {5 ^+ `8 v, c Z! A/ m4 O - #include <asm/hardware/edma.h>
- }8 _/ _7 S9 g; H9 `( A - # ^6 L! u8 ], d2 w K, f F
- #undef EDMA3_DEBUG
# _- b9 [. R( B# P6 e1 c0 ` - /*#define EDMA3_DEBUG*/4 _8 E- p4 @& i+ X- F
0 Y. B+ u, G' G! L9 o: p$ g9 H- #ifdef EDMA3_DEBUG
4 F% a6 [0 C' A! P$ y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); L; {; d9 O, x0 @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: \9 D* R; h9 e7 h- B3 {' k3 \/ Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( `) _* B' Q. v0 w' v
- #else1 n4 e7 f" t" k0 _. Y/ A7 b3 x; Z
- #define DMA_PRINTK( x... ). N& J4 q) ]( h/ m5 E- }
- #define DMA_FN_IN, C2 {/ m& a. D% c2 D! N
- #define DMA_FN_OUT
; D' }9 j5 f- ^& v$ X; G - #endif8 W8 j/ \% f5 {: M
! X, D5 @+ C$ q& k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 O/ f( L; l$ B - #define STATIC_SHIFT 3; {) ?; U' A, {& t& c
- #define TCINTEN_SHIFT 20
P0 H$ y6 K$ S( R - #define ITCINTEN_SHIFT 21
0 J* S, s8 X# _# Z - #define TCCHEN_SHIFT 22
4 V+ q7 b6 F4 \. P2 r) P - #define ITCCHEN_SHIFT 231 w( c3 t8 Z: n1 H: q7 \) \
- ; f- w5 p& ]4 Z/ U$ T7 G
- static volatile int irqraised1 = 0;' d g: w2 s. X! s" |
- static volatile int irqraised2 = 0;* g7 f D" k* a& a' F- H5 ?+ f
- " \; W% z _1 J4 ^& \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 }( F5 _9 C0 z. C/ d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* K" K: e) W2 k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% U( y9 D: V# v* A
5 } _6 _. x- \ m* s, p% T- dma_addr_t dmaphyssrc1 = 0;
% v3 A# N6 V7 G4 t' x% B% }. K$ Z - dma_addr_t dmaphyssrc2 = 0;) R# Z0 i; S" m% i1 X4 r
- dma_addr_t dmaphysdest1 = 0;7 c' s" v; z1 P
- dma_addr_t dmaphysdest2 = 0;
( x% k0 L7 ~7 G' h3 L' p1 Z8 c4 S
4 X' s: ~! K0 }' J2 g8 `$ Q, n- char *dmabufsrc1 = NULL;' ?9 ^0 [0 |6 X7 ?9 O
- char *dmabufsrc2 = NULL;
1 t9 K; V3 A( L1 K w7 h - char *dmabufdest1 = NULL;
( d& u4 F8 v, ]" T - char *dmabufdest2 = NULL;- p1 R5 [4 i, Y3 z K
/ h5 B( U4 y( l/ y" H8 M7 \- static int acnt = 512;- V* g T! `8 V# k# B
- static int bcnt = 8;
3 Z* T2 T/ C0 G- M$ Z - static int ccnt = 8;' e( J1 F3 N' T7 A
- , o% w" C7 V: E, W: a
- module_param(acnt, int, S_IRUGO);; r$ Q) l# S- j1 i' w$ r9 f* z; w
- module_param(bcnt, int, S_IRUGO);
5 R' S! F: c$ a) k - module_param(ccnt, int, S_IRUGO);
复制代码
6 s. K* U( t1 ~: {& T3 p# g) m) Y0 M, A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' O* b9 [- C9 S0 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. X) l5 X7 ~9 I) ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 ~& [, @7 r4 t8 ]7 e0 E8 B @1 B
/ s: H! ^6 A0 U% K4 V( V7 p% Q1 T% ?1 m# s7 U9 V: `
|
|