|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ?& B8 s% n2 q9 q! T1 V3 y
- [code]EDMA sample test application8 J; Z- z$ O* i- E% V
- /** Z- R! a5 e2 S( c
- * edma_test.c
6 T! w1 M6 t) W4 y, }" l - *
( V9 h- H8 W" V1 n6 f+ p5 [8 a - * brief EDMA3 Test Application
7 n' B/ i7 l. Y3 d& G; S$ ^ - *
0 e; _9 U( ?: d - * This file contains EDMA3 Test code./ }$ U' {& O9 i
- * Z( n# U" L n% T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( |/ V( H/ ~ [* g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) m. s& d+ C/ |! d) ? - * TO CHANGE.. z6 P* @1 C1 g- ~( ~" Y, }0 L. w+ v0 k
- *! w) ^( H; X8 g6 q, K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, i4 {- l2 L" J' z% [# T8 J: c - *
4 f' U# X; |, M6 U - * This program is free software; you can redistribute it and/or/ Q5 e9 K/ J3 t# S
- * modify it under the terms of the GNU General Public License as5 A: c9 p" R- m8 k! v
- * published by the Free Software Foundation version 2.
+ h0 j. `6 L7 W) \! G: o3 V* l - *
( U1 A A/ ^. N9 J4 A0 I8 F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
H7 o1 G8 z3 Q1 H" ^5 g/ q0 G - * kind, whether express or implied; without even the implied warranty8 L: \9 b9 ^( s4 s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 u5 _$ m1 Q" d. [1 d, F5 s - * GNU General Public License for more details.( `7 d: ]! ]8 Y$ y1 ~3 m4 c7 B
- */5 k. a7 Y% W) C( J* f" p; x
7 w, `. @0 I- Q) n3 Z% Y- #include <linux/module.h>
3 ^! E9 @% h6 x! W8 C2 t0 v2 Q! x - #include <linux/init.h>
# I/ A" K4 B5 K5 f9 w5 r - #include <linux/errno.h>
L' F2 B6 ~% l) z - #include <linux/types.h>
- v) ], P- n: o' K9 K; S - #include <linux/interrupt.h>0 h# e+ g$ P! a4 t9 N
- #include <asm/io.h>3 u& h# x$ m& j; ^9 H" S
- #include <linux/moduleparam.h>
& @" j$ R; [2 I! \: [8 f - #include <linux/sysctl.h>
, P) ?' t+ \3 @ - #include <linux/mm.h>, c& H; ?$ P5 D" j0 w) e
- #include <linux/dma-mapping.h>4 G9 C" V7 h7 W! e/ q ?! t
- $ Y/ X* g. Q$ P( z
- #include <mach/memory.h>
1 B, [2 N& o+ E - #include <mach/hardware.h>
% e* z; ~7 M, Y9 b- b2 v5 G+ N# U - #include <mach/irqs.h>
k+ ~# [& K- @/ I& @! Y - #include <asm/hardware/edma.h>% Q4 u' |: d9 J/ I$ E6 w# ]) r% ~
- 4 T6 R, u) o' ?. w
- #undef EDMA3_DEBUG( P7 B1 f8 x9 }2 U) B5 _
- /*#define EDMA3_DEBUG*/
+ i, _, A7 [' z2 f
: w" Q' _+ O0 I; z$ q. P- #ifdef EDMA3_DEBUG
9 A3 C5 m/ S5 y, V" t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 i: i/ s3 X: ~6 y( e9 a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. d- q4 G$ A( ?4 f' j. `2 C. U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 I9 l1 i. m! @+ W( u( J - #else
7 o; u9 ~( _- O: S& v - #define DMA_PRINTK( x... ) l) u! I8 I ^- Y
- #define DMA_FN_IN
: L: H. T3 V- @/ W( G9 l: V - #define DMA_FN_OUT. j! W! r, b; [4 u
- #endif
$ U, y* Q6 j/ g" ]4 U6 | - ' {+ R) ]# G" V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ N8 A, [6 z( H - #define STATIC_SHIFT 3: o& f, L* J7 b2 Z5 J" F
- #define TCINTEN_SHIFT 206 x7 m1 e+ \9 q4 a& w* g! I
- #define ITCINTEN_SHIFT 21
+ W/ m( f/ z3 i Q, m5 x - #define TCCHEN_SHIFT 22/ T+ A5 B9 _% ^0 R6 _6 {5 i0 ]# x
- #define ITCCHEN_SHIFT 23: N, _$ @% P3 s: ?+ b& g/ X
+ {* C# X) M5 N! E4 D- static volatile int irqraised1 = 0;3 v9 |. e3 C% b7 E5 Q
- static volatile int irqraised2 = 0;
) }% o2 i' @! G$ W) ] - " F% X0 G1 @8 Y* p4 P$ \0 j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 J) H) C: i" {% h0 @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ n% J* n( `( b8 M+ H# D# f. `9 ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 r! o! ~' G @9 [
/ ], E2 ]: X* ]- dma_addr_t dmaphyssrc1 = 0;. A2 u3 f8 c0 [* X* ?
- dma_addr_t dmaphyssrc2 = 0;
7 K" Q" R: e- q% L" d+ T - dma_addr_t dmaphysdest1 = 0;) r! s# c. |1 H. L8 P0 Q
- dma_addr_t dmaphysdest2 = 0;
5 p3 s" v4 v' o8 s1 }! l2 T9 e
" F; y, d9 n6 ]- char *dmabufsrc1 = NULL;, m9 E+ P, C& B! f9 z0 c
- char *dmabufsrc2 = NULL;0 L- [9 v3 G! ]# n5 x9 U
- char *dmabufdest1 = NULL;
" o) l0 x# D& |; O1 T - char *dmabufdest2 = NULL;% }0 O0 b# S; `' c4 i
- C" n# C4 T" v- {' }: ~
- static int acnt = 512;% u8 b K- Y8 z( y" R) H; M5 f! U B7 s
- static int bcnt = 8;
% q- X9 U2 y4 j. W/ t8 j- I - static int ccnt = 8;; }1 \2 J# C9 h+ B d
- + M+ V' l4 A0 J
- module_param(acnt, int, S_IRUGO);' h, N5 j3 b) X0 C
- module_param(bcnt, int, S_IRUGO);- \7 Y, Z$ S; s7 W
- module_param(ccnt, int, S_IRUGO);
复制代码 9 E& |& c. ~( H0 {* b) h; w }: Q
( v* X' E5 a$ Q6 a/ H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! e7 A2 m+ J5 T3 q: y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( r/ O: q+ z4 c! q @4 R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' n) g! i) d% O% g9 B: a/ Q1 E/ P+ y# M
' c* Z- ~# e# Z8 U& V# ]7 I
|
|