|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ A6 n1 X/ g0 R
- [code]EDMA sample test application
, e! _/ L; ]* b - /*
0 k: i5 P) M4 U d: H - * edma_test.c' l/ h9 m. c; C1 V- j9 O& Y7 e
- *
`0 |7 r- K. h. _& `0 x: r$ g - * brief EDMA3 Test Application
0 l3 s" z* p) U. S - *- j8 | l d7 C7 g$ l
- * This file contains EDMA3 Test code.9 H7 n5 x& e1 H) b6 y' f3 K' h' d
- *
) a' E" O6 f' Y! b' \) ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 q/ ^0 M0 T1 c8 n' E8 T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) n2 k: S" |" m, Z# A - * TO CHANGE.' w1 }! y" H, M6 l. r9 u- C4 J* O
- *
' R7 J- |( ?/ \, ]( q7 { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; n# g* x1 W+ H- E6 K+ w! S2 p - *( ]& f0 Q' K4 D8 g
- * This program is free software; you can redistribute it and/or7 [ w6 Q3 _' Y) R1 ]: c
- * modify it under the terms of the GNU General Public License as' g4 h* H' Y' m5 j" | F- W7 C# S
- * published by the Free Software Foundation version 2.
) I! k" ]* V) b0 l2 R/ U7 U' K - *6 H( t+ x n8 P6 s1 A# |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 X2 j$ R+ @: a9 _/ z; m1 B+ t8 H - * kind, whether express or implied; without even the implied warranty4 h" X0 B3 V: X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the j; z6 \4 p8 w8 p
- * GNU General Public License for more details.. P2 ~0 W! u7 Y" a
- */8 Q7 j" h2 M1 M
# [9 J6 S& U, e; l2 v- #include <linux/module.h># c) o" \7 E) G( j6 c" v" [
- #include <linux/init.h>" o* A" t; ^6 C: O, [
- #include <linux/errno.h>
2 x& R& M% Z5 o8 t - #include <linux/types.h>
# e, |# X, Y G5 Y - #include <linux/interrupt.h>5 W: U6 B) X& P1 p' |
- #include <asm/io.h>4 _+ C2 ?- c0 k7 ?* Z# A
- #include <linux/moduleparam.h>0 }1 r0 h5 y* i: s9 S
- #include <linux/sysctl.h>! n* q( K1 C8 ~
- #include <linux/mm.h>, N2 L/ {6 ^8 t1 l
- #include <linux/dma-mapping.h>
+ f0 u9 f0 b! g, [9 @ - & q h" b q" K& u4 v. b4 X
- #include <mach/memory.h>$ R: a) W6 q" K- m/ K
- #include <mach/hardware.h>
3 h( c* X1 R r4 p- ~+ d+ ? - #include <mach/irqs.h>* E/ ^' d8 W. B; L7 O
- #include <asm/hardware/edma.h>7 T8 E/ ]: ]: D3 f$ J9 J5 U+ O, v$ N5 |
- 3 D; Q9 B$ ~ g3 ^( A. a% E
- #undef EDMA3_DEBUG+ I9 w. {: @% B# o( ]
- /*#define EDMA3_DEBUG*/
2 |6 a$ N* [9 r3 ^5 ~
! e$ m% P+ V! A, s- q6 V( R- #ifdef EDMA3_DEBUG
9 j5 Z# p+ l& B( I- E1 o" B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ V7 A1 ~: g! b: M: Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 k2 ?+ A& i( a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, ?/ R% Y! r O; z% x8 E - #else
4 `, r9 K5 A* g. g - #define DMA_PRINTK( x... )
3 A6 W( M2 g- A) j T6 J3 w5 ` - #define DMA_FN_IN
6 s }$ D* [) O# z - #define DMA_FN_OUT' W# a: O7 a2 h, \5 _' x" p0 g9 W+ s
- #endif
' g& {/ w' C& v+ p - 5 \& \. N9 A2 V0 b# b$ b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 I; r5 S( M' G% T. W
- #define STATIC_SHIFT 3
- ^7 i0 i1 n, B4 e! y8 [ - #define TCINTEN_SHIFT 20
8 s0 v" p1 `* V! K0 \- O; X - #define ITCINTEN_SHIFT 21
3 X# L0 x9 q4 g3 s. ? H - #define TCCHEN_SHIFT 22# i, E& i }6 V. v- u
- #define ITCCHEN_SHIFT 23$ I; e; q- b$ S9 X a9 M( s% `- g7 P
+ b# Z; R( R Y9 F( v4 m- static volatile int irqraised1 = 0;
/ t8 z o& g0 i& c( x - static volatile int irqraised2 = 0;0 T' z3 N) H6 a
- ( s; y" M; a3 C8 u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. C( y; y0 Q: ^! Q: ^1 o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- e' w) L6 N& i; G% U" O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 c5 u; N4 `! {, s( Z1 ]7 y
- K$ j# _. V, |( d4 g. J- dma_addr_t dmaphyssrc1 = 0;& G/ p# K1 }: u; N6 u# ^7 Q
- dma_addr_t dmaphyssrc2 = 0;9 n. n5 [! G% p7 N* q/ y- W9 [ t+ t
- dma_addr_t dmaphysdest1 = 0;$ G( D, T6 e$ j2 k3 M/ y" x
- dma_addr_t dmaphysdest2 = 0;
, s& S, _3 L7 L( U" a& f8 T - ( o3 U) M# Y9 m7 c# a& j) F
- char *dmabufsrc1 = NULL;; H+ f* g1 U; j$ { E
- char *dmabufsrc2 = NULL;" G' G8 I+ s" t! ~$ C6 @8 _, y
- char *dmabufdest1 = NULL;
3 v8 g9 z+ D. `# D/ d" [9 a/ j2 @ - char *dmabufdest2 = NULL;* H6 O1 g% c5 _
9 G; I% d' C$ |* Z# J- static int acnt = 512;$ s1 F! `' {3 P" ~
- static int bcnt = 8;3 _8 _+ x4 S( _2 h V4 s- p7 M
- static int ccnt = 8;8 F3 R3 Y2 D( _6 h, I
- 8 w* g# n, f2 a( l2 o# N
- module_param(acnt, int, S_IRUGO);5 u( Q: v" P& T
- module_param(bcnt, int, S_IRUGO);4 I6 K( L: ]. L& J1 ~* r) d
- module_param(ccnt, int, S_IRUGO);
复制代码
. R. i) \0 R! d9 W7 _0 Q6 ?8 N( E* L, G7 h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ v/ N" S% h" x; C/ d+ {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 w5 t' p9 K8 P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 N; @* u3 N9 v- Y6 i
7 l. k8 I5 o& A
1 [2 A) L: H8 N+ d( t |
|