|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& z; l/ b' A- h- [code]EDMA sample test application( a# h3 C9 I- {! s" u
- /*0 z' j+ W) g3 |: S
- * edma_test.c5 d; B9 w7 e# l# Q) O
- *
Q4 D4 L7 s! r7 p! `' Q - * brief EDMA3 Test Application0 D, k: q0 H+ H6 y8 n& ^
- *
3 _! P2 v, d, E6 O. g4 N - * This file contains EDMA3 Test code.( y2 M4 N" H7 g3 m$ m
- *& E6 _7 E) @6 l5 L5 Q0 M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 h# Q$ z& b& ?- U I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; u1 X. j& n8 m$ C# T/ O# |
- * TO CHANGE.
" c: F6 E3 |7 ^( _* E# W - *
" P6 J# z; C7 L! v3 @4 N: c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( R4 W! W2 @( G @% Q
- *4 `: L, I! V( S* e5 @
- * This program is free software; you can redistribute it and/or7 m5 _9 w" R1 I! \) h7 E
- * modify it under the terms of the GNU General Public License as9 t, l3 P2 d4 B
- * published by the Free Software Foundation version 2.
/ c8 j2 N7 c/ T* z( z# H5 K# f7 g - *' W1 {" k) s7 ?4 M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ a% r' p9 S) ^# }$ h. {7 y
- * kind, whether express or implied; without even the implied warranty
$ n' U% G2 j* ?. g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) W/ _: ]! w4 m' ?6 P; d - * GNU General Public License for more details.
/ @4 ]9 c. ^9 E$ [8 l2 @* @ - */
- F+ x' y. Y2 @- ?# O - 6 R3 O% Q+ x! {4 o
- #include <linux/module.h>
6 N N) a. \$ |2 C - #include <linux/init.h> n) d2 V6 x$ |# J0 G0 Z1 n$ E" u
- #include <linux/errno.h>3 r; b, \( B6 p! b4 F" e: X5 ]
- #include <linux/types.h>% c' z9 q- Y8 w2 z- d. [
- #include <linux/interrupt.h>2 V' {+ ~* n. g
- #include <asm/io.h>( m& m2 J* \* C5 W
- #include <linux/moduleparam.h>
5 ?% C( ]3 f- z+ \1 l - #include <linux/sysctl.h>
0 ~8 w1 j* I& \- _5 C+ {/ P% Y - #include <linux/mm.h>
$ c1 c8 {+ G4 P; t - #include <linux/dma-mapping.h>
2 A7 I! ~; k1 y, j! |1 ^ - 2 x) l9 x/ G V! D! H1 T+ U3 x3 f
- #include <mach/memory.h>
* t% p: y) N, A- @7 O - #include <mach/hardware.h>
' k+ o8 [* a6 Z. H" B0 g/ | i - #include <mach/irqs.h>' s9 R0 w6 O3 B8 g9 q, y' s
- #include <asm/hardware/edma.h>
7 Y$ v# M6 B) Z$ ?9 O# {
7 K6 B4 K' l% P+ @- #undef EDMA3_DEBUG
: h) ?0 V6 h) H3 Y/ V - /*#define EDMA3_DEBUG*/
1 F! w3 ^8 B9 G1 r+ q
* c w; |& @2 X/ i9 w- #ifdef EDMA3_DEBUG
7 m: }/ I/ p4 y; v) `2 j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- P ]7 Q' x Q8 J. \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* k3 N% p! K5 `3 E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 l. o- O4 Z$ k$ a% x! u. i- W& H
- #else5 |" V9 I3 X' S- P7 z" q
- #define DMA_PRINTK( x... )
9 Q8 G7 M! m$ W0 B9 T9 I4 B! E' x$ W - #define DMA_FN_IN
$ {8 d4 W5 U6 o# V - #define DMA_FN_OUT
6 `4 V0 X* [4 M$ ]- o' c - #endif8 r, j: F8 R1 O4 ]" o9 ]9 ^. K
- . A8 _- R& ^# R( C! X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ ~: {+ a2 m! M' g
- #define STATIC_SHIFT 3
2 D4 o8 d9 Z- l5 E5 d - #define TCINTEN_SHIFT 20
3 m! h1 f$ p$ E+ M - #define ITCINTEN_SHIFT 21
m8 N* b; f! x2 ^- p5 w8 f9 s7 k* l - #define TCCHEN_SHIFT 22
& W/ l& X; S+ n1 ~1 O - #define ITCCHEN_SHIFT 234 l$ R7 K0 y/ T; w4 W; r
3 x+ V2 ]& l5 t! F3 k) {+ w) }- static volatile int irqraised1 = 0;
) _% A, e) J$ v& y - static volatile int irqraised2 = 0;
+ r1 Y8 n, S1 T, e& ^ w3 `7 ?
% j* @/ h; E& k- Q; I. G) ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* Z% i3 A6 v- j I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" @4 F4 K2 Z W- f) y; i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ?+ V8 M6 |$ r4 l5 x
- , o8 O! j9 f4 ?
- dma_addr_t dmaphyssrc1 = 0;/ C. S; ~( m) H# c
- dma_addr_t dmaphyssrc2 = 0;0 z: x# z" x, h% D1 ]0 @4 p
- dma_addr_t dmaphysdest1 = 0;
) |/ y' X6 d! e. P7 U - dma_addr_t dmaphysdest2 = 0;7 B5 |& ?7 `# q; B% N$ d" O! P+ Z
- 4 I5 _9 Q' j$ x6 w: E G
- char *dmabufsrc1 = NULL;
: ?" f! t- P. j8 A. }$ ~- f0 ^ - char *dmabufsrc2 = NULL;
" u* k3 c8 n/ \( ], B - char *dmabufdest1 = NULL;
0 |6 n) O$ p/ h - char *dmabufdest2 = NULL;
/ e9 @: a" x+ z6 } - 1 b5 n7 @7 o* m) A+ d7 w
- static int acnt = 512;) Y9 w+ [2 [# V0 V2 w4 i2 e
- static int bcnt = 8;
/ i' s: {2 u" X- r. d0 S+ ?/ X: ]4 Q V - static int ccnt = 8;; J& J/ `& A: @ {9 I) ?3 \
! Z) j7 T$ C" ]% s. g3 |0 S) ]- module_param(acnt, int, S_IRUGO);7 p* w* O/ {8 g0 u
- module_param(bcnt, int, S_IRUGO);
! o6 ^3 N' Y% C' l M3 P - module_param(ccnt, int, S_IRUGO);
复制代码
, T! {: u; d" o2 ^& M! k2 B# V. N( `9 a. D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# k. b6 s0 X1 [" b" Parm-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 i2 ~) j: |1 \0 q& y' P: C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 k. g- H7 t8 _5 v6 o, _
$ j7 r2 Y* S( @0 v, F
0 ]9 Z% p2 S' @# V, D- { |
|