|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 f6 j% @$ a8 O1 e- [code]EDMA sample test application2 H! M5 f* l0 {
- /*
1 O. }6 d% L ?9 ^ - * edma_test.c
& e7 D& _4 f E& ~ - *# C$ s' ?7 Y9 ?4 r9 [
- * brief EDMA3 Test Application
: d8 p( ^$ d& T - *
& s9 W# \5 m: B1 T" ? - * This file contains EDMA3 Test code.- m* h& u3 S3 ^/ j& J7 {
- *1 \+ @; Y1 K# x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 z9 Z1 C% |3 t! {! e i0 a) g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& I- ^6 }+ a8 n; R1 ^' a: K; V - * TO CHANGE.
7 M) r n+ V9 |' @* a% \/ k - *2 V5 J& U( P. X/ j% W7 ]& `+ v" @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ y3 ]! [" q$ u! S. H' d
- *3 b \2 j5 d! {$ C' p6 I" p
- * This program is free software; you can redistribute it and/or- t6 G9 g7 r8 F3 h
- * modify it under the terms of the GNU General Public License as+ l4 N$ Y' `2 P3 o
- * published by the Free Software Foundation version 2.3 t4 H9 V+ r, w$ T0 o
- *
: J9 A1 `+ A: G" _$ Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ K( l( u7 Z+ H: o ?# o) _ - * kind, whether express or implied; without even the implied warranty( h( ?8 }. O' B1 F4 ~" u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' u% v7 H% G7 O4 `; A+ J9 U Q - * GNU General Public License for more details.6 j C, Z! [" P1 l
- */8 O" X! s3 R/ p F
2 L P+ _, B8 Q& O! x3 ]- #include <linux/module.h>
* j; O4 Z; s. f- a7 i$ R3 ` - #include <linux/init.h>3 x# I \/ ^' [4 C8 b! n' O
- #include <linux/errno.h>
- G9 q: K4 }7 |' x& N" | - #include <linux/types.h>
( P0 V3 f" ?$ \+ ~ - #include <linux/interrupt.h>9 Y, ~ G* s' B8 {2 M0 b! u
- #include <asm/io.h>
/ `7 Z3 d1 L* V0 }: y, ]6 M9 ~$ y. G - #include <linux/moduleparam.h>
6 K2 y, O4 O0 n, {% V - #include <linux/sysctl.h>
/ [, G4 M9 C& i Y& r) I - #include <linux/mm.h>+ S9 G, P+ D' n7 k5 ~ f
- #include <linux/dma-mapping.h>; S. a4 [0 h" v6 X8 T
7 C: s3 d5 v- {0 n' V+ v- #include <mach/memory.h>
8 O: h( {! q [5 R* h3 a - #include <mach/hardware.h>, n" Z5 x6 E3 M
- #include <mach/irqs.h>
( y( K& q( {! e6 {5 Z. }- _7 r - #include <asm/hardware/edma.h>1 Z# W1 T. ~: G) k4 J0 ^3 m# N
' J3 e8 c2 @& Q# U0 Q5 u5 U- #undef EDMA3_DEBUG
. _. `; ~- }9 A7 G# u - /*#define EDMA3_DEBUG*/* V3 A) h" _" v3 I2 [
- " p* w" j- Q; j# B, _7 a5 h
- #ifdef EDMA3_DEBUG* s4 J8 J2 K8 P9 e+ |: F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 G7 | N% C1 z2 x0 d- k% O5 J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' R( S0 l" _" I9 E) i4 S3 W) M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' {, M3 ]: ?9 h% u# F3 M
- #else# M' N o6 W9 h+ c& K
- #define DMA_PRINTK( x... )0 {3 Q, Q: E4 o# H" j; O z
- #define DMA_FN_IN
- V, _+ N4 z7 f3 c) F - #define DMA_FN_OUT2 w% o* T* ~ ^2 G
- #endif
) h* d( ?0 S) I+ f0 @ - # K! z2 C) {( z) H4 w% f2 x4 `: ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ d$ a8 [4 Q( c - #define STATIC_SHIFT 3
9 u! A) q( z. h! M - #define TCINTEN_SHIFT 206 u5 L: D/ |5 m$ l r1 V R) @
- #define ITCINTEN_SHIFT 21. S5 u0 |2 `; g) G7 }5 q2 s! n
- #define TCCHEN_SHIFT 22
6 f, H3 V' {; C3 W* f# c0 T - #define ITCCHEN_SHIFT 23
% L/ ~: o, M9 i+ u+ @
, s* A' f( U! G }4 e% n" B8 Z- static volatile int irqraised1 = 0;
& [$ X j) I; F0 u; i( [ - static volatile int irqraised2 = 0;
) K+ a% e4 a7 H/ ~8 R. h - ) W8 E8 v6 K$ t& d; _; k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. u) q8 G8 ^: m j' g: W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" u0 y" }8 d1 f1 G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% [3 F/ p3 g/ q# n' I9 F
: h5 k( X7 e8 X( D, R- `- dma_addr_t dmaphyssrc1 = 0;. w2 c/ V; d7 z' w# ?$ |
- dma_addr_t dmaphyssrc2 = 0;
2 `5 A. E* }$ f0 O" b- T - dma_addr_t dmaphysdest1 = 0;
8 S, ], {4 j6 Y$ R3 s0 M' k$ T7 k - dma_addr_t dmaphysdest2 = 0;
! z: W( Y4 c) J
# i y" ]( T& p8 S8 q9 s# c5 T- char *dmabufsrc1 = NULL;; h& k u) [! P( i$ R" Q. ?7 x
- char *dmabufsrc2 = NULL;
! N1 j2 f" [. [) y$ u - char *dmabufdest1 = NULL;5 d9 D) a; V+ P$ N, S7 j' K
- char *dmabufdest2 = NULL;& t. B+ V* A: I& @* d9 S% Y
- 7 i% w% Y5 v4 l
- static int acnt = 512;
- c: I4 Y' S6 r% p! I3 p- q' Q - static int bcnt = 8;+ i/ {/ H* m N! E
- static int ccnt = 8;
0 R4 Z, f2 L P- O/ C; n- s
5 [9 a& |! B, F# D. s% J. B- module_param(acnt, int, S_IRUGO);
6 t: t2 U" z* ^8 k - module_param(bcnt, int, S_IRUGO);
% f) D5 }5 U2 K$ V' ^9 s7 N3 K0 e. A - module_param(ccnt, int, S_IRUGO);
复制代码 6 \' B/ p9 T0 y; y( F! R1 U% Y! M
! D& ?4 [% w( ]0 b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, f0 T5 o( [6 t$ ?9 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 \ w) T' K2 h" f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 I1 I+ q. B4 j& p- s( j
9 h8 u2 h7 t% X, c" r5 P$ d+ T; T: e: E
|
|