|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) q$ B. X: O* \$ A3 z4 D# s8 D
- [code]EDMA sample test application
" V" v% F4 K! T# d1 r/ B9 M0 Z - /*4 w; v3 W# Y; ~% a8 U2 K3 M
- * edma_test.c
$ G8 }& Y T+ K! H) F - *
3 y8 n3 x/ C! ]2 c K - * brief EDMA3 Test Application7 |3 a! ~9 Y2 ?6 p7 G5 o
- *
( i+ y' ] E# \$ n - * This file contains EDMA3 Test code.6 U' S7 i5 e6 {0 r4 J
- *
6 T) C. w/ \- [; A4 ]* T8 x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- N4 z! ]# w" H1 t, ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* S# _) G0 D: o, Y* Q4 w8 U# t - * TO CHANGE.2 U7 j5 K# q, A; Q
- *
+ t7 N& E2 _& C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ S8 x3 f. u* Y5 F9 r1 G! B
- *
. \; W( j6 P* u, p; f% m( S8 | - * This program is free software; you can redistribute it and/or
5 z, S, ?; I0 F p& y# G! u - * modify it under the terms of the GNU General Public License as
5 k2 x( ^3 I) B7 M: @. Y- P - * published by the Free Software Foundation version 2., Y2 s! u! g4 s: j4 F# ?) e5 h% a: y
- *
z% }6 A0 D k7 P- b" p# q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; J# U0 ~$ J% g
- * kind, whether express or implied; without even the implied warranty
2 s7 N6 y- @9 {2 P" m/ c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, k4 D* L1 y' b, c0 m0 G - * GNU General Public License for more details.
5 q- j% Q9 i! b4 y# T: I5 w3 R: I - */; {3 _% n% o8 {: l
- 2 I" Q1 z; ~! p ?. G' a7 m
- #include <linux/module.h>
' {* P* I* H7 Z+ j! @ g2 l - #include <linux/init.h># }- }" k# d2 D; y5 _; m& \
- #include <linux/errno.h>5 F6 z& r" G; d" C$ ^- a$ i# {
- #include <linux/types.h>
. |; A5 S9 _: G6 y5 M* E3 z - #include <linux/interrupt.h>
! e" M" L4 ?0 W) Y6 m - #include <asm/io.h>
; G- N2 f2 ^2 k+ ^( \% T - #include <linux/moduleparam.h>" {! R- i% U9 s9 l+ p
- #include <linux/sysctl.h>; A0 {$ T' O r8 w7 }& h
- #include <linux/mm.h> u3 o3 d# ~) K. z+ d
- #include <linux/dma-mapping.h>3 D4 ]/ g1 z) b
- - `+ \& P" ~2 ]' k0 H
- #include <mach/memory.h>
1 F/ \$ c/ U5 o8 k - #include <mach/hardware.h>
# S' K( C1 l" @ - #include <mach/irqs.h>
8 y$ H' F2 ]# J; q# y6 r - #include <asm/hardware/edma.h>
0 Z$ j/ K0 C, k0 p3 J2 \1 d* _ - 5 G6 B$ J( g+ P& j) B4 v4 }
- #undef EDMA3_DEBUG
& r$ E0 U1 L& a0 d8 s8 D- i" B - /*#define EDMA3_DEBUG*/
" v7 D7 S Y+ j' @4 ?5 a4 R - 2 U* v4 P3 Q* |- S' r& o% W
- #ifdef EDMA3_DEBUG
) q7 _0 m% S& J# n' ~, e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ M! g. J6 L+ n( z) k" i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 {0 e5 n# T/ ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 b8 ` y8 t4 t; ~4 D( k - #else
, Y s; f0 t6 E3 O: B4 t6 i - #define DMA_PRINTK( x... )
: n5 \! o' u- x$ u - #define DMA_FN_IN' M1 [; y2 @: \' j
- #define DMA_FN_OUT# T0 q4 D# P# V X, z8 J
- #endif5 x( i8 K: u5 o+ _* Y
: q; @4 d3 U K" {3 c6 I4 H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' p' D8 W/ k* c% C
- #define STATIC_SHIFT 3
7 s# H/ X* Y. E# ?* a. q8 @( H$ @ - #define TCINTEN_SHIFT 205 L m% ^; e9 i8 P5 b9 |
- #define ITCINTEN_SHIFT 212 V3 R7 g" _5 k1 c5 }
- #define TCCHEN_SHIFT 221 N- G& U$ `6 |+ n: Y3 X
- #define ITCCHEN_SHIFT 236 k/ ~/ l( t5 D% m$ K# q
3 V0 r5 x. a6 `. O: e% |/ A$ t- static volatile int irqraised1 = 0;
& r6 ^4 O' h* V8 a - static volatile int irqraised2 = 0;
3 R5 f5 {- N y7 w5 K+ s, ]
; Z7 K% n, y2 h& s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' k$ l# o! g, M3 m& W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; N" i# C9 P L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# E0 j) E$ E/ k
- 0 G, K1 f2 S7 @! A: x A8 j. B
- dma_addr_t dmaphyssrc1 = 0;
0 e3 L6 y& W! V - dma_addr_t dmaphyssrc2 = 0;8 z% g$ n9 ]+ S9 E+ R- E$ h
- dma_addr_t dmaphysdest1 = 0;* I z+ f1 j( C
- dma_addr_t dmaphysdest2 = 0;
+ k3 J: \ K C: h0 k. S6 W- x
6 I# }% B! I! Z/ k. K- char *dmabufsrc1 = NULL;
$ I* L8 J6 }! R9 f - char *dmabufsrc2 = NULL;5 [2 V* R* I! p( `0 G' H0 S
- char *dmabufdest1 = NULL;
1 x0 S3 |( v" }' Y& k7 o5 X - char *dmabufdest2 = NULL;
/ E' ~9 d+ @" Z" d- c5 Z+ [, n4 U - 4 [. e- N: j# A7 j6 B4 }4 e- r
- static int acnt = 512;+ j7 a2 J- e T0 z! J' G0 _' v2 |
- static int bcnt = 8;
# B1 V! M5 r; G1 U - static int ccnt = 8;1 G* L* I6 J! z! e1 S
- " w+ a* E/ Y1 j% r+ q
- module_param(acnt, int, S_IRUGO);
3 u( @" _0 ?% w7 D - module_param(bcnt, int, S_IRUGO);4 D& g- [" j( B
- module_param(ccnt, int, S_IRUGO);
复制代码 , L" z- s0 Z6 a) M
& t5 a' A2 L: L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, ?7 r; _2 G% [' \7 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' D1 W T. Y; K( I1 k! V% t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ z% z5 |7 V7 P; }. ~& A: z0 k9 e+ N) A/ v# N8 D! U; r$ ?3 h
, G ?3 h( ^2 k* c: f0 I& {- H/ M |
|