|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % o; E h' w6 F" ^% w
- [code]EDMA sample test application7 t5 u; T/ B. C0 |4 z* h6 ~- Q+ F
- /*
: }, A- r$ o: M( j4 p3 @5 J( }! U - * edma_test.c
' }' j6 d+ e; Q# z; ? [ - *
: U. s' u% h0 L0 m' z2 n1 l - * brief EDMA3 Test Application
2 _; a! S$ ]0 t S - *
8 B. |. ?2 P: _9 N u# c - * This file contains EDMA3 Test code.
* Z8 ~& B" A* o, i8 ]$ t - *7 q' T0 G3 ?$ M1 d. A( v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- c1 P; _ ^! r2 ? K/ e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( \3 D; O& j* l+ ]+ d; G
- * TO CHANGE.
4 l) S0 ]$ \# z" D" _! ^+ @7 w - *8 g; `3 K" B6 Y$ o$ a% w1 @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& a! w# e1 i( T) C! c - *
1 W M, p+ T: |9 R4 }. D7 }9 [ - * This program is free software; you can redistribute it and/or) D8 A: f0 P5 g) d, i( C0 r
- * modify it under the terms of the GNU General Public License as
4 m# J/ o; x ^( q E9 r5 b& O+ S - * published by the Free Software Foundation version 2./ S3 u" b. R% q/ D$ m5 M# H' ~
- *+ c Q X9 S: N4 f/ k* \2 ^8 F; `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
L- ^9 C. r5 t+ ^7 _2 G" ~ - * kind, whether express or implied; without even the implied warranty9 _) q8 j1 C9 ^6 ?$ ?: m9 m# }. H6 z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 g& _) `# ?2 p% {$ _3 a* _, r
- * GNU General Public License for more details.
- _/ H7 C- ]+ U O* h - */5 J5 y, A' p7 _* e7 R4 n5 v- W
9 Y0 A( _# w- [9 |- c- j3 z' ~- #include <linux/module.h>/ h" O3 ?) |+ S9 W1 b6 b
- #include <linux/init.h>
7 E# }6 A2 D& m9 i/ m2 Q1 l5 a - #include <linux/errno.h>
$ T" x# @* t7 L* \! Z) a! D( L - #include <linux/types.h>
' G: P. R+ T# V$ @ - #include <linux/interrupt.h>
2 M; Q$ w4 r7 Y8 |3 x S - #include <asm/io.h>* s" M, }) j- m, ?
- #include <linux/moduleparam.h>, s7 ]/ G# d% s+ t* p9 o/ B
- #include <linux/sysctl.h>
$ D0 Q; \& a) _1 v$ C - #include <linux/mm.h>8 j: a! q. A8 C
- #include <linux/dma-mapping.h>% [- ^" j2 z% y! s3 g0 |- J2 _
- 0 G9 g, `, l! T3 P1 F8 r
- #include <mach/memory.h>& z% F. ^# h! i( v5 E, i: Z2 `
- #include <mach/hardware.h>
( |, t7 g- d K' X4 q, ~* w1 i - #include <mach/irqs.h>
J) p4 _* n, T5 x - #include <asm/hardware/edma.h>: {7 `# C+ e0 i" L$ P
- + H8 m8 A; C6 Z5 @
- #undef EDMA3_DEBUG
2 C8 {, |) |3 x0 g - /*#define EDMA3_DEBUG*/
: H& q0 p* _. C7 u# g
# B8 J, [ m& Q, S8 P/ {5 y7 o- #ifdef EDMA3_DEBUG" B( D- q! j( g! @" G8 u+ y. V- F, v- ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: ?, H7 v5 H3 C; x: M6 X% G/ a) T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- U, t- u6 c6 F9 t5 r* z+ g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 t C: d# ]3 ?/ U; ^ - #else) x/ s% h- c! V: z
- #define DMA_PRINTK( x... )
2 B7 k8 `1 V4 s: N/ W, z - #define DMA_FN_IN
6 ^: d3 B' ?$ @/ H0 A" O: S" T - #define DMA_FN_OUT
( _* y! r& P2 J& i( C5 N: x: @ - #endif3 m2 \; s, J8 z: ~
# g* s, @$ x: s& c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 C y* G' m1 n8 i6 T1 q, i - #define STATIC_SHIFT 33 l1 y5 w& d9 a g; _: J* i
- #define TCINTEN_SHIFT 20
* ]8 ?1 C( i* n$ R' e; A: I* m6 j/ o - #define ITCINTEN_SHIFT 21
+ a( F! ?8 z0 N# N - #define TCCHEN_SHIFT 222 X0 k: z4 k4 ^2 S4 h( o% ?0 m
- #define ITCCHEN_SHIFT 23
0 ?, z/ J2 j) X; L6 V
$ j, f( S7 L; M# H2 G- E) L- static volatile int irqraised1 = 0;
4 E2 G, v. `3 {; F - static volatile int irqraised2 = 0;
1 m; a i2 K) {; C9 q- w! e
' W( g, ]/ L2 y$ d5 v3 L, s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
]- ?6 W% z$ S$ W/ F: X" [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ a9 A: m$ c% ]. a. a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ^9 {! ]& G+ c i; ?# c" H3 u
4 F3 X, x$ R1 w p3 l/ U$ v- dma_addr_t dmaphyssrc1 = 0;* r) ?- P( L) O# @
- dma_addr_t dmaphyssrc2 = 0;
- m. h" U% C9 W - dma_addr_t dmaphysdest1 = 0;
: Z" M7 f- b6 B+ `: c1 {; M6 B - dma_addr_t dmaphysdest2 = 0;
/ B0 V4 v. m9 Z: A* N3 h3 S - 6 w6 _4 p# B& q
- char *dmabufsrc1 = NULL;
; z( ^, \+ o* ^ - char *dmabufsrc2 = NULL;7 C2 D1 x! p' u# Z8 S
- char *dmabufdest1 = NULL;
7 d7 _; E( e$ [! w/ ~: y( ^# k - char *dmabufdest2 = NULL;. L$ x; V4 m4 y6 [4 {1 j3 M
- 8 h. J6 |9 k/ y+ F/ w
- static int acnt = 512;
+ Z& {2 N& G" O3 A4 P! {7 Q" l - static int bcnt = 8;) T# r+ t# w4 Q5 M. q
- static int ccnt = 8;& n9 j5 d }- a. M% {
, D/ n. V0 b: Z- ^ I i8 O8 A- module_param(acnt, int, S_IRUGO);4 q- X9 h( T9 v$ Y* ~
- module_param(bcnt, int, S_IRUGO);3 z Z: t) H- I. J1 e6 h
- module_param(ccnt, int, S_IRUGO);
复制代码 2 _! ?" R$ q( y4 X v7 {9 t
2 W2 s' u% d' e7 p( P3 D0 L1 F; M. H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( J8 G: l" |* T4 p- O+ N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 Y' c" v c" r3 q6 e% F$ O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 S& e; @0 F% D! y0 p, _. z3 p a4 f
: w9 D. n* r# N0 v9 ~, _
|
|