|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ _1 s2 C( @. P- [code]EDMA sample test application2 ]; N( V, c9 j0 h
- /*; r, R4 {5 T3 s; V: @% H( u
- * edma_test.c
" o, T6 K, u: u9 l) }0 I - *
# B, {$ V. r8 {5 D2 f - * brief EDMA3 Test Application
& k* a& x- J9 ]# @4 t- w - *
7 C# b- m) U1 A& F+ M - * This file contains EDMA3 Test code.
- d! R8 w% a2 O! l - *$ e6 d% n9 f5 ^' u5 I" }" g$ u5 ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! m: I& w; ^) l! C6 B0 E: P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: ^9 \! N5 K' Z
- * TO CHANGE.6 E' D6 n: ^7 e9 D" D; P
- *, C/ @* M2 t) s C' M& y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 O( f2 T& x }/ B - *
! O+ }, B9 P x6 _ - * This program is free software; you can redistribute it and/or
], b& d# u+ S r - * modify it under the terms of the GNU General Public License as
+ z6 W4 B4 ~+ K) p3 ]( B$ _* T; E - * published by the Free Software Foundation version 2.& Y9 O. `. A- H: ?, N' y% w; F
- *
$ I/ W8 a# V1 P/ [% I% L: H" p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! o+ O( f' ?0 B/ S5 O
- * kind, whether express or implied; without even the implied warranty
3 [0 D% o9 W9 O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ [' [/ B0 ]7 l4 V
- * GNU General Public License for more details. T4 k/ d* @* a# L! {. `! i5 f) \
- */, K- N: p# Q1 ~5 t' |. z
. J: [' B1 E# S' |! H/ \5 X: I2 _6 i- #include <linux/module.h>8 Y& }+ n3 G1 K$ b" V% _ X
- #include <linux/init.h>- Y9 Z( N+ _: a8 g8 | X
- #include <linux/errno.h>. P, Y: n( ]! `: O6 n' B5 F8 \6 }' N
- #include <linux/types.h># h& @! v, d/ w& [! P0 F, _
- #include <linux/interrupt.h>
9 l1 ^: x- t/ D# A. k6 \9 A& x, d, @ - #include <asm/io.h>
2 I6 ^. D3 |% ]1 ]7 C* \ - #include <linux/moduleparam.h>% W0 h* _) }/ W8 `$ x1 `3 m
- #include <linux/sysctl.h>+ g1 x+ M* K" ]+ k3 s
- #include <linux/mm.h>
% w4 }, S, s# C/ ^ - #include <linux/dma-mapping.h>
- ~5 M* Q! ^/ E* N' n$ r - * w* N7 N7 Y2 |) |8 ~5 x9 j' V
- #include <mach/memory.h>; l m/ e) V) S3 s. j, ^9 y# \
- #include <mach/hardware.h>
8 n4 P/ ]% N" r/ v- t# Y - #include <mach/irqs.h>
) r3 K/ Q8 s k, }4 C - #include <asm/hardware/edma.h>: l& q3 J4 p' `7 `+ h! r
3 p& G8 Q9 |. V5 k- #undef EDMA3_DEBUG
# I7 C+ D0 o% i0 k3 e - /*#define EDMA3_DEBUG*/
( O9 t. q, k+ K! j) a# z - ) ~$ P2 D" u/ w- i
- #ifdef EDMA3_DEBUG
1 s9 h" z8 X! J! X+ q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; U5 y( P6 ~3 W! G5 L- Z+ R2 j8 { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 w$ _1 u. h! i& k' ?9 c3 s1 w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ n' I+ c6 a% B0 X# u! Q. Q/ T
- #else
3 i; L5 q% z5 S7 W - #define DMA_PRINTK( x... )
6 ?7 d% o; k& K9 e) h; A( x - #define DMA_FN_IN/ B% p- S/ C9 p- x: N) `' z
- #define DMA_FN_OUT
9 h2 Q/ S8 R8 p4 w9 R& j: W; ? - #endif
3 ]4 b @7 v5 ~: W! m, Q
# m: J# N1 s I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 v4 D, O5 u I3 P" i% K - #define STATIC_SHIFT 3
' k( I0 d, z6 X4 o5 u - #define TCINTEN_SHIFT 20# }( {; [! c6 Q
- #define ITCINTEN_SHIFT 21/ p% K: E) u- t9 C/ e2 l
- #define TCCHEN_SHIFT 22' d6 H6 e: l9 @+ j+ q
- #define ITCCHEN_SHIFT 23
" G+ t' U( q# U9 N2 L( b* I! r
b, @& p: v8 ^' b7 Q/ ~- static volatile int irqraised1 = 0;
3 B4 Z9 a0 z1 I2 c - static volatile int irqraised2 = 0;5 ?% V5 d4 O' ]0 k4 J8 W% _
- 6 p8 t8 y5 u8 `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* X- q& g( j$ V- X, Q5 F" w, X# ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# x G8 Q* h4 a, I' R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ U6 X5 c3 W3 o5 ], R- H
6 N+ G" S$ A. w- dma_addr_t dmaphyssrc1 = 0;
0 p& P- Y6 Y; R, O/ i0 e - dma_addr_t dmaphyssrc2 = 0;
/ N% T: g$ l% h F! \' w& | - dma_addr_t dmaphysdest1 = 0;
' B/ z, p, e* C7 e% f - dma_addr_t dmaphysdest2 = 0;
! O( n9 _# v; F* N: F0 D, T
( v9 n+ ?1 P V- char *dmabufsrc1 = NULL;
5 G7 i! x/ I" s) _: c - char *dmabufsrc2 = NULL;
6 d. y. {0 U: ?: r- a - char *dmabufdest1 = NULL;
7 P- h3 ~4 q5 w; ]* t/ \ - char *dmabufdest2 = NULL;
2 H: E& \% w2 v- B; e8 j8 U - ( I! h1 u3 v4 B. }2 D
- static int acnt = 512;
& p' c0 C! r/ y/ L - static int bcnt = 8;
8 j @- j- `3 R4 }: z - static int ccnt = 8;
8 f1 t6 D2 r+ r0 P ? - ' h! R8 U8 u x4 r
- module_param(acnt, int, S_IRUGO);( F% C4 z2 Q5 E7 Z
- module_param(bcnt, int, S_IRUGO);1 @. X; V$ o7 s# J. }3 B. w
- module_param(ccnt, int, S_IRUGO);
复制代码 , z' v# r( o# |7 ^* f* ^. o
2 b5 s( M, e9 A. e7 E1 w1 A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 u9 [* G- p5 f8 t& Q/ Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" j% u5 a- a! s% m& w* _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ G+ i# v% W- ]& P. B% i( g* k/ u* c4 Z4 D$ N- L5 B& i- d0 K3 ^
: s, [& L6 a- r& B8 C2 d |
|