|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" ~5 I$ t' _( n" ], C# }- [code]EDMA sample test application, P& B5 ^6 M( q/ f6 W' ?. {5 i
- /*
; E3 b. U- m! f$ A: i0 P - * edma_test.c
5 R7 p' ~3 I) f1 u3 G' Z - *
( _) s" v! L D; d0 x7 { - * brief EDMA3 Test Application; L4 \* A, e$ O
- *
8 G9 l: d H; N1 ` - * This file contains EDMA3 Test code.1 U- w, ~; P( g) `2 V o1 @
- */ L$ _: U8 [' a1 U9 A3 l7 S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 A. p& W H o7 { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 H* U/ }9 t6 W- ]5 r, L
- * TO CHANGE.
4 [$ F) u6 |/ O5 a. B - *
! r( R3 W% B- k, f$ t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' X8 h/ p+ e6 ]9 B! m5 J) {6 q3 c
- *+ C, Z* g* g0 k
- * This program is free software; you can redistribute it and/or e r8 q, ?; J d- a. @. ?) C8 d
- * modify it under the terms of the GNU General Public License as
: a+ o0 i/ {7 J" X. k - * published by the Free Software Foundation version 2.
0 N. o% I \2 B: ~+ h - *! \6 T; N; R2 S7 ~# n) ] B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, d( z- l0 O4 F. X U - * kind, whether express or implied; without even the implied warranty
9 J' }) ^+ s9 U" B6 i! \- `" ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' n5 I9 \- N+ p6 c
- * GNU General Public License for more details.* _. p4 l& ]( v2 ]) S2 K
- */
4 a: b' @* i7 N. d# s
- S# b: z2 X2 h* s4 m. Z- #include <linux/module.h>, j, P, S% f# E: s" c; } p
- #include <linux/init.h>
3 b3 |* [. i; ]0 u3 L9 D% q - #include <linux/errno.h>
. t: B( @3 d, H- | x - #include <linux/types.h>
: A) Z, v) n; [' @; ~4 s: X* d - #include <linux/interrupt.h>$ E/ ]1 f' |4 a, K( _2 p6 X. B
- #include <asm/io.h>
1 m" `0 n0 P1 m) K; z# y - #include <linux/moduleparam.h>1 J' ]* q p( I+ v
- #include <linux/sysctl.h>
' Q# Q/ D: @6 p) t/ F7 ` - #include <linux/mm.h>
$ c& j, S/ [ a6 H% I0 V - #include <linux/dma-mapping.h>
: G) P. { ]+ y4 @
1 n3 E9 K; O y5 [( T6 l% l- #include <mach/memory.h>- B2 A+ F* E& u. u# R+ V, t& a7 h
- #include <mach/hardware.h>! @# @5 \# [( _) H
- #include <mach/irqs.h>
& n) ?9 g* I2 e - #include <asm/hardware/edma.h>
4 O0 r) Z: q2 I, g; c E; S1 D
4 E, i7 u/ ^5 h2 A- #undef EDMA3_DEBUG/ Z5 X" i0 x3 M0 W0 A
- /*#define EDMA3_DEBUG*/
5 @0 u3 u; D L' ^0 m( O5 R" S - ]5 j' h( B6 M: O) K
- #ifdef EDMA3_DEBUG( d- a9 R& g% r+ x6 ^1 U5 U& _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 h. v$ g" _# @$ V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ I! I1 i- }2 t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 x; | o6 e' d - #else; t' J. A2 }) T$ M/ {6 P
- #define DMA_PRINTK( x... )3 |- t* r9 X7 L# _" `. G4 A' l
- #define DMA_FN_IN/ k2 w% T, Q$ F" H- C9 U' l; b0 |
- #define DMA_FN_OUT
/ T+ ^ G% F" m - #endif
, e8 } G3 Q1 Q! p
: `! M- E8 w: e. N: O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 n7 E5 J# L7 N8 c, \
- #define STATIC_SHIFT 3
/ T! O8 V$ s) O2 h - #define TCINTEN_SHIFT 201 x6 K$ f- r, n
- #define ITCINTEN_SHIFT 21- N# p7 g% S0 B* a: p; Z3 @
- #define TCCHEN_SHIFT 22
$ _. T, G6 M: _' I5 z/ n8 r - #define ITCCHEN_SHIFT 23% V+ Q+ l: d& r
4 o% D% Z% C) x _4 B0 i) ^- static volatile int irqraised1 = 0;$ f" i- _9 n; d+ i( Y/ j6 i
- static volatile int irqraised2 = 0;6 \5 F5 p" s# ]# d
- & {( T% I; `% d4 _9 G/ @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 c6 |1 `9 W: ]2 n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% L) g: |" _ v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 T O- b% M) E% x& ?$ Q
: v0 O% N( V- X7 d" W- dma_addr_t dmaphyssrc1 = 0;
. i( N; B5 O/ S( N - dma_addr_t dmaphyssrc2 = 0;: @0 r% l# {1 T! Q# ^; U
- dma_addr_t dmaphysdest1 = 0;* @2 R1 Z8 u D1 m
- dma_addr_t dmaphysdest2 = 0;6 ~' x- s1 E6 x4 o1 A2 n" P9 W- i
- 1 W" j+ m+ c% f5 A/ u
- char *dmabufsrc1 = NULL;
+ b2 e0 C" X [# q7 S: _& o - char *dmabufsrc2 = NULL;5 i' C& w* ]5 [7 ?
- char *dmabufdest1 = NULL;1 h( ~' w5 ]. j: f! A+ p! \& @/ n+ U
- char *dmabufdest2 = NULL;. w, M- Z* b. R# p* w$ X2 m, y
3 C8 o0 s8 N" T( k* \8 U- static int acnt = 512;; s1 Q$ m' u6 {4 L) R4 N
- static int bcnt = 8;
' C; N, L O f' j; K- G - static int ccnt = 8;
2 M- A7 U/ A- d2 g/ f; k/ h - . b8 F7 Z1 B& J$ d9 y
- module_param(acnt, int, S_IRUGO);
3 Q) t0 ~1 O/ u, Z - module_param(bcnt, int, S_IRUGO);# K/ |2 m0 |) F/ K
- module_param(ccnt, int, S_IRUGO);
复制代码
3 e1 ~% ]9 @5 Z+ g3 Q; I
9 e# R$ s& m0 g$ j6 d6 | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% M6 I/ A( K2 b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& p }+ V# t: j6 Z: e* q1 w* F) p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! n% }. @* p! g. |, ^
# F0 H5 A8 S7 Z. u |6 B6 M4 {6 i4 i7 ?3 j/ x/ x
|
|