|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % F; }0 G2 V) G: @' R* a5 J
- [code]EDMA sample test application
8 i4 i4 b" y9 S- J0 x& l - /*3 m5 z6 Z& c0 a5 S" V c- f8 h
- * edma_test.c% G5 d. b! {8 u3 ~( o( Y9 m
- *' P% b7 c- c. L `0 j F% e
- * brief EDMA3 Test Application. d6 f; P% I* l# e6 ~' K4 }7 _
- *
, N4 M7 d7 X j - * This file contains EDMA3 Test code.- j1 E C/ n. `* U1 X6 m5 \* d
- *
( J1 y2 ~! o( S8 c& R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* N) {( i1 l) f5 s( F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* i& Y. W9 [) S/ ^ - * TO CHANGE.$ c0 j' b1 q3 Q3 e( X6 n
- *
0 ^/ b( V9 f6 S4 {% \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 x. ~ g {6 N; t8 n* d: x
- *
* m( ^' [0 l( \' @' N _) U - * This program is free software; you can redistribute it and/or
( b0 |! S P$ m' t' v2 v - * modify it under the terms of the GNU General Public License as
# j6 F1 R3 r' K8 f1 P/ R ?9 V - * published by the Free Software Foundation version 2.
( ^* W3 W- z/ e' J* C - *% b* K1 m! k1 Q, b" t; c. J1 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& _% f$ m6 ~& }+ @3 u. z& l - * kind, whether express or implied; without even the implied warranty
6 z: B" y4 t( S! ~4 o1 ?- S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 `# C0 T) `; H3 j3 l
- * GNU General Public License for more details.
; u+ l% k, j( w9 k6 j$ b - */- E# l2 j t4 {0 T" k1 |
. C7 ]3 z9 J8 ]: k- #include <linux/module.h>0 H6 b; \9 U p
- #include <linux/init.h>! [ s" X4 o \7 m( D
- #include <linux/errno.h>
6 `0 x5 q4 ~( ?! ^5 b) p - #include <linux/types.h>
0 s( y1 F8 n2 V) [" z" h2 _+ G" V, g - #include <linux/interrupt.h>
6 }/ |% `/ J! I - #include <asm/io.h>
- n; r' d! k" F' u* i5 k& a7 K$ f4 g - #include <linux/moduleparam.h>
4 V2 U% |1 w, ~ - #include <linux/sysctl.h>: O9 Q7 i7 @7 J- v
- #include <linux/mm.h> n, O" x* U* T5 K
- #include <linux/dma-mapping.h>
" t7 N0 n" S9 A/ w4 s J- a
) b: |5 u* E8 Z- E: o2 {- #include <mach/memory.h>, p1 [! z; |" ?* @! f
- #include <mach/hardware.h>
T7 } o8 s# M1 n - #include <mach/irqs.h>
" R4 `) ~6 ]% v+ o# V* o7 t$ H - #include <asm/hardware/edma.h>8 m( O, Z) g. c! `/ s+ O
7 b& [0 f0 J& W' H9 j! _- #undef EDMA3_DEBUG2 `( R. v0 J) _+ w N6 m
- /*#define EDMA3_DEBUG*/
/ ?5 G h- g; B b - . d7 z* s' ~% e; i) Q
- #ifdef EDMA3_DEBUG5 p2 t% [" G/ }' Y8 W% ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% ~/ \0 A) G/ ~/ x! d8 Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ Y/ W/ L8 D) ]) m# H: w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& U* C( I8 V0 V - #else
9 Y/ w8 z6 M( s9 [$ w, K8 \ - #define DMA_PRINTK( x... )5 R2 s. c7 Q' r; q( K2 Y
- #define DMA_FN_IN- c' h' \0 S/ j5 K
- #define DMA_FN_OUT3 Y6 Y) L3 o! F
- #endif7 H, z% M8 ^6 D7 U" T+ c* Z+ i l
; H1 `% E: g7 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 K! K3 J0 w5 C1 }) Y! p! J
- #define STATIC_SHIFT 3+ ?8 }; l k6 D7 R! y# H: h
- #define TCINTEN_SHIFT 20
5 c( y. H3 H, U( j5 v - #define ITCINTEN_SHIFT 21, D3 ]. i* q% I; u
- #define TCCHEN_SHIFT 22, @% [8 y2 q7 b. }7 |
- #define ITCCHEN_SHIFT 237 @% d# o# X Q! U- {
- 3 ^/ r+ ^- ~# x7 s! y- C( |! W
- static volatile int irqraised1 = 0;
# `( \/ Q( E- e9 h' y# o6 h/ } - static volatile int irqraised2 = 0;
7 P' N; Y; z5 F& b
; F0 q6 O- T6 C0 Y2 \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ], \- z/ ]) S$ e* q7 G" C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 `! L4 H4 K k# {, T9 H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; W/ ]3 {) b. F
( S, [/ [7 h2 G# j) k# u+ w- dma_addr_t dmaphyssrc1 = 0;- A5 [8 n% X& T- f% C2 f& y! k3 w
- dma_addr_t dmaphyssrc2 = 0;
* i7 s# c C2 }3 Y) f$ N& x - dma_addr_t dmaphysdest1 = 0;9 q7 O- d2 U2 f( h3 c: E
- dma_addr_t dmaphysdest2 = 0;
, G3 {. Z; T2 a. p; P9 y
& O% p) M' B, u- char *dmabufsrc1 = NULL;3 t. n7 e1 q( S0 F; `. e% ^9 R
- char *dmabufsrc2 = NULL;" e9 x$ {% L' ?* p% u0 U
- char *dmabufdest1 = NULL;
. P# D9 _$ _! l, K$ G - char *dmabufdest2 = NULL;8 S Q2 @& U* R& H
* [' Y, O' B9 ^) b- static int acnt = 512;3 c7 i" v1 d# i% s3 o
- static int bcnt = 8;/ K- u# p) i, l& n p9 j
- static int ccnt = 8;( }* L% P L! H* d. W8 U
- 7 G* ^2 `/ c) A7 r( y b% i
- module_param(acnt, int, S_IRUGO);
/ h' l9 j3 B5 G' N2 | - module_param(bcnt, int, S_IRUGO);$ O- \" Z; u+ d
- module_param(ccnt, int, S_IRUGO);
复制代码 6 d( _5 v/ `' t. f' t9 |
0 Z; J6 V" A$ @- @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 C" v: h- z6 M9 I5 l9 C% Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# q1 h* I. w( H% \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 `- P0 @( X/ v9 p( h+ \
% R9 y- V% L4 S n' }7 e6 c
7 O6 D. x4 Z2 Y: h |
|