|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ p/ W9 ^" n6 G* D- [code]EDMA sample test application
( a ?1 O4 D, L - /*9 L' d7 i7 Z W. G2 a. p
- * edma_test.c
9 e+ |1 W' A, y& S1 h - *
* a8 `& Q4 H" l u B- A5 q3 t2 p - * brief EDMA3 Test Application
2 O3 p5 z" P/ F0 [ - *8 e b/ `. ]" m% _( ]
- * This file contains EDMA3 Test code.
, ~' f- l" E) P9 J2 ]6 N0 N# Q - *; @- r0 a( e# j3 ^; a$ X, z) Z4 R( Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! E p# d% I( B; o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* @% F+ x) S# M+ s - * TO CHANGE.0 \( v9 S- i5 [% N
- *
! a2 b1 M/ l! g- b6 L: N0 \/ N) a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 n/ R+ r" ^" c9 y - *. b' f9 x# A3 }$ W
- * This program is free software; you can redistribute it and/or1 j" t5 d( @ l, X, q& ?
- * modify it under the terms of the GNU General Public License as+ o. ?' R9 x8 m) e9 a: Y! ~
- * published by the Free Software Foundation version 2.
6 o8 Y$ q4 x2 r1 ?: m( Q - *
5 F- |- G* o0 O2 }( w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" U J( I* V6 |5 [) w* \' r. B+ a - * kind, whether express or implied; without even the implied warranty
1 m, W. n/ H; ]% Y5 Q' l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# y- d. N/ H8 k
- * GNU General Public License for more details.8 f% n" a K, L$ b* \ Z
- */' J% r; o# C% x0 x. r7 D* _, l
, p: `8 i+ Y2 k! g3 t, X- #include <linux/module.h>
" q4 ^% k4 G# x$ C d0 l - #include <linux/init.h>8 X/ j# F; i7 \0 _& _9 x2 @ g1 h
- #include <linux/errno.h>% c" @3 D, U: w. e8 }8 [7 w
- #include <linux/types.h>1 Z$ g2 V1 t4 q7 `0 T
- #include <linux/interrupt.h>
: [5 Z$ a1 ~' z - #include <asm/io.h>4 |9 U* v8 @6 M' g) @9 o2 _
- #include <linux/moduleparam.h>" z" p$ z4 ^2 V! ^; x% ] m
- #include <linux/sysctl.h>6 _* d; t) r% a- N7 A w
- #include <linux/mm.h>9 u& C) E1 S. Y6 M2 o
- #include <linux/dma-mapping.h>5 w+ `1 J7 D" J8 U
3 j3 _4 i( V* l/ m' V) e- #include <mach/memory.h>
; w1 k$ E9 j9 b: O Q: L1 [ - #include <mach/hardware.h>
3 O% |& d$ T. J2 w - #include <mach/irqs.h>
5 J2 Z5 U$ X1 i" d) ] - #include <asm/hardware/edma.h>" x, G) g7 n, W2 c! C) ?6 _0 r
3 ]* m& e! a: N2 y- #undef EDMA3_DEBUG+ s+ b8 b4 `: t: e: j; }9 J
- /*#define EDMA3_DEBUG*/) G, w; j% C5 v N, c
- ( |* ~$ h1 X. U
- #ifdef EDMA3_DEBUG! T* ]# E+ w; y1 J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 n4 T! d( o5 x. u# W ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, d8 p- X& ]" E ^( a& q+ G" u7 i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 J( s# i4 {) ?/ Y
- #else+ F- A8 [. [1 ^9 I! L" \
- #define DMA_PRINTK( x... )% M1 b! q0 K- e8 [) `
- #define DMA_FN_IN6 N" N% I+ S/ T6 S7 J# F6 V& K
- #define DMA_FN_OUT0 I5 l/ [' l$ M$ _! K
- #endif) c' F! I N9 K/ r& Q+ g3 C( g
- ; j. C' o" ?* V3 p7 s! Q. V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 ~5 d6 N( I6 o* M
- #define STATIC_SHIFT 3
( I! d3 z& \/ s7 d) D8 C- q - #define TCINTEN_SHIFT 20
& [2 X& V# Z9 L, _) z7 D - #define ITCINTEN_SHIFT 21) ~2 O4 Z# h2 {) g
- #define TCCHEN_SHIFT 22
( ]$ r7 Y0 h# g5 z/ G/ H - #define ITCCHEN_SHIFT 23
, V+ M3 {, ]9 N: w - % M& f5 B1 Z4 U
- static volatile int irqraised1 = 0;0 l9 t9 ~! E. l0 m" u+ Y2 e- V
- static volatile int irqraised2 = 0;+ }' g7 [) M$ h3 U: }2 d. F: L. Q" W
- , U- ^6 T3 L5 R$ S4 r6 n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" B+ R; k* q+ x( e" f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 n8 q. }5 y, f1 _6 x& Q+ ]0 Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* q+ J0 s. I% t7 k/ s6 }
- ( u# k/ Q8 q0 F+ p4 \! h: `
- dma_addr_t dmaphyssrc1 = 0;
a) l! w2 m6 |& @+ v# p# |) r - dma_addr_t dmaphyssrc2 = 0;; Q9 F; v0 L3 j3 \+ t/ \
- dma_addr_t dmaphysdest1 = 0;/ n5 o R& e( l& L, L
- dma_addr_t dmaphysdest2 = 0;9 y$ h. T, R$ F7 D$ _# A
- # r& W$ h4 d" X" A
- char *dmabufsrc1 = NULL;
7 g* Q9 c+ J I! y& K+ W - char *dmabufsrc2 = NULL;
5 M6 r, ]4 g% q) O - char *dmabufdest1 = NULL;
- ]- }- ]0 [ ~% I6 p5 ~ - char *dmabufdest2 = NULL;
Q- w. @# `+ m - & v% S9 O8 G4 T- b; j4 H
- static int acnt = 512;9 u7 x: `" g; i" |2 b$ M
- static int bcnt = 8;
% ?# O; _+ ?- C# D - static int ccnt = 8;
& [. t- ~" F- k c/ R3 w
) v. ~) }; T/ i( `) F) F9 o. Q+ E- module_param(acnt, int, S_IRUGO);: Z& K) e: J, m* h
- module_param(bcnt, int, S_IRUGO);
. p+ B" k$ b; {, [2 M; | - module_param(ccnt, int, S_IRUGO);
复制代码
0 o C# k& J: l- I5 h: E9 U& f7 V" i5 Z: y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& G) U8 z! n' x8 o* I9 w% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! V0 R6 A z2 Y$ P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# U* L0 o% h, k) B6 j! L1 ?0 D$ Z& Y( \. S0 A# A
; `. [, ], J7 x2 Z( i
|
|