|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / x) B H5 O# C/ Y0 p
- [code]EDMA sample test application( C$ J) m& ^. a T" `4 d9 R
- /*
% o1 N2 S6 O$ V2 B* n - * edma_test.c( @. Z5 }. ^0 }# T+ g
- *$ Z& b5 M8 c) V6 [7 j
- * brief EDMA3 Test Application6 }- J3 D3 F3 i5 P% `& _9 o8 c
- *
) p; j5 P) [! u: Z! H, [ - * This file contains EDMA3 Test code.
" \1 d: [! ]! V( P* H - *
# |7 t1 a; v3 s# z$ l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# e. ?) s; l# W. @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! n" |# u8 k- l$ J# a M
- * TO CHANGE.; F% Z6 W: x$ R" Y
- *
: `' `3 }. Y: J* F& @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" r8 j$ K' n6 m [ - *: P% E; Y# H: [+ J* j1 ~- Y
- * This program is free software; you can redistribute it and/or( j- V" ]7 e8 \9 q4 C4 \
- * modify it under the terms of the GNU General Public License as8 c% f8 Z6 y0 A/ [- N# I9 ?9 g5 i
- * published by the Free Software Foundation version 2.
1 V. ]" ^8 S8 N" W( O( N: V - */ s7 W- o' o5 _# R# e* P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ U; r3 ?! ]3 N. ~ - * kind, whether express or implied; without even the implied warranty
! o* D" r( u0 Y; F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# g3 Q4 j. @7 t& K& X - * GNU General Public License for more details.8 j w) j, v7 z9 ^4 l
- */% M) r% ~+ P1 Z) v& y2 M
- ; t6 J) o1 A- s& B# S0 k# b
- #include <linux/module.h>
1 ]- X" P' \: x+ c. B1 M# V - #include <linux/init.h># H) B3 _. X2 \1 t- q: G% {
- #include <linux/errno.h>9 Q& r' \; Z8 b7 {9 Y0 h: }
- #include <linux/types.h>
% } N4 V- R4 A" n - #include <linux/interrupt.h>. T7 j; |7 g/ k9 A8 L$ J
- #include <asm/io.h>" q# _1 f) c; s; d( R
- #include <linux/moduleparam.h>
/ @5 U. p+ Y6 | - #include <linux/sysctl.h>" [) G, F G# z8 b, F( M/ s) [
- #include <linux/mm.h>; t, }& S* X6 A3 p# z$ _7 L
- #include <linux/dma-mapping.h>
2 E# d1 B {. E8 g, w& m - & } s v* i+ x
- #include <mach/memory.h>- u+ [& P* K3 ?; c$ k
- #include <mach/hardware.h>
F N; V( g" u6 f - #include <mach/irqs.h>
1 F* ?) L1 j) p3 u# Y - #include <asm/hardware/edma.h>: v) y1 M5 T3 g% b, ?% d
- 2 c |8 o9 E) h' D
- #undef EDMA3_DEBUG7 `) _; P) [. L6 \" ]9 k* S
- /*#define EDMA3_DEBUG*/
1 x/ v( s. _' o$ |
+ R$ I6 y% z2 D }1 t; @- #ifdef EDMA3_DEBUG
/ h' B! u0 O; Q- a; S7 T* z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 `/ A* t( _* V# K4 j% U* s9 \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 [! W# S: ]! B$ U1 E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ T8 e$ u- ]3 U) j
- #else
) P; q( f0 c; S7 w2 D6 @" F - #define DMA_PRINTK( x... )3 H! x* P2 F7 Q N4 j2 R
- #define DMA_FN_IN
?$ L! P) a0 }; W3 T, @ - #define DMA_FN_OUT
/ }1 f- n7 Y9 E - #endif4 F1 ~( |2 H5 |2 f2 x; D% ~9 e5 ^
. U- Z0 t* h! q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) [4 r" J. J) U' P$ \! {. C - #define STATIC_SHIFT 3
( q; u! z$ I5 i! N( ~ - #define TCINTEN_SHIFT 20
' j9 c; J4 |" }# {7 |! c, n" W1 |) B - #define ITCINTEN_SHIFT 21
; S; V, j$ c/ v7 O1 M, H: U% X2 { - #define TCCHEN_SHIFT 225 G9 @$ L/ H/ N+ r
- #define ITCCHEN_SHIFT 23
8 ]! E. @2 A: b) m2 a - 9 m+ d: {5 _9 Y( T1 o1 x* `4 M6 I
- static volatile int irqraised1 = 0;
, r- V- R8 G. c8 t- r1 e. C+ @2 Z - static volatile int irqraised2 = 0;, I' R( p d% `5 g- N
- 2 z8 g( S* B6 F$ ~, B3 T/ g0 f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 c) J' J2 r( h: w7 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- w j$ S; V2 g+ d: | F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ~' Y6 n7 L" {6 D$ c
- ' { M& t: r1 w- o4 l1 C$ x3 p5 @
- dma_addr_t dmaphyssrc1 = 0;
/ ~3 |7 G: M. r ~3 g% n: B& r. ` - dma_addr_t dmaphyssrc2 = 0;
& Y6 n" z- m. S% } - dma_addr_t dmaphysdest1 = 0;
' S# E4 f2 c( \, |- c/ P: L - dma_addr_t dmaphysdest2 = 0;
" y J8 E, O# T! t7 Y8 d
6 `& z/ b/ I- j" e- char *dmabufsrc1 = NULL;
; D( H$ X5 N/ y7 U - char *dmabufsrc2 = NULL;
% s: D( c$ n; W6 c- K - char *dmabufdest1 = NULL;0 U6 I8 F3 D8 D7 e
- char *dmabufdest2 = NULL;
. A* q5 h P' R8 K( h! N - 0 k; K; m0 z& E3 L
- static int acnt = 512;, K. d4 R/ G M! |" H( Z
- static int bcnt = 8;
+ C2 P7 X7 I4 W/ u _! d - static int ccnt = 8;7 r# m% R$ {9 N. ?, M6 W
/ {# g1 q4 J/ ]: C9 \2 I- module_param(acnt, int, S_IRUGO);
, A& Y& K) ^4 i: R2 S0 C( [ - module_param(bcnt, int, S_IRUGO);
' y1 o' O, p& g9 }+ v* Y - module_param(ccnt, int, S_IRUGO);
复制代码 5 _( E" F! U+ f0 M
* P- t6 a6 a$ y; U7 m# v0 q! x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) `- i- u* M- L% T* Zarm-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/ j+ _( Z D; X5 ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 D0 ?' b: o- y
% E9 b/ G( A0 Z# m" d, m6 q2 M
1 X- e" n+ ?1 l: y2 `: j! m
|
|