|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& x; i z' L) U. r& E- [code]EDMA sample test application6 x6 M1 \, {, p9 n9 b6 |
- /*1 _/ s# X4 r& ]3 v0 P0 T
- * edma_test.c& Q' t5 I5 I4 V: o5 h+ y; p
- *
) {. k1 c7 m% n. ` - * brief EDMA3 Test Application
8 ]! ~+ q; Q2 K - *
: k% H# H+ d- Y S8 ~ - * This file contains EDMA3 Test code.
3 _9 H U* }$ z - *
; |# c/ q. T1 @% _$ v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) a& o( @1 q* t4 h# Z* `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! |, D% U, h6 j' J4 ^ - * TO CHANGE.
L* O4 l9 `% M+ a) J) c# C6 Y - *4 X y2 c+ _! ^' V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 S+ x& K2 Y7 w7 q$ b$ H - *4 Z8 P' r( o6 |2 u! r- R3 W
- * This program is free software; you can redistribute it and/or
% y. k- l4 I5 h8 A1 P - * modify it under the terms of the GNU General Public License as; Q8 Y# J3 ?" I6 U
- * published by the Free Software Foundation version 2.
4 P& v* \$ |% k! }* n+ x! E - *
% s; Y3 Y5 D3 Y: H& A* i( w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 p1 M5 h- i+ V. H* d0 }
- * kind, whether express or implied; without even the implied warranty
* ~) L( x/ ?/ c+ O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 H2 Y' E7 }9 o G$ F2 O( z$ g5 w
- * GNU General Public License for more details.0 l2 P1 X3 C# i
- */
. K# h) r Q, ]" g# I - , ?# K- z; |3 z) }+ k
- #include <linux/module.h>* Q2 z% ]$ |7 }
- #include <linux/init.h>
5 v5 T( W) \2 q; h - #include <linux/errno.h>
) U0 \" E2 ?6 H! h2 Z - #include <linux/types.h>
3 U; R% d% L& ^, e1 K& C - #include <linux/interrupt.h>
- ?& g; \. u3 a$ p - #include <asm/io.h>
4 V1 Y: v' T; w% R; |9 [ - #include <linux/moduleparam.h>, z( J- v# w. P+ j
- #include <linux/sysctl.h>) l3 V& a$ A6 ]2 ^1 `% D( q9 m
- #include <linux/mm.h>
" c4 s9 A3 Q9 u6 z( s6 M( X - #include <linux/dma-mapping.h>3 x( j% M% s3 u4 \9 S
! i/ I& U" |0 z1 z# P2 \& @* p- #include <mach/memory.h>/ B4 f0 ?4 `6 v$ }+ `9 ?
- #include <mach/hardware.h>! j- A ^' b; ]! ]9 N
- #include <mach/irqs.h>" x( h; b4 I, p5 F4 Z
- #include <asm/hardware/edma.h>
' G' {' v. J& K
7 l8 Q1 o; X# |& T q/ I. S2 e- #undef EDMA3_DEBUG U: z3 \* S H5 w$ O
- /*#define EDMA3_DEBUG*/
' Z8 [! J/ d" Q: q' F' x+ Q* p
% T! I$ s+ k c' }, l- u% [1 [0 e- #ifdef EDMA3_DEBUG+ y4 E/ ^3 R1 ]% t3 t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ i2 _4 h" c3 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 \; p8 C9 f1 `- K- b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 C( i. n7 d* ?5 Q* S
- #else
! z# f, f& @- D2 M, [ - #define DMA_PRINTK( x... )
) A: i7 g ?! G - #define DMA_FN_IN( R. d4 |9 `4 f1 `* V
- #define DMA_FN_OUT
: H7 D( j6 W' O3 ^2 S7 O - #endif
: a0 x& c# s! X3 R* m- A. u8 z
% P/ N, j+ b; q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 i# y, C2 ?& H" [3 K! g; V4 t - #define STATIC_SHIFT 3
" @% Y- Z; K9 V1 o: H - #define TCINTEN_SHIFT 202 H1 B: T, X* o7 N. O4 ?
- #define ITCINTEN_SHIFT 21 s% a7 ^; p- s3 f' u+ E" ^
- #define TCCHEN_SHIFT 22
, H; c: S. X @: x( b L: u - #define ITCCHEN_SHIFT 23
% B3 B J! x# ^. g4 P# R6 a! B, A
0 d9 U; o4 k7 f1 O- static volatile int irqraised1 = 0;
( j) ?- e1 d( [+ m. Q9 c6 Y# G - static volatile int irqraised2 = 0;
. Q! b" Z7 l$ l5 ^3 i" ^4 C( U/ f - 1 m( b) ]" q0 R6 |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: ?3 ? R8 k: F' {$ G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* i8 b3 L( `' k5 x0 Z: g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) r# k7 Q! ?" c1 r
- 0 {' g r$ t8 d% B
- dma_addr_t dmaphyssrc1 = 0;
9 o4 {# G8 X ~8 t/ b- c- a' F( t - dma_addr_t dmaphyssrc2 = 0;% o9 ~2 f/ X* Q, E q, b
- dma_addr_t dmaphysdest1 = 0;; |! a, l; Z& O$ {9 m, v* d
- dma_addr_t dmaphysdest2 = 0;# D$ A& q. I1 H2 r b
0 A {" p; Z: Q( B- char *dmabufsrc1 = NULL;
s" i; K l4 `" _3 ], f - char *dmabufsrc2 = NULL;- P0 S _' O6 t
- char *dmabufdest1 = NULL;
* O1 P$ H5 ? I) ^ - char *dmabufdest2 = NULL;$ e9 j8 M; r$ z. G
+ q+ k& a F! a' M. c! ?- static int acnt = 512;# H3 R, s9 Z; @5 { U! Q, F* Q
- static int bcnt = 8;" I/ w* ~2 g( R3 n
- static int ccnt = 8;( J! a9 U6 A8 [2 U* O' g% R
- 3 J |% L" s/ @& p6 G( X
- module_param(acnt, int, S_IRUGO);
3 k! _) k' R- m- \9 Z - module_param(bcnt, int, S_IRUGO);! R8 ~7 D/ m! a
- module_param(ccnt, int, S_IRUGO);
复制代码 4 A' O8 V' i" T' i% D3 S
: V" I/ ~4 B! R4 h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- t3 v( M) |/ e% A
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; r1 L2 e% m( U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* n3 ?+ t+ B% u/ {/ O! j
9 W9 N2 O) c3 F5 _0 g. p2 K4 M8 J7 Z. _
|
|