|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " b5 p7 B8 a, @2 A. [2 y9 F/ o
- [code]EDMA sample test application: a8 O# d) i% V
- /*
: v1 G" j- i) X+ p' `7 K - * edma_test.c* h, N0 [5 k2 r" w) }' W
- *
0 i# M7 I0 Y i v - * brief EDMA3 Test Application
7 R \) j! ~2 ]6 B - *
. G7 x G* @2 e# O& o - * This file contains EDMA3 Test code.
' Y3 a' j. z: _6 R. Y6 t - *
$ y; L, g9 V* W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE ?2 C6 M# I* |! P9 X, l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& Q5 @! H1 ]) B% y6 ^. a
- * TO CHANGE.
- P8 v$ o- c6 z, y+ A; B: t7 r - *
1 {3 W; x( P& _* U- e1 O$ E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 U$ x/ O4 p! m: ?: Z - *
, u. Y K0 W9 y8 n& k - * This program is free software; you can redistribute it and/or
! P+ W) z8 m: ~9 F! l! u - * modify it under the terms of the GNU General Public License as" v2 X- _5 k) ^: a- C9 [- {- B
- * published by the Free Software Foundation version 2.
4 _/ {7 i/ s+ R' [ - *4 ] b9 V3 o4 F$ d& H# y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 ~+ s# E" B+ Q# h - * kind, whether express or implied; without even the implied warranty
7 W+ T4 ?3 ?& E* v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 ]' O4 W2 C+ ]- o& M
- * GNU General Public License for more details.: N* R; c8 A8 `$ F
- */. n2 ^" J: s$ s
- - O) H a# K& j, Q9 S* x
- #include <linux/module.h>: |* @: R/ I5 x
- #include <linux/init.h>
4 e. r6 A. o2 o" X4 W( N; x - #include <linux/errno.h>2 o- P7 H# ]0 u* {# e9 J
- #include <linux/types.h>2 \. K8 v9 q3 G5 c6 L0 E0 f
- #include <linux/interrupt.h>
- U4 v: b$ [. v- `$ T s: K- w - #include <asm/io.h>
9 W8 a. S- E! Y3 ^ - #include <linux/moduleparam.h>- z4 j$ j' u& M F: Z
- #include <linux/sysctl.h>/ w1 Y7 I( A2 h
- #include <linux/mm.h>: J1 z% `: G0 e. t
- #include <linux/dma-mapping.h>1 d; Y9 ?2 p! d D/ W) A$ |
5 U+ r; {6 _* Z4 j: h3 S- #include <mach/memory.h>
7 F4 p8 K9 ]. X0 }- t1 t - #include <mach/hardware.h>
& c. x/ i) D; h' _ - #include <mach/irqs.h>. j/ o* j- z- u# R& H' Q/ Y. b
- #include <asm/hardware/edma.h>
% A' {; C- r2 l E2 \ - 6 z, @6 `- F1 i3 o
- #undef EDMA3_DEBUG
/ a3 z4 w( O H - /*#define EDMA3_DEBUG*/
+ h4 B5 }6 q9 x# A7 N; ^- r+ o
?, ?1 V* ?( }% T& q7 N- O- #ifdef EDMA3_DEBUG; P- }; L E9 T' ~1 n+ V4 n6 d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): G4 P; [2 ?5 M9 ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): T p5 x8 Q6 i5 `# b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' e2 U% S8 W, ~; R& f; L - #else
, A- r+ B9 S% s7 `" ] - #define DMA_PRINTK( x... )3 I& J$ d# J( A# T! i
- #define DMA_FN_IN: F5 m) Y8 z! J5 {* I" i
- #define DMA_FN_OUT
7 J$ l Y5 Z, T& R7 U& m - #endif) w I7 C* T" w( K# `3 }
- 7 s1 {9 C5 l! B+ N7 |2 |' z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* F6 f* B9 R3 x
- #define STATIC_SHIFT 3
4 a% K( U2 d! k9 v: G9 ^ - #define TCINTEN_SHIFT 20
3 `7 m; [$ A4 R: f - #define ITCINTEN_SHIFT 21( S! T. a; U; e4 ]' | J# ?9 w& F4 L
- #define TCCHEN_SHIFT 22
) ~5 D# p+ z! i( q - #define ITCCHEN_SHIFT 23
+ ~2 j6 m1 V* q - ' h# O! @* x# G0 C* s
- static volatile int irqraised1 = 0;( ^# z4 P$ I; r* }8 T, \4 n
- static volatile int irqraised2 = 0;
! G( y# O Q1 F$ h
+ M. x7 y, G% O- c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 V8 c; ^) F# ^) |* { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 R4 T( `" H! k: A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 g/ z) V# c& r2 q: ^( j - 0 F) O% j0 |( ]6 J; A0 Y2 j
- dma_addr_t dmaphyssrc1 = 0;
9 w' \. j4 G1 ]# R& m+ Z/ S - dma_addr_t dmaphyssrc2 = 0;! z+ ` `+ j" ?8 Z4 j7 S
- dma_addr_t dmaphysdest1 = 0;. W* ~7 A; k) _9 c
- dma_addr_t dmaphysdest2 = 0;
1 T) A" \) V. Z1 q$ J# s1 L! c
. Z1 T+ R k: n, y7 O5 w k' N- char *dmabufsrc1 = NULL; e$ c6 E( Y: P4 i6 p
- char *dmabufsrc2 = NULL;
6 j1 k K1 C7 B8 z - char *dmabufdest1 = NULL;3 K5 Z7 C' o! l' j6 N7 x( z, t
- char *dmabufdest2 = NULL;
: x) ^$ P6 a/ ]! D2 Y* B& w7 ~# d
: G' ~5 ~) ?( E' g1 y- static int acnt = 512;
6 Z) E! \ R7 h! r; j" D2 w - static int bcnt = 8;
0 o& P4 W0 j( O4 E - static int ccnt = 8;
6 q# S; U' S) g8 W% a
! Z. A. I6 R0 p" M: h. u- module_param(acnt, int, S_IRUGO);
9 g; G* l6 o2 |& P5 V+ d: [# \ - module_param(bcnt, int, S_IRUGO);
0 S, n1 o7 q( S) K - module_param(ccnt, int, S_IRUGO);
复制代码 0 B# n& C+ U: V
. P1 M+ g! j" x, r* Q4 G* Z+ j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* |. H6 ?9 Z8 e7 h0 N' Y& ] 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ K1 z& `- D2 M9 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, I9 L+ u/ z( P$ N* v, m
) W; L1 Y7 u5 H6 L1 x& S$ O4 \0 d
# ], R1 p3 }3 N5 g |
|