|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& g' N$ j8 a, {6 R1 ]7 y; N8 h- [code]EDMA sample test application. e. m1 O+ d( D* S
- /*0 T4 M: _ I0 T& L2 f# @
- * edma_test.c
# d7 \( j1 q4 V1 M" g9 m5 D. U. X - *: T$ a( m$ w! s# `5 n% ~
- * brief EDMA3 Test Application
* J' G( b' S8 o/ X" d - *5 V8 S U/ H% k* l# J0 w
- * This file contains EDMA3 Test code.
& ]8 P) ^8 p& k6 F: I3 W - *3 C0 q& t t9 A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. u$ @' |: j; c# y+ g \$ F6 ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* B! m0 S& D* h9 O! X - * TO CHANGE.
! f( o5 Y( C1 U. g - *( n+ _' U. p& [/ X8 K& o6 Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 a6 h* [5 J6 |; ~. c; ^1 }$ Y3 ^ - *4 @# K6 K+ e0 r* f+ `; Q
- * This program is free software; you can redistribute it and/or
3 r3 X" }: E6 `0 M \1 v7 n - * modify it under the terms of the GNU General Public License as+ V7 |- W' a0 }4 x- g# ^1 I
- * published by the Free Software Foundation version 2.0 O8 \: o. P8 q8 `# i+ d* O% @. q
- */ t2 y5 \- [& j1 i' K9 b* m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) v' p! \8 x* d - * kind, whether express or implied; without even the implied warranty8 }. Y, P- {( i, w4 y1 G5 Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' }4 ~' M( y; t3 X# b4 D! y
- * GNU General Public License for more details.
) R% [; g4 z D- c$ \ - */
, O1 C$ X g. T& F6 k9 }7 I8 b - 1 M$ l+ d$ ^4 ^4 H! C$ C& Y
- #include <linux/module.h>
0 T) Z. M* Y# o) ]# y, Q! T - #include <linux/init.h>
+ ?& ~) a* Z; w u, H* n5 r - #include <linux/errno.h>* Y* x& @8 }/ z) I) L8 `4 P
- #include <linux/types.h>4 O3 \8 x/ R: z4 \' f' r
- #include <linux/interrupt.h>2 Z* v2 ^) s8 l* u
- #include <asm/io.h>
3 {+ u( U* j2 R7 j: ~; l - #include <linux/moduleparam.h>) a$ B9 m {; N& J6 [# x8 u3 T3 E
- #include <linux/sysctl.h>+ V5 G+ O6 x$ P3 ?6 y) R+ O
- #include <linux/mm.h>
" V& W0 y( Z) I' M o; G$ ]9 y2 T - #include <linux/dma-mapping.h>) ?* d3 f3 D9 K' ] t* F
9 C4 a, i( y8 [/ C7 D( y% y- #include <mach/memory.h>
2 c3 g2 P9 f3 q4 _8 J8 M - #include <mach/hardware.h>3 e# K7 Z( d8 B2 R) }( K# V* m& Z9 z
- #include <mach/irqs.h>6 e4 {8 O, q% |' E) O _7 \4 J
- #include <asm/hardware/edma.h>
6 j+ f/ G4 j$ G& L
7 l! Y- e! Q; z, [9 h8 a, \- #undef EDMA3_DEBUG, [8 J/ h6 E1 G$ W {1 A, o
- /*#define EDMA3_DEBUG*/
8 q/ n( w/ u r3 G# D5 l6 \ - 2 B# T" ^: B$ H& r. R% w- N' ]- g
- #ifdef EDMA3_DEBUG/ W5 r1 \) m: f2 l$ ^5 j! k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! N) G" M7 {3 E8 |: p0 M W% l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 d3 S6 G1 q- W, M, Y n. B' m9 C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 q9 e9 \: m* F. p
- #else
. {- Q* @' z- @4 @1 y - #define DMA_PRINTK( x... )
: M3 s/ p) c1 Z' Z' ?; { - #define DMA_FN_IN
+ z) D$ P' \. U - #define DMA_FN_OUT
2 r* j% j/ T1 @ - #endif5 m9 M( q! c1 J7 K6 p: z8 }8 E
- & g/ P' ^8 {" {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 d+ j8 m! `7 c, i4 r3 E3 K" E# t - #define STATIC_SHIFT 30 H2 W w. V1 l) y6 a& [4 M
- #define TCINTEN_SHIFT 20* a0 k2 Q, S8 U! X
- #define ITCINTEN_SHIFT 21' w- f5 [2 P7 w) c" J/ i
- #define TCCHEN_SHIFT 22# i3 R8 O# b# T
- #define ITCCHEN_SHIFT 23. R) F; ~3 p6 c0 m/ B/ [2 t5 o
- 8 A- G2 h3 M# y) h+ v* X
- static volatile int irqraised1 = 0;1 O* d3 w* m2 i) s8 [
- static volatile int irqraised2 = 0;
7 a9 Q* h: y. i9 z/ { - " ~& {* V7 p) C! k; \& f7 t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 N+ y: {" x7 f% g3 c. J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* F! i h, w# j! T4 _0 H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); w- l" r+ q4 ^6 f" _) w& J2 V' B* o9 C
- & d! g: k6 r/ v0 ]1 ~7 ^- A* W6 |0 r0 s
- dma_addr_t dmaphyssrc1 = 0;
- Q8 E- ^, n" E& N% ]* k1 E - dma_addr_t dmaphyssrc2 = 0;" o. b: [9 |. f1 _
- dma_addr_t dmaphysdest1 = 0;
: H5 d: C Y! ~4 |+ |/ A/ e) c - dma_addr_t dmaphysdest2 = 0;
! l2 E- Y! @" }: U4 j5 [" `0 t
9 u( @) {: l) f3 l' [5 y- char *dmabufsrc1 = NULL;6 A% p( R2 R0 v3 f8 I7 T
- char *dmabufsrc2 = NULL; I* I$ B3 {4 I) d
- char *dmabufdest1 = NULL;
; w) B! H2 O7 R( L( R+ m Z$ P. q - char *dmabufdest2 = NULL;
, V% p7 M3 g- u& m* \/ O - 6 R( m9 Z6 }* H: W; B7 K8 @7 h$ \/ \
- static int acnt = 512;) F8 u9 E5 C, `/ P& G
- static int bcnt = 8;( h( {! u2 j9 o6 N1 E3 a, p
- static int ccnt = 8;
4 {/ H. C$ l6 \" |7 L
+ D$ G6 x$ i' F9 ?$ w W- module_param(acnt, int, S_IRUGO);
$ L; r/ E3 ~# r1 O) R - module_param(bcnt, int, S_IRUGO);
( L0 O* e1 z1 w/ g. F - module_param(ccnt, int, S_IRUGO);
复制代码
, K; B1 P4 b0 O* g. Y$ B5 f5 n8 e; J( A' |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 i5 n* S6 o( p3 f4 I2 p6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& K% D/ t' l* |: H, ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, m6 o& m& `8 a5 T) D! R# e5 O; N' g2 }) N
: M' c, M! r7 ?, q8 |; Y$ a |
|