|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 ]6 H" ^1 S& R3 e& P# F- [code]EDMA sample test application5 f ]& X0 c, G9 O& R- J9 b2 _/ g' `+ R( v
- /*- P4 h O! Z9 M7 ~
- * edma_test.c
% }8 c' u8 ]* H5 y0 H: J1 R5 _ - *
6 Q. u) p6 V6 }* D* p - * brief EDMA3 Test Application
9 ?6 `1 u( ]# ~ - *: _8 l, [! q" M# o+ `# u, X
- * This file contains EDMA3 Test code.
( i+ K( O: V) p* q: P - *
]5 B) k& w( J- P0 n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
y# k. H" m4 @% ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 e. g7 r% i2 {2 {8 i8 M0 I9 V% c% V
- * TO CHANGE.5 U. I8 o2 s1 @0 P0 S
- *
; e% v7 r- J; x7 \5 v. S9 e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ p" l" X- ~0 l, u - *" _2 N7 v0 B: A) u K
- * This program is free software; you can redistribute it and/or$ i" R2 t% C, i
- * modify it under the terms of the GNU General Public License as
* q1 I) l+ Y, k$ \ - * published by the Free Software Foundation version 2.
9 n, q4 x1 J$ D0 F: j# p - *, M4 U; e `( ~3 {' {6 H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( }: L7 ]! v' M: f
- * kind, whether express or implied; without even the implied warranty" O. `7 o4 Y. O. ~: N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% Q3 {" P% ^: u - * GNU General Public License for more details./ K0 ]* s J7 y! v% Q4 M3 L' v4 d
- */
: \. Z; b+ y, K5 ?
a: b( U1 L1 T6 K- #include <linux/module.h>, o; s# a" \ T- G2 t) j
- #include <linux/init.h>4 ]% t0 ]. F9 s2 A% O9 h
- #include <linux/errno.h># M3 c+ }5 k/ j& x8 ^) L
- #include <linux/types.h>% W0 N; P" @: r
- #include <linux/interrupt.h>; J4 I5 r0 z- @# Z
- #include <asm/io.h>: u+ h2 E8 ?4 @7 |( ~
- #include <linux/moduleparam.h>
3 P u2 H8 s9 j4 \, T2 B* j% n9 x; B - #include <linux/sysctl.h>5 {" J& z6 C8 b
- #include <linux/mm.h>3 v1 f3 K6 a8 M1 O% d% I
- #include <linux/dma-mapping.h>
+ p0 t9 S/ c* e1 `+ _
- b4 L6 s2 T6 ~, h$ ]2 T- #include <mach/memory.h>% `, I& t( ~# _* ]/ J# _$ R: p
- #include <mach/hardware.h>' c+ A, ~) P6 s$ K% b$ s! J
- #include <mach/irqs.h>
/ t& Y x' A# Y - #include <asm/hardware/edma.h>
) y: l: q0 {1 `7 B0 a+ G - ( x; m7 V/ X1 G
- #undef EDMA3_DEBUG
1 X9 V! N) C7 C8 _3 z - /*#define EDMA3_DEBUG*/6 V: s+ E( t$ e1 H) u; H: z
- # M) n; Q7 [+ R3 Q7 E6 u
- #ifdef EDMA3_DEBUG
* v8 Y3 j$ h# H8 W2 O# r7 q& k7 c2 ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); \* y9 K' O1 l# \( W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 S% J6 L% a' c" \; d2 o V1 A: |! q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 w, z1 |- _" c! n% _1 M" }) Y
- #else
0 |: H! |8 R" ~! `, b - #define DMA_PRINTK( x... )% ]- h* h8 W: F' Z- r1 I
- #define DMA_FN_IN
5 u$ E6 Z P: X& J- y" G) O - #define DMA_FN_OUT5 l* f: b4 [, j
- #endif
, g2 T" c7 q# u
4 T" `* z6 a( k# {. i- #define MAX_DMA_TRANSFER_IN_BYTES (32768). P: W2 w {2 |4 n% F7 ]0 {2 n* B) D; B
- #define STATIC_SHIFT 3
- I. _: T9 k4 O* Z0 b - #define TCINTEN_SHIFT 20
- D3 a# a U6 k; r6 [: r - #define ITCINTEN_SHIFT 218 f) `7 U1 ]4 P) r
- #define TCCHEN_SHIFT 22
# }% l5 j3 j$ y a: N# J - #define ITCCHEN_SHIFT 23
0 U: M6 v( L7 w& _" R$ t
+ P4 E! R& ^ u1 W- l: ^- static volatile int irqraised1 = 0;
. o) d" z6 M7 E6 N - static volatile int irqraised2 = 0;& B0 Y6 E( q& s' W; ]
- ' D* l1 W/ N7 N( x3 @- I! G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 X2 h" f+ B2 z9 Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% [3 C e9 m; h1 x7 R# n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" r7 o+ c2 ^9 B1 O& `* C - 8 W5 r$ i0 I# ~+ g
- dma_addr_t dmaphyssrc1 = 0;; M9 q1 a1 V1 l* K6 O3 ^
- dma_addr_t dmaphyssrc2 = 0;
9 V3 P# d* M9 ~9 T. @0 g6 \* |2 M - dma_addr_t dmaphysdest1 = 0;: }2 O, ]9 I# U ?( v4 t4 a
- dma_addr_t dmaphysdest2 = 0;
* j) x1 f" p, S; q5 w' F" R8 C - - a# z/ n' ~+ {1 G
- char *dmabufsrc1 = NULL;
1 L# J2 O3 h3 W" t7 m- J5 T - char *dmabufsrc2 = NULL;) T- p, G0 q& N- `
- char *dmabufdest1 = NULL;
I5 B R* N4 N: b - char *dmabufdest2 = NULL;
* Q+ j+ N. I! p) {# w& O$ s9 }
$ D; w+ a, B6 O, v8 l) ^6 V8 C, @" K- static int acnt = 512;1 H( N- ]( \1 C6 U Q9 J
- static int bcnt = 8;7 j4 C# O* y4 b: u$ F
- static int ccnt = 8;
3 @1 K& A0 G) b- V
7 G# }. F- B; \6 w. J6 d& p- ?- module_param(acnt, int, S_IRUGO);9 y6 L1 [/ k" ^4 x
- module_param(bcnt, int, S_IRUGO);
) ]9 |# D5 S7 W6 i - module_param(ccnt, int, S_IRUGO);
复制代码 9 @1 E0 r8 J# H$ O6 l1 s( | r9 A
0 b# W7 o: I# i7 E5 R& K) E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: S N4 \( N. ^3 N0 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" x2 h" G* x4 I' Q! { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 O8 C4 A! d5 a! P5 q3 l+ l5 d; X
+ e: i, e# z& ?' m) R. M. d, b. E
1 I5 I) {, K+ H5 C' [, D- R+ y |
|