|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " B# h, J/ V2 Q) G# t
- [code]EDMA sample test application0 V* R/ {' S( [: V
- /*" u& z: J8 W6 r6 k% L! C; E, I+ H
- * edma_test.c* s& t' T. i: {7 r9 g5 r
- * \4 [- C4 u& P9 q. {" X* @
- * brief EDMA3 Test Application
4 c9 v; Z3 y' {1 f% n - *
, `$ ^2 R# S9 e8 v+ b; s - * This file contains EDMA3 Test code.1 G6 I. m- F7 H* n6 e: h0 X8 z
- *
, H9 R) U, U; D+ h/ S9 `# l( n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# A$ p: f# U, F6 D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 c; O* l$ f: {7 U$ Z. x7 b' _0 D - * TO CHANGE.
" j0 \5 M7 O0 P7 V9 ~3 b - *% @7 c7 r+ O, ]( i0 r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ z5 Z" e y, _; k% B - *
( w) @# a5 r- ~8 }; s - * This program is free software; you can redistribute it and/or
# G% Z9 M7 v5 L! G% T# P4 e - * modify it under the terms of the GNU General Public License as
. V# [% V: P( g* s: N/ O - * published by the Free Software Foundation version 2.
% b# J/ ^( _# l/ t1 r - *
3 X# N( ]: h, f: F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% G \* I: L" L- O5 s' R3 W2 I - * kind, whether express or implied; without even the implied warranty
- y% R$ ]; {' y4 a% B, L/ q' ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# s# j- `) b, o
- * GNU General Public License for more details.7 c) ?3 A# o" C; m: j' E* D0 O* j5 ?
- */. e: z7 @( U& I9 H
4 s3 j$ {9 Q, U4 r- #include <linux/module.h>3 l ?4 }. U, v! a1 O O9 L( T5 \
- #include <linux/init.h>
, T% p" N: w9 j - #include <linux/errno.h>
/ q4 S! d9 T8 i9 ^: M& d; }, f - #include <linux/types.h>
1 C' L% g# r4 j2 {7 u. U - #include <linux/interrupt.h>
[! \+ A7 \- \/ L) c0 Z2 q - #include <asm/io.h>
. \! k- R, p5 c - #include <linux/moduleparam.h>
4 ?8 q. j3 U" p7 V; T# U - #include <linux/sysctl.h>
1 p' I0 b2 ^% G5 z; c) [ - #include <linux/mm.h>
5 f, J3 P i; p3 T5 n - #include <linux/dma-mapping.h>
" {& C5 P. ]; C) Q2 r" w - 5 ]; t6 x7 b6 E* K1 _ X1 V b6 T
- #include <mach/memory.h>8 A, S7 Y* c) G4 n5 k, A/ J
- #include <mach/hardware.h>
; p& f8 D0 V7 \7 ~ - #include <mach/irqs.h>
" k: z* B( e' Q9 N# @$ ^3 W" T - #include <asm/hardware/edma.h>
% D% B9 \3 `1 t: o1 |
8 n% _% V& b2 L$ W* _( W" s& s- #undef EDMA3_DEBUG
$ [' U) z2 k0 Q7 e) R; M+ w - /*#define EDMA3_DEBUG*/% _( x! k7 b7 Q; j7 D9 }3 x
; d1 w( _( d4 W" p F; E3 T: e" Z- #ifdef EDMA3_DEBUG0 R$ i; q2 |% c+ @ X9 w9 P' ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 D) ~( T/ d8 w8 c2 c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% T9 Y1 t7 U) P) f1 w) Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), h0 A* |, [- F
- #else
/ _. e5 Y/ T3 R# k/ _2 P, {' e - #define DMA_PRINTK( x... )
* D& q5 t6 v, s2 I- H2 g' l - #define DMA_FN_IN4 p' t2 }' y1 O: @
- #define DMA_FN_OUT
: i6 g* J6 A+ }. Y( @ - #endif
, C2 I. i* l9 h" b - % ?; v1 c$ F. B6 g: G$ `1 x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' p% m- k! {" Q2 R5 C% `; t8 J
- #define STATIC_SHIFT 3
" ?4 ^8 C+ C; S% a& W - #define TCINTEN_SHIFT 20! w9 ^. M! z) P5 l( B
- #define ITCINTEN_SHIFT 21
9 i9 L1 d/ v: Z$ ^+ z - #define TCCHEN_SHIFT 222 Z) a3 f$ W9 h( y8 W5 s& T
- #define ITCCHEN_SHIFT 23% y2 q3 I' _# ~* D" k) Y! @$ F
1 k6 F z b# R8 I c- static volatile int irqraised1 = 0;
$ @$ a. J2 m4 u+ [+ _7 e; \/ A - static volatile int irqraised2 = 0;2 V& O, f4 A; h& E% R
: G S u4 p k) H# \( k1 j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
P' T( @* }' f ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, q4 O% G% H1 j4 C, B7 D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- d w8 A3 V3 l- T - 7 i7 Q% `. m) ~3 [% V% y. W
- dma_addr_t dmaphyssrc1 = 0;. W$ Q2 U' }+ h2 S' i& o: ?
- dma_addr_t dmaphyssrc2 = 0;( l9 E3 V; H4 O4 G
- dma_addr_t dmaphysdest1 = 0;' S9 ~, X8 R: T' }" K7 V
- dma_addr_t dmaphysdest2 = 0;" t" g5 s1 o$ N
- 5 E' ?) D: u* S" g l2 s
- char *dmabufsrc1 = NULL;
& w8 W4 c0 E5 c- x$ g/ \' J; \ - char *dmabufsrc2 = NULL;) t: M6 B! q$ p5 r9 L8 R) v
- char *dmabufdest1 = NULL;5 a/ K$ h' @5 x9 a7 H& {
- char *dmabufdest2 = NULL;
W" e9 ^& v4 S
3 W g: X0 x( O- static int acnt = 512;
. p' R7 s0 E1 {6 U, J8 @/ F - static int bcnt = 8;
4 z' E3 T. \, W6 ~! b* l6 H - static int ccnt = 8;) W: g. a: ?- ?, g9 p
- + p! i! I0 ?0 d, W( x: v" C# B" c
- module_param(acnt, int, S_IRUGO);4 F3 W9 { U* d3 ? z
- module_param(bcnt, int, S_IRUGO);4 l0 w* V& s4 r
- module_param(ccnt, int, S_IRUGO);
复制代码
) s8 }& f! {, Y& C7 Q9 `- O: i j3 M; I' Q+ W: j7 V. |* i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 m6 H& O) S* s! V5 @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 J: Q" b' E* L/ T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 `* L( k$ j9 F$ T! _
0 {* L* y; T4 L- i/ c. c. P3 P+ {7 x6 \. m5 I: U* u! M6 u* _
|
|