|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 ?2 D5 T. U$ h8 v1 N0 [
- [code]EDMA sample test application' y) q! B/ d8 d3 g- ~2 M$ V: c
- /*
, C; q6 a7 v/ I& ^ - * edma_test.c
T8 f& s) o8 F. Q/ K5 T5 U6 c( c - *
9 V% V o( X# n, p4 u% T0 Y; w - * brief EDMA3 Test Application: i, _! Y# U' _1 T& ^! M5 [
- *
, t, q, \8 N. M/ g; t; q. H' M8 ~9 \ - * This file contains EDMA3 Test code.
' u' i( ^% A& w H) o - *3 W' x7 \1 q( [1 q6 T0 `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# X, i; }6 D8 [ G* @ c. C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 x& @( P% N1 X1 h! x! b
- * TO CHANGE.( k- D8 G% s, u7 F. |( R# _
- *
' u7 L7 B; \' V- B3 ~/ Z% ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# n1 w2 o/ { Y8 ?0 n7 B8 j
- *
! X, }1 p4 U1 k$ S/ Z/ b" r. a - * This program is free software; you can redistribute it and/or. r% y6 \3 U# R
- * modify it under the terms of the GNU General Public License as5 Q) S$ [$ R$ V8 `5 L3 s
- * published by the Free Software Foundation version 2.! t/ _% T6 Q, \; k$ v
- *
: d5 `6 z3 H: ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 N H% G9 X0 y6 _ j3 [7 d+ a g
- * kind, whether express or implied; without even the implied warranty
" V+ K6 P* e5 o9 S0 t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 o. m2 m) I Z: i
- * GNU General Public License for more details.
0 U7 {3 j( f( y0 T - */
/ b- s3 N4 h: a
" C) b- M( P$ l2 @4 |. k0 g- #include <linux/module.h>
8 q, l; z3 X: _$ B' k# Q - #include <linux/init.h>+ }" I! f* Z N5 w
- #include <linux/errno.h> t* r P9 R# _6 g: f- l
- #include <linux/types.h>: a: ?# z6 M6 ?/ E$ |& S
- #include <linux/interrupt.h>
' V! {; D- u+ ` - #include <asm/io.h>
2 c, H* C- O4 N& Y' N - #include <linux/moduleparam.h>
2 |2 o; Q* q' P' D& m8 a - #include <linux/sysctl.h># d) I7 S l) I
- #include <linux/mm.h>
* T5 I% X! f2 t - #include <linux/dma-mapping.h>
: z/ s$ V. k0 t) ^ d
7 E, ~, g" J, [& Y- W- #include <mach/memory.h>
% F; M. J1 @4 X" Q - #include <mach/hardware.h>$ \2 r' h' f0 J7 a. b w# L
- #include <mach/irqs.h>: M+ ~% m5 }+ N, t1 ]3 V# N
- #include <asm/hardware/edma.h>
" ?3 d; g0 D- E. S& U$ _: I0 ]
7 l" I$ q/ |- u7 q) @% x- #undef EDMA3_DEBUG2 k7 h0 _$ f$ P5 W, c. L6 R
- /*#define EDMA3_DEBUG*/6 v4 O' P" m9 P* p1 @/ ?) k
# `8 \ X! e: z+ N- #ifdef EDMA3_DEBUG
( e6 _0 N* `3 y+ a+ k9 N: p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ d3 D% G& g! }+ B: u4 Z; c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 b) v( l+ [+ U7 d& i9 O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( N; [! {' L8 c f2 W! \
- #else+ j, b7 [) H, y( I1 G5 j
- #define DMA_PRINTK( x... )
y3 f9 f% w0 P$ I: x - #define DMA_FN_IN2 \- P/ R- C% L# A1 R, v/ J$ C
- #define DMA_FN_OUT
; v; E; N; Y6 u+ \! [! k - #endif
' p9 G J$ Z4 c2 I* N
7 y- ?3 {! r) i- N' t1 g& o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- z+ U( o7 Z/ O; U( X
- #define STATIC_SHIFT 3
% k a1 X4 g) n% { - #define TCINTEN_SHIFT 20 l8 E3 F/ `- r0 M% d
- #define ITCINTEN_SHIFT 21
8 E+ p! d4 G, X! P( I; u - #define TCCHEN_SHIFT 22
* k% G1 y8 U$ D# `5 Y - #define ITCCHEN_SHIFT 23
+ L2 W+ F% y7 v5 b - ; }4 P! u7 m4 a* q
- static volatile int irqraised1 = 0;# r# f4 N' a4 K/ Z- H- `7 M4 I1 c
- static volatile int irqraised2 = 0;
' @$ x7 G! T$ K ~
2 [! b6 Q( G6 V! P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& J2 F: {3 F4 r: |( C4 s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: e3 k/ i( G4 N* c/ ]( p: H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' i: ], l1 I1 R! f* ^' \
8 n1 _% f; T( n7 K3 L- m- dma_addr_t dmaphyssrc1 = 0;
; m$ \3 d8 ^( F0 F! b$ K9 L2 y( C - dma_addr_t dmaphyssrc2 = 0;
3 f8 R& g8 R; p+ n, a/ e - dma_addr_t dmaphysdest1 = 0;
( c7 a J, n6 n M0 m - dma_addr_t dmaphysdest2 = 0;
! Y% F1 s- g' Q: [
0 p( f; s$ L4 Q/ B- M* z- char *dmabufsrc1 = NULL;
2 W+ b& N) t5 t& c9 [ - char *dmabufsrc2 = NULL;5 C, | q2 K/ u0 M- I
- char *dmabufdest1 = NULL;
' B/ A+ i7 V; L8 ]1 i - char *dmabufdest2 = NULL;
; ^% U Z0 S' J3 c - 2 u' s) d3 }7 Y( K# K& T- p/ G+ [
- static int acnt = 512;# |' e: U8 x* F5 m- b1 n
- static int bcnt = 8;" P& d* Y' O% i! [
- static int ccnt = 8;
6 g# Y- Q# ]7 ~: N
1 r' d* {* x) A1 d; E- module_param(acnt, int, S_IRUGO);
8 Q7 o* q2 [4 F9 J0 g2 Z - module_param(bcnt, int, S_IRUGO);6 ?6 p3 n; y4 k* c, h, u2 w
- module_param(ccnt, int, S_IRUGO);
复制代码 , C' [' p: T2 @
8 c( z1 v2 w5 s; ~' S/ Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& K% W$ \4 F1 D& Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ V, k$ r% b/ b b- |. e6 _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 D+ E' D/ O: e5 ]2 J$ y3 J
+ u; e( {9 W7 {$ N" O F
9 _3 \4 q6 G! Y3 k, `# ]) q) u
|
|