|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + Y8 u F4 ~' }& o* ^: N, {
- [code]EDMA sample test application
% G9 L$ J2 L' Y1 l( H: ]2 B% I/ N - /*8 T4 M: Q' Q3 R' g2 R
- * edma_test.c3 f: k3 _! n- R" w- C- Z
- *
$ C I9 `; [% r& S# u. Q% l - * brief EDMA3 Test Application j) ]" o/ A! r5 X, g- j. d* L0 ^: [
- *
" j( b9 ~8 H5 y0 ?( Y. \- a$ n! F - * This file contains EDMA3 Test code.$ R% i" `- ?2 j X4 D/ n
- *
( \; S* I1 Z: n/ p$ v( { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 r# i' k& b7 ?7 D; @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: y. F8 d$ N1 Q
- * TO CHANGE.
( j8 s' o7 ~0 b% W x- e9 q - *- X' S$ a2 |6 ^7 o3 A3 f5 n. f; U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- a# Q* ^$ q6 F" ?; J0 {. i - *
. r/ V K# K p1 j - * This program is free software; you can redistribute it and/or& k {+ Q$ J# I7 q+ m
- * modify it under the terms of the GNU General Public License as
% _+ _ y4 R; U1 P W! L2 p8 G - * published by the Free Software Foundation version 2.
# j0 m# [+ E, {0 O) c - *
+ ~, r3 e: W; n& M8 E3 ]; x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, F' _% s- d8 n3 h3 v - * kind, whether express or implied; without even the implied warranty
, Z L5 ?4 Q" e" t5 T; A1 F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& \: C. V4 X) v7 e" u - * GNU General Public License for more details./ Q+ z1 r+ w7 {0 a* ^5 V
- */% R" s2 \' w$ X$ t7 q7 o3 L
- ; y/ R# h' q/ p. H$ V
- #include <linux/module.h>
5 A. P; y7 q3 c% |- Q/ m. E8 m - #include <linux/init.h>
- O$ v! `& |) \$ ] - #include <linux/errno.h>
( k7 R: j% B, W# c+ e8 ?* [5 e* P - #include <linux/types.h>
H# U9 ]0 [3 [ q3 h# F8 L - #include <linux/interrupt.h>: N# \' \, p, p; ] X
- #include <asm/io.h>. v4 \; \# `/ a$ I- C( z! X
- #include <linux/moduleparam.h>
% X' Q* \8 V" ~& n9 t) ~ - #include <linux/sysctl.h>: X* l [- Q4 G3 I7 _- p* X/ X3 S
- #include <linux/mm.h>. r1 {# a6 q6 F e" [
- #include <linux/dma-mapping.h>
+ I0 }8 n: ^- P& J; g- Z - 8 g2 \4 q( ^$ {6 ^' }0 L# _
- #include <mach/memory.h>: v. z0 c" S( b! M
- #include <mach/hardware.h>1 `9 L1 X7 A' f0 f0 d
- #include <mach/irqs.h>7 x9 I8 j% z( q- x
- #include <asm/hardware/edma.h> f& k+ S$ I! T q1 p1 z
5 ]& }# e% k; z7 {- #undef EDMA3_DEBUG$ r0 f) j% C' m+ n$ K7 S- }
- /*#define EDMA3_DEBUG*/
! o: v$ h! Y# g/ m
8 Q2 q2 o- n8 u5 r) t4 }, ~$ i. v- #ifdef EDMA3_DEBUG' Q% T- A$ ]% z) y9 i1 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 @# N- s% R+ V! U$ F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): D* u. r2 v5 o) z) R: v) i( ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), I; ~: O* r. a( p, u3 A4 ?
- #else$ ^$ ?' t" g. F z5 }) r2 q$ H
- #define DMA_PRINTK( x... )/ U j; u9 h' ~" J" M
- #define DMA_FN_IN
, E! y* [4 _6 l# M! K - #define DMA_FN_OUT
/ {6 d* a$ C8 X" M' W0 t* X/ x8 D - #endif
3 X- ~7 j" H0 c E
, D4 T) k$ t6 f: q* H2 _( H W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 k2 A6 I s& Y+ H7 M$ \, R2 x: r - #define STATIC_SHIFT 3# c8 N. o% m; w) ]
- #define TCINTEN_SHIFT 202 W) I% W5 h: F0 ]+ R. y
- #define ITCINTEN_SHIFT 21
3 {, x3 e: z4 {1 I) W - #define TCCHEN_SHIFT 22: t: q' z4 ^$ m r3 m, d5 v
- #define ITCCHEN_SHIFT 23
* a2 Y0 q& Y' P/ W& z9 J - 9 f% r' y7 S& g* H% b) x k! z4 i
- static volatile int irqraised1 = 0;) X: r* d0 c( o8 b6 @, ], k9 r$ |+ y
- static volatile int irqraised2 = 0;
& }. [7 q' m1 n, c& p, }- ?& Y - 8 Z( m: Q F& t) b/ L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
J r( K1 I: P3 k) o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& j# l Z8 }3 N1 d4 F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ a y( H) J) h) V& Y/ P
" r8 U# A; ]) `6 J- dma_addr_t dmaphyssrc1 = 0;) D4 M' @) \ O6 k4 h- t8 v+ x8 r
- dma_addr_t dmaphyssrc2 = 0; `+ I- S( T$ B
- dma_addr_t dmaphysdest1 = 0;6 R5 Z2 z! Q7 p7 e
- dma_addr_t dmaphysdest2 = 0;
/ ]( N2 v" Y1 }* o& Q9 I* U
0 H0 u3 ~& V7 ]& P& Y2 _: a- char *dmabufsrc1 = NULL;
7 n8 {9 K7 e$ }2 C - char *dmabufsrc2 = NULL;4 b" a& @" h; i- h* c9 |6 `* @
- char *dmabufdest1 = NULL;
' q$ H5 |6 e# w' x- N2 o - char *dmabufdest2 = NULL; {. H' F% r1 \, r/ s. a
! ^6 `7 c; O- F) U5 q- static int acnt = 512;
/ E9 Q' r4 l8 A W3 R- |8 ` - static int bcnt = 8;# V! w( Q5 U' z' l; t5 S( A& n
- static int ccnt = 8;
) H z) K, n: M: l$ @+ {5 r4 r - ) o% v# o) h! d/ {% P7 c, M; i, v
- module_param(acnt, int, S_IRUGO);9 F y5 P: F* S, W+ l
- module_param(bcnt, int, S_IRUGO);
6 h, _6 l* E' n I7 W - module_param(ccnt, int, S_IRUGO);
复制代码
3 w9 O8 p# D9 I, w# f/ d" n" I1 X L6 V4 u5 {: x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 L! @6 y% `! q/ {9 m3 J: M5 b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" m# H9 a3 y1 w+ C0 |& t& u2 z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' @( J, }9 [7 _, m$ L9 @# O b
. u a" ?0 |4 L3 B
0 }' D8 D- G5 ~7 M( D' J |
|