|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( i' n1 {) {0 {0 E2 [. a; E
- [code]EDMA sample test application/ n a( R6 T- Y* G
- /*
, ~! q4 w3 D: x( s6 n; s - * edma_test.c
- F8 f! k8 @7 D! r2 [9 N - *, a2 Z2 m& W, @6 k4 n- N5 p0 t
- * brief EDMA3 Test Application
( V9 K# ?/ A. g+ t l- d, h, ^ - *
2 [/ E" G7 X! r) W6 x! A* s) [0 P - * This file contains EDMA3 Test code.7 D) U& s/ C9 ?+ i4 K
- *0 [: W* \$ N* M/ L1 ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 q2 ?% N5 B" v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 a2 d$ |9 M' w8 d( `7 w - * TO CHANGE., U9 ^% Q1 g" w! J( J
- * N2 r9 U4 A# M% A: ~" i. t5 e6 @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; P& U6 Q r6 c7 O0 k
- *0 P* n# F |5 k Y; u1 ^' y
- * This program is free software; you can redistribute it and/or
4 x# [) m$ B# v6 M% Q+ M: r - * modify it under the terms of the GNU General Public License as' ~2 N0 s( ? r; ^8 \1 f6 B
- * published by the Free Software Foundation version 2.
$ ^0 w6 k, L/ p9 N - *$ Z5 I( R; W8 X Z$ d3 ?5 `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ v$ i7 a" ?5 s. @' T9 R - * kind, whether express or implied; without even the implied warranty+ c% T# ^; L0 r9 P9 a. h% O+ u, B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: j$ u3 U) d; A5 t - * GNU General Public License for more details.+ U! ]& [' @* H
- */
+ [ {/ |2 f- B
* k' t0 p( G2 o/ \$ e; B4 v- #include <linux/module.h>) @" ]1 q: I* W& q9 L( s3 R
- #include <linux/init.h>8 G! V+ R6 z5 f
- #include <linux/errno.h>
5 E6 l4 z3 Y. a% N! N - #include <linux/types.h>
$ I) v- o& x3 J) o: w - #include <linux/interrupt.h>
1 ?! H* U- w* |: A: r - #include <asm/io.h>
3 r i/ ?# d8 \; |, y! @+ k - #include <linux/moduleparam.h>
: J2 h/ ~# W' B& U7 V - #include <linux/sysctl.h>
& w1 S) {) m0 |: W5 j - #include <linux/mm.h>8 R$ ]6 t3 Z- Y+ d4 [% F( w
- #include <linux/dma-mapping.h>
" ~" k0 B: R6 i( u- H1 @! i6 u - ; d6 g+ D9 |. d: R% @
- #include <mach/memory.h>
i0 A: r6 j8 a' ^ - #include <mach/hardware.h>- ~0 \9 D8 t+ S) R
- #include <mach/irqs.h>
& T) F: F: Q# T8 j; O2 b - #include <asm/hardware/edma.h>
$ X. X4 B, N7 `$ e) `2 N( w - ( Q3 F7 x9 Q! e
- #undef EDMA3_DEBUG' W* Z7 g6 t2 h& L# i
- /*#define EDMA3_DEBUG*/
2 D$ O# Z# `* W* w
; U7 r+ F0 o& p8 P o$ E- #ifdef EDMA3_DEBUG
# A6 q' i2 x! D, _- H7 z/ @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 ~' ?" K8 H0 o0 @4 w G- P" z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 s1 I4 n( O5 B% V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ M3 g. m4 C& e; K4 H- T - #else: b( R9 Y2 f; A( {
- #define DMA_PRINTK( x... )- O8 a5 @* T! f0 B6 C0 |
- #define DMA_FN_IN. _6 I; U/ ] H* W$ \. m
- #define DMA_FN_OUT
5 |) G5 ~3 c& o: `. _- W3 O - #endif: O7 P/ ^# e+ c
1 ]- f4 @0 m% v) W) o f9 Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
h& ?5 K( }' l3 d) g. x+ d - #define STATIC_SHIFT 3
) X9 Q5 y4 @1 X7 ?9 w8 c! a - #define TCINTEN_SHIFT 20
; K6 I) f% I3 m - #define ITCINTEN_SHIFT 21
6 \! r8 e, G `# a - #define TCCHEN_SHIFT 22# o$ @" R9 ^# B9 ]
- #define ITCCHEN_SHIFT 23- {+ u* f3 F3 s: a) V
+ A1 p- L5 ~* D' Q4 h- static volatile int irqraised1 = 0;
) R, V, g! Y+ B* f5 e- b - static volatile int irqraised2 = 0;7 a+ f5 l5 K3 u0 w; u
, K$ ]+ q! T5 s5 Q5 [% j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ _0 L7 O/ A# m% d, B( `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 i- ~% P" `2 Z- B* Z# s: c2 D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 S0 _+ o7 Z t0 S: U
. {. z' l+ F* _4 v" H0 M/ K+ ]4 k- dma_addr_t dmaphyssrc1 = 0;0 j; _3 a2 F, i- {' T+ J: o
- dma_addr_t dmaphyssrc2 = 0;( N( _- ?7 U- ~7 K/ o, p
- dma_addr_t dmaphysdest1 = 0;/ ]3 @. G) d7 q K) ^6 N
- dma_addr_t dmaphysdest2 = 0;
$ \4 c9 v4 d5 M6 a0 w1 i. {+ ] - ) Y f: Q, Z8 j% o3 M% x
- char *dmabufsrc1 = NULL;
! ^3 ~* o a7 z8 p" w j) j - char *dmabufsrc2 = NULL;
' Z2 K5 {7 u9 J% w6 t% q - char *dmabufdest1 = NULL;, f, Y0 g* f: t1 P7 m8 `) y7 C
- char *dmabufdest2 = NULL;
1 U D, ]6 e4 D
* M/ f; Y* p) Q+ S4 j, U- static int acnt = 512;
2 z/ `9 X4 X% V e6 k0 u9 ^' g2 x - static int bcnt = 8;' n! j7 l: ?) l# l
- static int ccnt = 8;
% p+ b3 y9 i- B5 a) ^4 M
; P& K% t5 [, J. j- module_param(acnt, int, S_IRUGO);+ s r3 n! J/ P2 t; S" K- }/ j
- module_param(bcnt, int, S_IRUGO);/ x/ s+ R0 f" F' D \& a Z
- module_param(ccnt, int, S_IRUGO);
复制代码 / y. F8 Q' n2 a6 e# O
; ^$ e% `2 ~0 J" q7 V3 U0 W: z2 m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, Z/ ^1 _1 T9 f7 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 S8 o; F- A6 \% o t* j" l! y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 q# T! g; V* d0 M
7 J" t/ [1 D2 O5 i8 l/ m8 _
+ s+ M/ K) `# ^# N3 C
|
|