|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % L! o/ F& z. x$ m" V# _. D
- [code]EDMA sample test application. `; y$ I# ?1 l/ d! ~3 n% m# X
- /* Y: Q1 I- w3 [0 A+ z
- * edma_test.c# ~4 t. F3 L" b) X* I6 y% [& w
- *" m% L# ?1 Q5 Y, i1 J9 R
- * brief EDMA3 Test Application( Z4 l, T* O2 k* r
- */ B6 ]% j9 x3 K* i1 `
- * This file contains EDMA3 Test code.
! h" Z$ B; k! L - *. Z, ?# ?2 a/ r4 N1 f( j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 C# [0 H5 o0 ~+ g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" ^# f- _" [- [# r- Q$ S. R
- * TO CHANGE.' g' `/ u* g$ e$ k4 B
- *$ X$ R; F8 v" t5 `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 s% Z& @5 y& L X7 h1 V+ p8 B
- *- F- I; B% F5 y- D- N: x
- * This program is free software; you can redistribute it and/or
4 [ g/ \1 G! N v7 S - * modify it under the terms of the GNU General Public License as# a5 E1 _* T: a f% S) b
- * published by the Free Software Foundation version 2.
* v% @% a1 j4 [/ G5 e& U - *
0 @% w0 q' z5 r- t! p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 B# _$ a: b# V5 L% W - * kind, whether express or implied; without even the implied warranty$ r: c2 Y1 Y) H, I4 B8 K) w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' `# M$ y! I2 Z* U - * GNU General Public License for more details.
/ c5 K( }2 j. l) ^ - */+ [. T/ M0 n! y
' I. n {2 V' \% a; W A9 N+ E: E- #include <linux/module.h>
. p1 u1 _) e$ T, s1 v7 _& Y! E - #include <linux/init.h>- }- ]4 u) Q- d6 E
- #include <linux/errno.h>
2 [7 W: `2 x. \8 ?) K0 Z5 {. `5 X! r# r) t - #include <linux/types.h>% k% o9 c6 o+ V9 f1 K
- #include <linux/interrupt.h>
+ E- h+ G; p- ^9 L+ T - #include <asm/io.h>3 |; q' e `+ R, o5 N
- #include <linux/moduleparam.h>
( s9 C5 Y- o$ q# Z - #include <linux/sysctl.h>/ g. T( `2 J9 p# d& r3 L
- #include <linux/mm.h>
- n9 P r$ r8 b! z - #include <linux/dma-mapping.h>
% j2 s" i" s9 F0 [$ G3 j$ [: P
8 e6 g' @' ^# z5 H9 e4 K# {# J9 ~) E- #include <mach/memory.h>
, Q) a( Z, o! @- L - #include <mach/hardware.h>
3 `9 X; V0 A# J {6 ^- | - #include <mach/irqs.h>
5 Q& Y+ v7 M1 K; a/ Q - #include <asm/hardware/edma.h>3 W' F& a: [& o* ]2 V0 a' x8 Y
! W( v- [6 e4 X- #undef EDMA3_DEBUG
; T9 F5 M; U8 ?: s - /*#define EDMA3_DEBUG*/2 u. P0 k% u& Y1 Q2 f. K
- , B) k4 R" @) ^6 E
- #ifdef EDMA3_DEBUG$ }: d) Q2 X, Z% G$ X* ^5 ~- C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, g3 y/ x; w0 |% Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& W% o% t+ }! W0 B. I1 w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% L+ L6 D4 Y; c4 D - #else
! P# l" @0 `& w7 J$ N$ [ - #define DMA_PRINTK( x... )
* v9 k' x' Y+ L! E0 f* j p6 b - #define DMA_FN_IN
, ^# r; V' }6 W - #define DMA_FN_OUT
! s% G7 q' r( O j% d - #endif
, S! _) f4 C# H2 q - 8 V( z" f4 x- w5 ~( h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& H9 T9 q# n; n0 ^6 \ n- X% H: `
- #define STATIC_SHIFT 3
, p! h7 |( \* G7 c6 E9 }' A1 Z# p - #define TCINTEN_SHIFT 20
" I8 [, ~- d+ i - #define ITCINTEN_SHIFT 21' \, ~5 z$ |" Z) t6 v5 b* M
- #define TCCHEN_SHIFT 22: h8 x" b. j3 Y# w6 [5 `4 p
- #define ITCCHEN_SHIFT 23
4 Y# ?; i9 {8 S - 0 f) D( K2 {4 y6 C4 c% G
- static volatile int irqraised1 = 0;# ^% d+ ^7 r0 L' Z( b# f# v
- static volatile int irqraised2 = 0;
( O; m/ W5 j# V% | - ; [, |6 _& w3 W. A0 ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% [/ W. M7 J ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Z; y# Y8 f! _1 u7 x7 u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& w1 }$ w5 r9 [. B6 c
- 4 z, G3 T/ x _1 a1 v
- dma_addr_t dmaphyssrc1 = 0;. `& ]8 y6 q7 L$ T3 Y; h/ r0 \. q4 a
- dma_addr_t dmaphyssrc2 = 0;
; j5 k k$ n5 H- P - dma_addr_t dmaphysdest1 = 0;7 H, A( V) {5 Q) K' U% e6 I+ ]+ y
- dma_addr_t dmaphysdest2 = 0;9 c3 c; ~) s, Q/ u+ ^. g
; h- x3 j, P, F- char *dmabufsrc1 = NULL;8 L, q; P% a% E7 D0 q
- char *dmabufsrc2 = NULL;/ N' u$ M# X% ?; g$ u( S, M# f
- char *dmabufdest1 = NULL;
. T2 Y. B1 j# p+ Y$ O - char *dmabufdest2 = NULL;8 w* `; x5 Y* h) h6 q2 D3 s
- ) [4 b+ r q/ W3 m# t! V
- static int acnt = 512;1 Q2 R# C# K; J
- static int bcnt = 8;- _( Y7 z6 k! a$ @& _* A. Q
- static int ccnt = 8;
3 c$ r3 p, j* N; [$ [' x: p
8 i$ v; I0 u5 P: U0 s4 ^- module_param(acnt, int, S_IRUGO);
u: Y% @$ T% z7 r' |/ Z - module_param(bcnt, int, S_IRUGO);( b0 L- p0 a l2 E, D4 U5 Q- [
- module_param(ccnt, int, S_IRUGO);
复制代码 . W0 J9 e: ~( {+ [
# t! S; B- ]7 C, ~7 x' |" C6 ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ G9 ^7 J& {$ {: |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( A, }# W0 ]4 N* D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 F, x6 o# v7 b; ]+ E4 v( `$ i+ ~2 E$ h, M' O" Y3 b& v
: ?0 i8 w N2 u1 Z% M$ |) g* `
|
|