|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; G: Y( d$ }( P0 J9 F# |+ m! Q6 B
- [code]EDMA sample test application
) B9 p$ w' ~# \! w# n0 [5 V - /*+ F& [& ]; R3 d2 U4 Y0 Q7 R$ G
- * edma_test.c
/ P, T' r6 b5 _5 l' U3 X! v - *
; a! h$ k1 b: X* g" G' z+ C - * brief EDMA3 Test Application
/ Q6 ^$ Y' l# ~) n! e7 O: D - *9 K7 K: C) j8 a
- * This file contains EDMA3 Test code.
9 n# C$ x4 v [2 Q - *# q% \# ^( j d" A5 k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% P3 ?1 \3 i. P) X h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 G: F6 h% W4 B9 s! R: Z; y9 l - * TO CHANGE.% A" P" g. y! T8 y
- *
3 V% k# f* K) t/ Z3 ?9 P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
]( V1 a5 j( ~6 t - *
) X) }% d" l X - * This program is free software; you can redistribute it and/or6 W$ I8 r: B( i" W7 R/ M6 u2 F
- * modify it under the terms of the GNU General Public License as1 h: g y+ O( O) @5 D8 N
- * published by the Free Software Foundation version 2., h2 D3 a9 W, [" q: l; u. j
- *
3 t) r! T" O5 f/ {) w3 N+ _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: n# ?/ q$ l: f4 g+ i. e - * kind, whether express or implied; without even the implied warranty
# T: X$ \/ }& d W0 b& s4 D, F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 h: A. l6 \: m3 u# k# P - * GNU General Public License for more details.
6 \; w8 ^" d& G- c7 `$ C$ i- J - */( U& p$ x) D$ O7 m9 R& F; G1 f
- 3 j$ U5 J% k9 ]9 s
- #include <linux/module.h>) R+ Z: b9 h. y8 R+ @( X" ]
- #include <linux/init.h>- B/ R+ Q7 q+ ~- S) x# n6 _
- #include <linux/errno.h>1 T d4 V5 M9 `8 w+ u
- #include <linux/types.h>4 c# n" L6 {+ j1 @0 e1 T
- #include <linux/interrupt.h>
% n$ _! \0 u$ ]( |1 T- h/ X - #include <asm/io.h>
/ w8 w5 i# ~. A3 W- [: H C - #include <linux/moduleparam.h>
2 j/ T* z2 d! Y) O - #include <linux/sysctl.h>
' k* N$ n, \& F7 |7 u3 S$ @; P - #include <linux/mm.h>1 H6 s0 ?2 X* m: w
- #include <linux/dma-mapping.h>
* w: w* X* ?* z) ~' e - 7 r5 l+ o2 k& z( k2 ^
- #include <mach/memory.h>! a0 n% o# N8 T v0 N
- #include <mach/hardware.h>
( F/ i' m* [9 A+ ] - #include <mach/irqs.h>
& u/ c k( x( I) A4 p+ W' O - #include <asm/hardware/edma.h>
6 E, E$ v5 t$ E, h$ T- K' j6 y
/ q8 O5 X; K9 Z, L9 T n- #undef EDMA3_DEBUG1 g, n; K! G6 h# _' k2 C& J
- /*#define EDMA3_DEBUG*/* i% Z& j4 G- X2 D: u7 E
- l! u9 ~0 R9 g7 N$ H
- #ifdef EDMA3_DEBUG
5 h+ {; B5 C/ ?6 F: s N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* t0 W& s" E* E3 Y" j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
]1 F {: l; _- k2 q! R6 ]$ { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ h1 X$ L. V9 S) c ^4 J+ }+ ]4 z6 o - #else& l2 f/ O; S, W/ W3 Q9 e
- #define DMA_PRINTK( x... )3 K1 T% n* _9 l( U- z3 `
- #define DMA_FN_IN
: F3 u: K3 N& C8 m( R: \( A - #define DMA_FN_OUT
) X3 K6 O7 m4 e8 @% R - #endif5 P8 n4 u5 b6 g& S, [) r
& }7 }3 c+ r5 z: h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* g( T% ?: D' x- e) U* s: z
- #define STATIC_SHIFT 3
/ C T( k+ N% ^- _- v - #define TCINTEN_SHIFT 20+ q9 f; [3 H8 K+ V; o1 f
- #define ITCINTEN_SHIFT 21
. g% x9 V- @% K - #define TCCHEN_SHIFT 22 Z* w; j! P0 k2 s3 A9 J
- #define ITCCHEN_SHIFT 23
$ g# B4 R: k1 D+ W! z - 3 V6 v2 f* C9 h7 o4 s
- static volatile int irqraised1 = 0;
8 Y( a( a: h' o6 @7 O- c" z - static volatile int irqraised2 = 0;
$ p1 W% M; l# X2 P
0 [, A6 Z+ E0 y( L: [' ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: B% I: A* C, }0 O. e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 x4 B- h4 x- y5 S; W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ^8 z: v* D* z9 I! J/ c
1 e/ D3 U( ]1 g2 A5 |- dma_addr_t dmaphyssrc1 = 0;$ C1 W5 z( A$ X( `- k$ A$ b& I
- dma_addr_t dmaphyssrc2 = 0;* w- k& ]8 q3 {; T
- dma_addr_t dmaphysdest1 = 0;
; u& \* }/ X6 r - dma_addr_t dmaphysdest2 = 0;' k* a; E2 J, E: @3 g7 |: d" J
5 K, l" w' B5 \ O! v' [9 y- char *dmabufsrc1 = NULL;
( Y/ j E, ~3 ~0 f - char *dmabufsrc2 = NULL;
8 ], w+ U5 P% H) q' L+ v* n - char *dmabufdest1 = NULL;; G5 [; x* H# R' J) g, J. M2 t' r9 L
- char *dmabufdest2 = NULL;
* E* i R% v" a! c" [& b0 B - 9 e0 z9 K3 X3 g: I) Q! s
- static int acnt = 512;; o% b: { h9 D! j; r9 f! n/ f r
- static int bcnt = 8;* L, k1 _) V5 H6 l% z9 }" D- X: [0 ~
- static int ccnt = 8;
: L" {% k* g0 F1 }! a - 3 X* f# L* v9 `2 i; |( }" P% d
- module_param(acnt, int, S_IRUGO);
& J- s; K- j) L& { - module_param(bcnt, int, S_IRUGO);. f) c+ y! |3 k
- module_param(ccnt, int, S_IRUGO);
复制代码
4 t7 e6 a* i' z |$ y/ \- ], z. o A4 \5 a% J" x$ g8 n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! y5 T) {0 N9 P/ barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! D' X0 L) w) J& X7 Z# w, H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ ]6 J% b& T9 ?( j2 D& Q
7 J! ~8 F( I$ i7 X8 @" Y. M# x; Y( f8 M
|
|