|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
i5 S U- H# ]) R1 L- [code]EDMA sample test application
4 p a1 M; L4 g3 N r2 Y - /*; g% N8 b+ N0 _. l
- * edma_test.c
3 P ]3 Q5 h8 c! }6 j6 d1 b- m - *8 ~1 t: l+ j. y: b
- * brief EDMA3 Test Application
- e; C3 F7 c3 V) Y* h) _4 n# f8 J - * t4 D- \6 s" z2 m( [- d
- * This file contains EDMA3 Test code.
+ J4 ~! C- R; s5 l - *
" v' P- }5 P6 m$ n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! G! L3 X! U, Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) z# i! w& O, j; M7 F - * TO CHANGE.! z5 [4 @) z: k ^5 g/ V
- *
4 M0 J: Y8 H" P7 g0 q3 T9 j# n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! `0 N9 v7 [% _. ^& ?( c - * { b3 Q. \: {# @; l3 a
- * This program is free software; you can redistribute it and/or
" f1 z7 G8 B: b* v# S9 v9 p - * modify it under the terms of the GNU General Public License as
# V+ E: F: z6 V* @/ y - * published by the Free Software Foundation version 2.9 B. S4 ?4 |) p% \ V
- *
+ l* ^" P9 z# |! q6 Q( c6 } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ M4 T9 ]; M# O w L3 P
- * kind, whether express or implied; without even the implied warranty9 F0 }- S) R G, o/ M) R( C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ `+ H( [3 Y% V - * GNU General Public License for more details.1 r, K( u% ?: p
- */) N% p `- x7 w- _6 b5 \+ D$ f4 I
- ( {$ ` ]5 ^; c, ^% }
- #include <linux/module.h>5 }% |3 U% C# o* }) v2 ~9 l
- #include <linux/init.h>
3 C; O- Z; O' Q/ }3 v* U$ d - #include <linux/errno.h>
0 l1 B' h/ J7 w% o8 x, V - #include <linux/types.h> f$ m7 U, m4 @3 Z9 X
- #include <linux/interrupt.h>) Y) `7 d/ ^ `# m! i
- #include <asm/io.h>& g8 P9 N [. t8 D3 M
- #include <linux/moduleparam.h>
( K7 d( w% d+ J4 H; V( a! T - #include <linux/sysctl.h>
! p, f4 l- {# A - #include <linux/mm.h>6 E/ g' P7 |" `0 V5 n1 t" H
- #include <linux/dma-mapping.h>
: X( S6 r1 p& v; T$ \' W - ' `. {8 _# v. k, J, X) O
- #include <mach/memory.h>3 T( y, E2 k- O' @: v/ S q
- #include <mach/hardware.h>- N2 Y' y. A1 @% [
- #include <mach/irqs.h>8 G9 H/ E; _ A
- #include <asm/hardware/edma.h>
) c( r7 m0 N% V' p, `$ l& a
# R2 v* p2 _: U1 K: V6 d) a/ x- #undef EDMA3_DEBUG. c$ U8 s, o9 F: P3 m
- /*#define EDMA3_DEBUG*/
0 K0 X$ V* L5 }* b& Q - & ?! Q) s- c: J& ^7 ~+ X; [) q1 b1 N
- #ifdef EDMA3_DEBUG" e- \4 f. O: n% j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" h1 J$ R' [ q7 s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! A/ Q; H+ ~; g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). s n3 S9 K F: s% p
- #else
3 `$ F4 W1 I# N% i$ r' l - #define DMA_PRINTK( x... )
) ~' |2 q# {2 y/ n! ~$ k - #define DMA_FN_IN" p0 d# ^( ^+ g8 Q3 B2 L
- #define DMA_FN_OUT
, m% \, S( O7 K- x) \ - #endif
& r9 e$ ^4 k- x( V, r. o# D7 h - 7 s) N+ | v1 w2 F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) @0 V5 g; X0 Z* j6 Q" k5 L p0 h4 ?
- #define STATIC_SHIFT 3
8 `) k7 j% D9 T5 D - #define TCINTEN_SHIFT 20
0 c8 G" [+ N' g$ o; y+ q. s - #define ITCINTEN_SHIFT 21' s5 A' x- g5 L. }* l
- #define TCCHEN_SHIFT 22
/ V7 B l( {" s; n5 N; d - #define ITCCHEN_SHIFT 23
; X) j0 X4 n w- l2 A6 K8 i - 4 {: {- z( ]$ H: K% W+ U4 w# m _
- static volatile int irqraised1 = 0;
2 |" k) u, ~( V# b2 u. S8 H - static volatile int irqraised2 = 0;6 z4 q* |, ]5 a% p4 S
- ; F9 ^. [8 D9 j- G9 ~" a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, S$ j- i/ _% h* D: K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ^9 a t7 W$ {8 `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! O7 \ {* e6 L: j; ~' ~4 Q/ F - ) h9 r% z7 |% D9 K' q' S
- dma_addr_t dmaphyssrc1 = 0;
/ ]( E9 N3 k( D/ G4 c6 I$ `4 W - dma_addr_t dmaphyssrc2 = 0;
" Y% D( w) M E5 V; I - dma_addr_t dmaphysdest1 = 0;
* I! q8 S8 b- N - dma_addr_t dmaphysdest2 = 0; \" e1 |7 j; \% [- F' S2 n
# U1 O" R7 Z+ j: _3 [+ @7 H, V- char *dmabufsrc1 = NULL;6 x# ]- R5 I; I. w: y$ e
- char *dmabufsrc2 = NULL;+ P4 G5 o7 f! U7 Z
- char *dmabufdest1 = NULL;
2 a" r) a/ l! j1 _5 }# W0 R: O - char *dmabufdest2 = NULL;0 m, A. }/ X- ^: [' t3 k+ C
- ' g+ p! b/ q) J) F& }
- static int acnt = 512;
7 Z) ]" R7 Y/ a* W - static int bcnt = 8;
) u$ n7 q# K4 j* y/ ?1 i - static int ccnt = 8;
2 Z& w' m" S k/ t2 e - 3 v/ A1 h( j+ P1 n4 n8 ^% H
- module_param(acnt, int, S_IRUGO);
6 b& y( K6 {3 @% o+ R - module_param(bcnt, int, S_IRUGO);
1 K( u. |' M* i+ _: x- U - module_param(ccnt, int, S_IRUGO);
复制代码 - }3 k' a3 t6 x! V# }: w9 Q/ i# b
% \8 f8 p0 s$ I: Y {$ W/ w% \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ ?* X# |! l6 S' garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' m) h& t6 w5 G _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" s: f/ B) N' B. {- O! p+ y1 U( y
; b0 A) f% x( I$ k, u# }. S& \/ n' b
|
|