|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# I [6 f1 {) n- P8 ?- [code]EDMA sample test application
0 d2 C1 C- I- x4 o5 _ - /*8 L' ~7 R! r* v) m
- * edma_test.c+ }) q3 X8 n& X0 d5 n/ M
- *$ P7 ]+ ~ j/ C
- * brief EDMA3 Test Application, E! c. E- U. o3 \% n
- *
/ v) B/ x' o$ A- C3 M/ K$ d - * This file contains EDMA3 Test code.9 P* ]4 ^/ j5 p/ y* m9 j
- *
4 {- f) ? ^) x$ i( t5 W/ f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
X& L3 O. N+ a- i L U% l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. i# h4 m3 x+ c E4 ]) j8 s - * TO CHANGE.
8 |* s% \( J: B! s - *
# S: B. A! P' r0 O8 o9 d1 i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: y2 a5 X8 h) o9 b, o; r( R
- *" {% v6 V3 r" }
- * This program is free software; you can redistribute it and/or+ o/ j5 q8 C, W
- * modify it under the terms of the GNU General Public License as1 h% r& l! i6 g) o* h- C4 z) v
- * published by the Free Software Foundation version 2.7 ?6 n5 B, f+ |
- *1 n6 f8 k/ u3 i% Q! j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, ^- z/ R& x( ^2 g8 h" T% R
- * kind, whether express or implied; without even the implied warranty7 b, o$ N; u+ l5 y- a1 W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: g% [$ j( J0 E
- * GNU General Public License for more details.
( V* a* P5 K1 b" r - */
, Z. @+ J( Q( a5 k' M1 o2 H
9 p0 ^$ e! V' K" u( F+ Q( K- #include <linux/module.h>
2 i! _$ b3 v: G" R/ M - #include <linux/init.h>, N1 z% L2 {$ k/ x5 E; J5 C9 x
- #include <linux/errno.h>9 `2 D( Q3 D. P- U; k
- #include <linux/types.h>/ c9 S0 N) g* M& X) ]( `5 g
- #include <linux/interrupt.h>7 h: G( m6 M, X% a9 a& W1 E
- #include <asm/io.h>
0 c J8 q5 I) u& i& n' c' j: [7 t" K - #include <linux/moduleparam.h>* P L+ Q5 L% O
- #include <linux/sysctl.h>
# E; n" X$ {! q: V9 W4 I0 ~ - #include <linux/mm.h>
1 ]* a& w Y$ o& r, @$ l$ f - #include <linux/dma-mapping.h>7 U& Y/ s8 ^' s( K J5 g
- ' y6 W2 S2 Q* K& o( g
- #include <mach/memory.h>% y1 F e) ~) P1 ~3 V0 R
- #include <mach/hardware.h>
. h; J& g8 g) n; `9 S - #include <mach/irqs.h>. i0 B* j4 G( l2 I8 i
- #include <asm/hardware/edma.h>
. I( ]0 S0 {% `" o' w3 H# X - & q# \& v7 M) Q) e
- #undef EDMA3_DEBUG, l* g; B% P8 |. X
- /*#define EDMA3_DEBUG*/
0 x/ A4 C+ H7 h
) n: l, ^ s# B8 E- #ifdef EDMA3_DEBUG
1 Q2 H& `% \" Q4 Y! ]5 } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 G! N+ y0 i$ J( v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" ~; P) H1 [5 d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, c1 z1 l3 J5 _5 I2 h, E: g - #else
1 K0 D0 v0 U, F$ G e d - #define DMA_PRINTK( x... )- G; e8 C9 B1 u! u) U
- #define DMA_FN_IN
$ |/ `1 g2 q I - #define DMA_FN_OUT$ C% F+ t0 q/ P
- #endif8 K6 x8 w4 g- i- i; f
) ?! \' I4 k& _+ S3 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! L9 f# d8 b* H+ _3 x
- #define STATIC_SHIFT 3( l& Y8 ? n9 S
- #define TCINTEN_SHIFT 20; v# K, _8 U7 y% y% v# r
- #define ITCINTEN_SHIFT 21
; ]) n; ]2 @* ]' t; I - #define TCCHEN_SHIFT 22
$ F8 {) D. e2 f. F - #define ITCCHEN_SHIFT 23
- ^6 q# F# H' Y: d, c% l( ]
' @" h# Q5 Q! c6 \- static volatile int irqraised1 = 0;" C2 I C7 J1 `$ t; O
- static volatile int irqraised2 = 0;
& Z# {9 `1 t0 r Z: `
m1 X/ C4 ?, f7 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 M4 K) o3 t" n" I9 i: L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ M( p% Z3 V' x/ G. J8 P9 R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# v! N. F A0 ~! X+ e
^: A2 ~) P6 J# k3 n: \- dma_addr_t dmaphyssrc1 = 0;) e4 B& a V, _6 P( f
- dma_addr_t dmaphyssrc2 = 0;
* o; Z. B7 _5 f9 [ G" f/ H - dma_addr_t dmaphysdest1 = 0;
; Q1 X& O1 T' | - dma_addr_t dmaphysdest2 = 0;1 e" e F# Z; O' G5 i$ `/ K
- 5 Y2 J' {& H+ J7 t* Q* d# z
- char *dmabufsrc1 = NULL;8 `9 [7 u( u4 Y: E$ \ U
- char *dmabufsrc2 = NULL;. L, E" m3 O; _8 U3 u
- char *dmabufdest1 = NULL;9 a0 t3 N+ u6 g# M0 S
- char *dmabufdest2 = NULL;
% _; p& o/ V+ R5 r" O4 Q - + h4 _: @5 N r Y
- static int acnt = 512;
" s0 r* b; D, \. u; w4 C1 C - static int bcnt = 8;
+ {$ {2 m+ N) @9 e. X - static int ccnt = 8;2 F2 b, A9 t2 ~# i9 |) J! E
- ! X. _7 A3 r) }" F1 s
- module_param(acnt, int, S_IRUGO);
3 F' T! C+ ?' @" R1 I# A& a6 E& b( y - module_param(bcnt, int, S_IRUGO); k ] f" ~( X R( ^
- module_param(ccnt, int, S_IRUGO);
复制代码
2 ^8 {: Y. _4 M9 \# s$ x( C: \( d* {5 o8 r; Y9 [: I2 n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! T; h6 o; H: Q# \# C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ t# t" m, g: X+ v; B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ O( k9 `2 G7 y' i% ?9 y4 o0 \1 u
* C; x3 y3 z7 [6 c! r
# }" ?) y" \' f) X O |
|