|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 Q3 t, g4 a/ `9 g- Z! s
- [code]EDMA sample test application/ Q; m- U/ H1 r& U3 ?
- /*
( F! ]0 \1 K& a8 y* P; z - * edma_test.c
* y S# T" R' S) z) s8 b - *) t, l @5 Y5 V( ]
- * brief EDMA3 Test Application. B# x9 }0 }# |; R3 M$ w0 S
- *
" ^2 Z4 z6 S8 U! H1 Y' L - * This file contains EDMA3 Test code.5 _+ z% A* c; @/ x
- *
! Y2 L/ N. U# V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) ]& q3 `- o2 r ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ V7 T2 t) S% u3 O9 ?3 E$ {
- * TO CHANGE.! a: e/ F( A; ^$ ^' q
- *! U6 Z- h7 a6 Y1 }) v8 T) p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
q* k7 G9 T/ r& t9 F8 c* A - *
, v, S C. Q: v, H5 \ - * This program is free software; you can redistribute it and/or" T8 l- R R; h1 o& o/ c+ r4 M) u/ X
- * modify it under the terms of the GNU General Public License as. H5 s8 C( q! B! W/ E; y: x
- * published by the Free Software Foundation version 2.4 y$ R- {/ P" o2 e
- *: _2 K" C3 C4 x0 L2 n: w$ B# V% J; K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- g; b. ?2 h# ]. w2 h1 z5 E - * kind, whether express or implied; without even the implied warranty& E/ G5 s0 n: x7 B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ y" V w/ x" {9 z - * GNU General Public License for more details.
Q7 @0 |$ x! p `% q8 w( ^3 e - */
3 M+ ]" @. G% A6 Q; Z - 7 K' ?3 F: [9 V
- #include <linux/module.h>
" g, ] m# f6 a3 x: u+ H- @0 m - #include <linux/init.h>
9 L' W( u/ O; w2 |- c - #include <linux/errno.h>/ h k1 m; [7 Q9 W5 C+ `
- #include <linux/types.h>4 h5 S/ k' ~' ]
- #include <linux/interrupt.h>" K8 K \' ^/ b) U Z
- #include <asm/io.h>8 n) n! H+ l3 Y- f
- #include <linux/moduleparam.h>! W. A! j; L8 N0 R# ]8 y
- #include <linux/sysctl.h>
; ^5 v. ~! H+ [' q2 s5 v: e9 O - #include <linux/mm.h>
* E, S+ {6 ~6 s4 R2 j6 e - #include <linux/dma-mapping.h>! K; D% E' |5 Q1 @( o
- * x: O( Z! A0 N8 u0 |6 _) d& m0 E- P
- #include <mach/memory.h>+ i9 g7 B; x# I p5 M
- #include <mach/hardware.h>/ F% q6 z; `9 ?) b$ ~) h* ]
- #include <mach/irqs.h>
, v- j3 k4 E! \, k - #include <asm/hardware/edma.h>6 @. _0 [; q& J: d2 O9 R- {
5 u3 d6 c& q/ C3 H0 V1 ~' Q V- #undef EDMA3_DEBUG: L9 v# y5 w5 }4 H b! ?3 k$ N
- /*#define EDMA3_DEBUG*/* F4 ?+ l+ @8 h# h" P0 g
# c# ? [' B8 B A, P- #ifdef EDMA3_DEBUG2 o! \: E% k5 {) i1 H( {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
C" n4 y$ h6 a6 r2 S: N, l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- J* v6 U8 W% L5 f$ c) G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 H! A. \+ W+ M* Q+ N' ~ u) J - #else
& e* ^, s6 P2 C, {1 `$ _ - #define DMA_PRINTK( x... )
* c" S& f5 O- G - #define DMA_FN_IN, |' w% b, Q' l
- #define DMA_FN_OUT
0 u! D8 O* r) `4 i5 Y - #endif; q0 W6 p% v* |
- 3 z4 G" F% R' t# c8 @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# c; O+ M0 A8 u0 @/ d6 J! |# V7 S
- #define STATIC_SHIFT 31 A1 v \' w) Q6 C
- #define TCINTEN_SHIFT 20. t& V$ o6 H) ~7 V! f
- #define ITCINTEN_SHIFT 211 g3 `. v+ G9 }2 S, q0 \. f
- #define TCCHEN_SHIFT 22
) f6 ]/ f4 G2 B% G* i) h - #define ITCCHEN_SHIFT 23
; G' E, _. P/ w/ n6 {
9 p( O0 L/ k2 [; B- J- static volatile int irqraised1 = 0;5 h( h/ s" l. ?# X; @- J
- static volatile int irqraised2 = 0;; E2 n" b* Z* A& C$ a; S
- . Y& B1 \( |) o2 {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* `+ ^! w4 g6 D. {2 O: O; J: x5 s6 d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 A$ [6 Z+ o) h$ z' P U( h6 I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( X4 x% D, w6 a y n3 r - 6 c$ T0 j) M& r
- dma_addr_t dmaphyssrc1 = 0;/ q& I1 |: T/ m( U Y! H
- dma_addr_t dmaphyssrc2 = 0;
% ^5 _4 z5 j# S! j; \2 S+ P# } - dma_addr_t dmaphysdest1 = 0;
, \$ E4 l' o+ k' j: k% _+ W - dma_addr_t dmaphysdest2 = 0;$ X* b. v8 Z1 j! m u4 G
- ; y/ Z6 U5 e. \8 v
- char *dmabufsrc1 = NULL;" X2 Z, u5 V& O- w+ O8 U
- char *dmabufsrc2 = NULL;- i" S5 J8 M7 }8 \
- char *dmabufdest1 = NULL;! C/ t# g! ~& }2 d5 G+ ?
- char *dmabufdest2 = NULL;. P$ z5 C2 [/ H5 m( Y3 Q. P
: m3 }$ B" M3 M- static int acnt = 512;
4 s2 j. V6 ^& H! W( B - static int bcnt = 8;
6 ~; t* y) w" p3 b, F" a2 Q! z - static int ccnt = 8;
; x; y* c& L% H6 i3 F6 _- I, ]
& {4 R7 i' S5 ~! f* Y8 n3 j- module_param(acnt, int, S_IRUGO);. o) s$ w4 \" Y9 Z3 T
- module_param(bcnt, int, S_IRUGO);
1 l* Z$ ~) e: L - module_param(ccnt, int, S_IRUGO);
复制代码 # p: |3 y0 k/ W* {' n0 w# J
d" v6 [7 H6 v& c$ |, v- p/ [7 y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ I% A, [/ a- H3 Y- f0 m% Q& F! Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 X5 a' N1 ]: S/ m# P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 T8 D7 h4 h% \- Y
4 }- P1 c/ M# D3 m" P0 F; c
2 Z7 p% ^% y& j! F
|
|