|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 |1 m4 t' ^! @2 m) [( s1 v
- [code]EDMA sample test application1 U/ c3 p8 [; l8 [6 O
- /*
# \& c2 d& m2 m P$ d' I - * edma_test.c/ H- a6 q. T I' Y3 L& t
- *
" a N6 @9 {& z, ~ - * brief EDMA3 Test Application$ s; i) l% g' K5 X+ }8 ~
- *) r# \) ]) K; _* a$ }- f
- * This file contains EDMA3 Test code.0 |5 e, f; F3 ]( G* \ }
- *7 \9 N1 ~5 W' n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% y0 o/ x! ^: \. i" |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 @0 F/ Q0 X% y. Z" }: U# t
- * TO CHANGE.
$ L4 _+ e E; q7 D: T2 r& B - *2 I/ \: N! {2 L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, e5 q. X6 i$ Z, o) N7 Y, {
- *9 t. `) X1 T5 [1 h* W
- * This program is free software; you can redistribute it and/or7 T( y: O3 e {/ l: b6 ]
- * modify it under the terms of the GNU General Public License as
) g, C |, m7 S - * published by the Free Software Foundation version 2.
& O2 z, z: s9 C/ @" I# U6 X4 F* Q - * h# F& S+ P! e$ u/ u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ v# x! J9 m$ \3 N
- * kind, whether express or implied; without even the implied warranty
6 P! |. o& S3 O6 | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, A6 P4 P1 |- w' k" w2 U1 p
- * GNU General Public License for more details.: |0 C' |0 K/ N+ Y W
- */6 _, C% v; H3 H5 h' Q5 N) t
! U' y, [3 j, ^& g3 }- #include <linux/module.h>5 }/ G1 u: V' L6 X, b( x
- #include <linux/init.h>
9 z* ?" P# \: s' T( {- Y, @ - #include <linux/errno.h>
7 R, P6 I8 {6 ?* |' \% x2 a, E& h - #include <linux/types.h>& X% s1 N. G: R3 J0 D6 A: ^* n
- #include <linux/interrupt.h>* C( s, j x2 j! D
- #include <asm/io.h>
6 }- Y% I. {5 n( G# e% W7 h9 E7 ` - #include <linux/moduleparam.h>
! m/ O5 }0 J# H7 q - #include <linux/sysctl.h>
# I) |: q- ~0 k( k - #include <linux/mm.h>0 F! Z8 }/ D9 f+ O
- #include <linux/dma-mapping.h>- {1 o1 @( V. o0 c2 Z) c5 r( y
- u2 d7 z/ t7 L$ ?$ { _. U, P- #include <mach/memory.h>
1 Y! W7 F6 A0 X& [+ M - #include <mach/hardware.h>
3 L0 r$ A$ l! @$ ]3 P4 b7 H - #include <mach/irqs.h>5 ?$ E( R/ ^7 a; ^
- #include <asm/hardware/edma.h>0 S$ s5 I0 N$ r C) @/ h/ {
- 9 k/ ~. F' h% B/ f4 x" q( \4 e; q
- #undef EDMA3_DEBUG
$ q" G# k, N1 D! T5 T, B' U# L - /*#define EDMA3_DEBUG*/* v, }/ o0 B) @2 N# F' H
- 2 x# M$ {6 J! D6 _) }: m
- #ifdef EDMA3_DEBUG
. C5 R& e @ I# P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% I2 {( j o8 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ s8 h$ F; |% f% I; `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ x) B O9 A L$ ]: w2 ]# J - #else
, C1 b8 U, j+ U7 U, e - #define DMA_PRINTK( x... )7 T8 ?' C' a0 X. C) X m
- #define DMA_FN_IN: ?1 a2 g% M3 q* e; U0 _7 d
- #define DMA_FN_OUT
\8 H7 `6 _0 _: z: U - #endif
) W: d- b. c% s( [; F6 g- ^
2 _ j" S9 E1 ?/ P0 j3 i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 J3 s5 R6 R7 v& e' o: p
- #define STATIC_SHIFT 32 N; V6 u) \% m3 {2 n; N) j$ N$ W
- #define TCINTEN_SHIFT 20
& T7 H- \+ r, A& s9 w/ t$ ^ - #define ITCINTEN_SHIFT 21
( V; K. L& g# K: z5 S. k - #define TCCHEN_SHIFT 22
6 }8 K2 |6 D1 w! O9 [$ V- s0 z - #define ITCCHEN_SHIFT 23; K; g" o& l% N; t
- # ?7 \/ d, o3 q! w' @
- static volatile int irqraised1 = 0;, {) a4 K) {! c5 [; Z
- static volatile int irqraised2 = 0;; T' x2 p2 \8 x$ f+ w, y
- 7 V5 r: T0 G7 S* c: Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) @6 X/ @/ E% {! }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& D0 `) e$ t& g* [ L# q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* H* L# m, e' ?8 |8 ^. g
# j1 Q l6 H9 V+ [+ p- dma_addr_t dmaphyssrc1 = 0;" S0 d- h; | `9 Y; y+ }
- dma_addr_t dmaphyssrc2 = 0;6 `7 r7 e+ f& b J5 ~: N1 p
- dma_addr_t dmaphysdest1 = 0;! X. q% W. W" V% z: t. W* g! K) \1 ?
- dma_addr_t dmaphysdest2 = 0;
+ w k2 B ?4 H- u I
5 B. a8 _; Z) X, M- \& u- char *dmabufsrc1 = NULL;! v2 T2 E( g4 q1 O& c, K% Z- R
- char *dmabufsrc2 = NULL;
. Q/ J4 J+ s# d3 n/ _; R0 A0 V. { - char *dmabufdest1 = NULL;
/ {' W9 c5 k f7 P - char *dmabufdest2 = NULL;' A) _' P/ c4 `& b. u9 s+ f
* o, x4 v9 t0 h5 S+ @) y- static int acnt = 512;% @3 O9 W& ?# Q/ B5 D
- static int bcnt = 8;
! w U! e e7 @6 g - static int ccnt = 8;) Y& I1 y8 E% Z
- 7 [% U, \; o L& z- n
- module_param(acnt, int, S_IRUGO);, f L; F3 N, d/ v. i u% \
- module_param(bcnt, int, S_IRUGO);
& S+ J+ @7 d9 g% O& I; d - module_param(ccnt, int, S_IRUGO);
复制代码
1 Q9 s; Q1 j9 e% K" T5 L
: Y" f" Q/ P+ d0 F5 ]5 f0 J) e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
T: m. j; a- X& [+ v! oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 o0 b5 ^' h' G/ x) p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ T) N% \" Y1 B: l. t4 H6 q1 {# T) u) D
- D! `+ Q2 f& C: W, H" Q: m
|
|