|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , x! @3 j0 i+ e9 m
- [code]EDMA sample test application5 t2 \/ h. D5 ~. E; L' _7 M( A9 b
- /*
. E( @$ d- ]! I& @( v - * edma_test.c
8 y# U0 h5 v! e- a - *
7 }8 p4 C6 Q+ B1 |( K9 I, Q! f- k - * brief EDMA3 Test Application
" H- W( |+ Y! r- O4 _, N) U3 X - *
1 u5 a9 S+ ~& j$ N& v$ x k - * This file contains EDMA3 Test code.
& l) a3 I5 ?# U) P2 l7 Z5 c" o - *$ X) e( \* Q7 @0 x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 X4 q8 [7 A- y# n$ u% p/ N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: S, I5 D- z8 U" }6 @& r, B - * TO CHANGE.9 J' I2 e$ Z1 e/ x8 {
- *3 K: d2 O" u2 _' F! `/ V" D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 s1 Y u% T8 x+ c - *6 \0 J& a0 S+ m# q+ Q
- * This program is free software; you can redistribute it and/or
( w0 W w- B( B7 w* y; T( m* m - * modify it under the terms of the GNU General Public License as: l: z0 l& \) e* y$ _ o R7 n
- * published by the Free Software Foundation version 2.' M$ p8 `1 N6 b: _6 _
- *
. J, f2 M B( r1 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( z! i4 r4 F% z' w+ t5 m( V) \
- * kind, whether express or implied; without even the implied warranty
& R7 C; ?7 D1 t% \. N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' t; W9 _; H4 y6 _ - * GNU General Public License for more details.
, t9 F# p! S# S% {: U2 J: @) m! E - */
( C, w. r9 _# t, ^ - * t4 T+ _# L, R- `
- #include <linux/module.h>
: ~8 \" F* @* Q7 A1 G - #include <linux/init.h>
Z8 d0 I) a. A p5 | - #include <linux/errno.h>
6 f! V! T; c" ]- C" Z c; l7 c7 e - #include <linux/types.h>
& b7 Q X' h" `- m - #include <linux/interrupt.h>. @: i8 X j" }2 X! M
- #include <asm/io.h>$ V7 M5 M7 E# ?
- #include <linux/moduleparam.h>
. S* b j8 w! |& \1 K - #include <linux/sysctl.h># E+ E' [' z8 }/ I z7 ~
- #include <linux/mm.h>
4 c) p3 {' E7 y1 M - #include <linux/dma-mapping.h>, ^8 H; J% f3 ~# h1 i! b1 ?5 {, w
/ z. n |2 k" }$ E+ K+ D" S0 G5 l3 G- #include <mach/memory.h>6 e" [+ h8 v' N! i2 j+ a. x* h4 y
- #include <mach/hardware.h>
" [ A% f: n6 e! ~9 E: F - #include <mach/irqs.h>
# c- n* I' `3 I/ R - #include <asm/hardware/edma.h>4 r% d, o/ |' k- L8 Q, m; `
/ H( A% O* l2 q+ h- #undef EDMA3_DEBUG- ^+ N; V% ~/ f) e/ ?2 N
- /*#define EDMA3_DEBUG*/' z4 K% W' e, X4 y: g
- # D9 V, r3 J8 m% L/ G* f/ U
- #ifdef EDMA3_DEBUG. F0 ^6 `* w0 F3 P5 R& C8 M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 W0 ~' W4 c1 ~+ J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 a0 e7 V! @) m6 J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' x7 D7 P* [! s
- #else) g3 S& A2 e0 |
- #define DMA_PRINTK( x... )
1 q8 _, e/ @/ q: W0 D* F - #define DMA_FN_IN- [- p* r$ [3 v" N
- #define DMA_FN_OUT
* v+ S. T, D) v - #endif
! n* A, {- v5 m$ ]) w9 g+ b
, _, {) @+ }( T$ T. r( [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 Q/ x% B3 W' h% w1 y$ J& a Z - #define STATIC_SHIFT 3
/ v3 G" X6 [8 d. |& Q8 \ @ - #define TCINTEN_SHIFT 20
; y% d# H3 k E. `! o8 G$ L - #define ITCINTEN_SHIFT 21
- o' u- A% P; ?5 s - #define TCCHEN_SHIFT 22
. Q3 |' R8 H0 v3 W2 T4 c) J8 O - #define ITCCHEN_SHIFT 23/ b; p; E' s* |. N. ]
- 7 Q/ k# i; d% L( B8 D( P3 q
- static volatile int irqraised1 = 0;% Z+ H. {. }+ f/ ]- b, @* |
- static volatile int irqraised2 = 0;
/ w0 a; C/ K, a" t! L - . ]1 z5 N+ T& `4 G: s' E9 o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 v! @$ j$ m2 y& o" M" G8 g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 G- t4 k+ G4 m# {" {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 U) g! g/ M$ G* ]' D/ N
- / X8 I" k5 |2 v' M S, e- T
- dma_addr_t dmaphyssrc1 = 0;( v! j4 N8 T9 y) }) X5 f# H$ F
- dma_addr_t dmaphyssrc2 = 0;
7 V; S6 L5 o& H, H0 B# _/ F - dma_addr_t dmaphysdest1 = 0;3 B, I3 M3 f8 Y3 ^
- dma_addr_t dmaphysdest2 = 0;" ?% Q1 L* i2 b; A
+ d9 T3 Y7 J- ^8 X# L7 _- char *dmabufsrc1 = NULL;
& B$ S+ D0 q' y8 s - char *dmabufsrc2 = NULL;0 a9 \1 z8 x5 u! g) c, o, C
- char *dmabufdest1 = NULL;
+ |8 t7 w% s0 _& Z0 m6 X - char *dmabufdest2 = NULL;0 s! F3 s& Q2 j1 D4 C' M
% E+ E1 y+ u3 i8 Y- static int acnt = 512;+ N+ K8 c! E$ M8 \, u4 M2 Y$ Q
- static int bcnt = 8;8 `. U0 i8 m$ v+ v9 T
- static int ccnt = 8;
8 `9 J' E Z# W. u( U: c - & F- y; E% L( G5 b
- module_param(acnt, int, S_IRUGO);
/ y* S A8 [" @4 ^" T - module_param(bcnt, int, S_IRUGO);$ }" z& u5 X: s& [
- module_param(ccnt, int, S_IRUGO);
复制代码
" M4 n" F4 N8 j, d" p. g$ `) _- P; z# ^1 d( B! B( h0 _4 |1 y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 \( ^) I* U- B8 }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 ]' J0 o* W( [ O/ w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 R- m( H H; I8 |5 v6 a! L, @
6 \2 h' L9 w$ ?+ V3 w) D; u
5 u" b2 p$ M( f3 V( H |
|