|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# k4 X/ d& `5 d0 z0 Q# D; J3 `8 n5 y- [code]EDMA sample test application
% t' P1 L. u$ e* b - /*; b4 ?' w- `" Z# j3 {) w
- * edma_test.c
' B. V- O2 D; S1 g - *
! I# p8 j8 s9 w- o, r - * brief EDMA3 Test Application" y, i |$ T+ @9 R9 ?
- *
( t+ i( | {4 S2 P - * This file contains EDMA3 Test code.
4 n& K4 v, w( P' _0 \ - *, [1 `/ p) l/ i z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% m% H9 B& x* x8 w* G' D* `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ r- [. l! v. u5 r
- * TO CHANGE.
, D$ Q4 L. \; S+ c% D2 t - *
4 r$ x9 J5 C# C. d- S: A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* x _4 a; e1 j- _$ D- l
- *0 K% H; |( H2 k- L
- * This program is free software; you can redistribute it and/or
; M* a2 f1 V" r7 k - * modify it under the terms of the GNU General Public License as% P# |( r; p$ ?
- * published by the Free Software Foundation version 2.: d. I" J6 T# A. f! T3 |# _+ Q. _
- *0 ]: p8 V1 r5 n5 [7 I, N% @) k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 G) E6 W0 x* Z/ ` - * kind, whether express or implied; without even the implied warranty
* v3 k1 j2 I% V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 Z" X2 P+ [6 C8 a. M
- * GNU General Public License for more details.
. E; d/ M" n7 y# P - */' V6 f5 C, s5 L S
# Y3 Y- k4 b2 Z& c, g2 d6 O$ a- #include <linux/module.h>
: L6 Z7 i/ h& q: B/ J7 ` - #include <linux/init.h>
' }. t8 h. ~* Q& `6 q - #include <linux/errno.h>( G* f& X8 s7 C6 r0 X1 Z+ y
- #include <linux/types.h>- c. k. P% D5 S" E$ I. o- [$ y z$ ^5 e
- #include <linux/interrupt.h>% c" z5 E# t* x- D, ~( W' j
- #include <asm/io.h>
G4 [) a" b! x6 h7 r - #include <linux/moduleparam.h> N- G* P% Q; P$ y0 P' ?
- #include <linux/sysctl.h>
9 H( S+ Z2 @7 L7 L% ] - #include <linux/mm.h> `! U! z* B' p! [
- #include <linux/dma-mapping.h>
/ E L, J( F( g* P- M - Q( k$ t% ?0 n! y
- #include <mach/memory.h>6 P9 M1 k: U! p( c/ Q- n, g
- #include <mach/hardware.h>
7 X7 f S( W6 H+ ` - #include <mach/irqs.h>9 X7 W9 {0 n+ O
- #include <asm/hardware/edma.h>: g3 S R) [2 \ V( y
?( Y1 O6 S2 O2 i1 t9 H- #undef EDMA3_DEBUG
; k" U r; x6 J9 q3 S - /*#define EDMA3_DEBUG*/
9 ] c4 B# D; `- r+ z
" P+ L* Z; z5 |' K9 ~, A: i3 r& _- #ifdef EDMA3_DEBUG
1 G5 G: k# H; ]& q0 t. |7 l1 b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ G- S. z( i `7 j; B, R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 E; G& _$ `" ~9 c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ P- o7 X' n# z - #else& l* P2 k; X& c; ]& p9 I: b/ {
- #define DMA_PRINTK( x... )& w6 m( C/ `1 Z0 M5 } }4 g5 k
- #define DMA_FN_IN! _; p7 M+ D) f9 l; K' j
- #define DMA_FN_OUT- j& E7 l! {% R9 S5 C+ c& b
- #endif/ D7 Q: p0 v* }; G$ G4 H
- / j: r c' j1 S& I: N* v5 d1 P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): I8 E0 u E# X5 M; V% |
- #define STATIC_SHIFT 3
- i" q. p4 I4 } B5 M% n - #define TCINTEN_SHIFT 20
/ I3 F3 i) E/ Z( E( h: n+ U - #define ITCINTEN_SHIFT 21
$ N+ z# |4 p7 E# i# s - #define TCCHEN_SHIFT 228 [! H+ v3 W& O Y5 n* m
- #define ITCCHEN_SHIFT 23, U O: ?' e( M; G
- 3 M# p$ u! g9 I* H9 ^3 H
- static volatile int irqraised1 = 0;2 k: | A$ M* g! U/ [8 e) c Q
- static volatile int irqraised2 = 0;
+ @* w: D- H5 d - 5 B5 x; B/ F5 l/ @/ _2 r9 ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, }6 Q; B/ X/ G) f' z2 k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 p q1 V& n. G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 ~8 H: }: ^" e- R( I6 _; x9 R
- 0 G% S& V2 }( Q6 J+ `* q A% c
- dma_addr_t dmaphyssrc1 = 0;
$ U2 j0 T7 h: E0 }- m0 @ - dma_addr_t dmaphyssrc2 = 0;4 O5 E# }/ o2 i/ E
- dma_addr_t dmaphysdest1 = 0;
$ {2 o0 |/ ]+ P V' c, F - dma_addr_t dmaphysdest2 = 0;: g5 D1 d" i4 T8 k
- 6 Y$ q3 Q& u4 t* V
- char *dmabufsrc1 = NULL;
6 j9 l& c+ M: s% x- N1 M, y - char *dmabufsrc2 = NULL;5 @/ s7 }7 s" ?$ I& U A3 p0 B9 Z2 M
- char *dmabufdest1 = NULL;
/ _! P- C4 f8 X - char *dmabufdest2 = NULL;" D! u% R0 C9 }) ~- m7 `" \0 @8 u
; P5 c2 Y' O1 P+ \ Z- static int acnt = 512;1 K! m6 T+ d3 Z! W
- static int bcnt = 8;( @$ ?6 t$ l+ w7 O6 t* e
- static int ccnt = 8;
) P- ^ q% C+ [- R - ( c6 p' y1 _9 Z% R1 s
- module_param(acnt, int, S_IRUGO);
2 ]6 [/ ~" b; G+ \) \. u0 ^* D( k, n - module_param(bcnt, int, S_IRUGO);+ |( ^ B+ O+ J: V' d$ W
- module_param(ccnt, int, S_IRUGO);
复制代码 $ ]: F H1 r, J i) }& g! C
! O6 }$ n4 @. s6 F" s4 I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- u* O# ]5 f9 J( Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 Q. u1 b' T& M, N. ~8 M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 c3 V# k& B( v1 f, E4 w( m
) Q: ?8 H) C& { I% l# i
1 f6 ~: d3 H! b' B. _ ?' d
|
|