|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. W j* I, a' |% x# K- [code]EDMA sample test application
6 Q! r4 d$ G( Q8 A: U - /*
) _1 z6 p5 R! P/ U: C - * edma_test.c
% z: }9 W9 z( s9 e. _ - *
+ W! D6 ~) ^' F - * brief EDMA3 Test Application. g2 Q! B7 H, a+ C- R
- *
8 Y+ u: N$ _7 \6 Q% q* i7 e @ - * This file contains EDMA3 Test code.
: {5 L) B$ f; ] - *
! U& w& \7 \% H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 G o. N8 O# z2 K" u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 ?) e c$ ]* I
- * TO CHANGE.+ B$ J5 [; a B
- *
& e' J7 D2 v% H! J$ V- E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 [5 Z) s2 w& ] - *: l* P8 S3 W, q- f
- * This program is free software; you can redistribute it and/or( r& o* h' K) T, `
- * modify it under the terms of the GNU General Public License as. S! R+ H0 e* p9 M, Y/ s
- * published by the Free Software Foundation version 2.
& D" Z8 j: C3 I, r; C - *$ r5 x! ^$ [9 s# \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% N3 u8 J" D% X2 q+ ?5 e3 j' m7 w
- * kind, whether express or implied; without even the implied warranty7 O) l, j. ?: z! s4 Y8 O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' G1 y, {& p' u' E; [( \8 b9 U - * GNU General Public License for more details.& g$ }. P1 T) q' F/ U( H
- */* | H0 \, B7 U# Q
' s' {& q) ]- F( @- #include <linux/module.h>' @7 M s7 f0 L# y
- #include <linux/init.h>
2 L- V; o/ K- h. Q! F* Y - #include <linux/errno.h>. N) i1 h2 g! U6 A4 I
- #include <linux/types.h>' K4 H/ U2 a. l( D! x
- #include <linux/interrupt.h>
: j6 ]4 A, K5 N& o/ G - #include <asm/io.h>' y9 U6 E; E# @/ N( c
- #include <linux/moduleparam.h>
& R7 b4 } f& M, s5 E# a/ { - #include <linux/sysctl.h>2 v0 D: T6 r8 I7 d! G
- #include <linux/mm.h>) F' Q' R3 y. I9 _ p* j
- #include <linux/dma-mapping.h>6 e% V# ?8 x% U$ w; h
3 v5 a9 T* n- e2 e+ e% Z- V- #include <mach/memory.h>
8 t% H3 X9 }7 f7 S$ Y; ~1 ?8 S5 l5 x - #include <mach/hardware.h>5 {# L& Z O$ A6 N) ^8 A
- #include <mach/irqs.h>
. t3 @- q) U; {' C9 _4 O5 H - #include <asm/hardware/edma.h>3 \) N/ A) z4 R5 z/ f
2 ^3 }! d q1 L1 [" b( M! h- #undef EDMA3_DEBUG% s) `1 ^- p- v" F6 g; g
- /*#define EDMA3_DEBUG*/4 s. D" K: L$ D6 T' R
- ) b2 L( Q- ~. [. p( H8 t
- #ifdef EDMA3_DEBUG
- ]& R8 l5 M$ ~' m$ G q, a% L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; ]& B* d. W# a2 j- o; Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 `3 ~/ o9 C; w2 X* w. H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): d' O2 C' l, v' I o
- #else" p( A2 g( Q/ n% @ c6 A7 u6 n# f! m
- #define DMA_PRINTK( x... )
1 L% O. K. E' h9 o4 Y4 p7 @4 } - #define DMA_FN_IN5 t7 O: O/ [, P, r, ?* S/ j: z+ j
- #define DMA_FN_OUT/ x- k) K" t7 Y2 i
- #endif5 v. E% E8 @# {% T
6 D+ v. Y! p- I( @/ x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ r! Z% |* k$ A; R. Z2 X2 N; z
- #define STATIC_SHIFT 3, X; x4 J( j4 n7 v
- #define TCINTEN_SHIFT 20
; b3 y. U3 j+ s' i Q - #define ITCINTEN_SHIFT 21& ~( g* P6 z5 v) g2 H- Y( V
- #define TCCHEN_SHIFT 22
# y9 }. V; e( K& q% s, @2 T4 T9 r - #define ITCCHEN_SHIFT 23/ H' {7 g. {' S1 L
8 X# u5 m r% {6 @- O- static volatile int irqraised1 = 0;
0 D7 i* r1 _# c0 [* B k - static volatile int irqraised2 = 0;- R4 n3 ^: r2 h0 `
- 1 b# h3 ~: z9 P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ^; X: q+ c8 g) @, O# ^6 |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 T/ H$ S# o; A! @& |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& R6 Q2 n( a# t' b" a$ e
- 1 ?, i* P5 o) V( [9 m/ L
- dma_addr_t dmaphyssrc1 = 0;, P4 ?1 |' b& g# m7 T3 t
- dma_addr_t dmaphyssrc2 = 0;5 w, o+ B4 _! A s+ W I7 L7 x
- dma_addr_t dmaphysdest1 = 0; b' n5 Z" T. t; X$ C& j- \
- dma_addr_t dmaphysdest2 = 0;
" |4 _# S, V% `: G" f& r- E+ g - 9 c$ |8 z9 @' P% o
- char *dmabufsrc1 = NULL;9 n9 v5 F6 b9 l" i6 H2 f5 E
- char *dmabufsrc2 = NULL;/ i3 k) H3 R7 r$ R
- char *dmabufdest1 = NULL;
, Q3 g6 m. Q# ?" U - char *dmabufdest2 = NULL;
& m4 t* i# Z( _- ?4 }- R, Q4 d7 u4 _ - : {& r7 V9 X$ x9 J/ G
- static int acnt = 512;
( D1 ?, m" u0 }4 t/ w3 n6 m8 H }$ w - static int bcnt = 8;! U" I- e# h; G/ s5 P! O
- static int ccnt = 8;9 H2 A& P# {6 ~! C! M
- # p6 N8 m7 L5 }2 c
- module_param(acnt, int, S_IRUGO);
' X, S/ r+ S& l- V; }5 s. N - module_param(bcnt, int, S_IRUGO);5 n3 T) ^% `4 y% z* P
- module_param(ccnt, int, S_IRUGO);
复制代码
; [$ d' q5 G. n5 x5 R0 h: a3 _2 j' j2 i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ u- v3 m/ I) L3 H" D8 R8 B8 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- Y) S; ?: o. W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 V2 m$ y5 j5 n( p
* \& |2 u9 E- d5 \
* s) ]/ s/ r. U* ] |
|