|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 y$ C, P& V8 S7 m6 h- [code]EDMA sample test application* E9 W: n% A2 B5 }; W
- /*
; J, Q. i+ E+ r- Y - * edma_test.c
$ c, C( q8 J; C: ~ - *4 q2 |7 w2 [- ~" s2 G( L- d
- * brief EDMA3 Test Application
- `3 S/ y& E; k4 v - *
% c, w0 D( `- I* T7 y/ N - * This file contains EDMA3 Test code.7 B( S: {# H- i
- *
, z* }$ S; ?# d- n2 r7 | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( F; u2 ^4 l0 O. n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 Z( q4 A0 B* R" \ - * TO CHANGE.9 T2 a" ^6 o7 j# R3 _) E ]
- *& M7 l4 p+ ^/ |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 m. z, h1 r1 O, s+ K! ~
- *
6 Q, u( d' f/ O: P' x* e - * This program is free software; you can redistribute it and/or0 M5 G9 e$ L/ B* {
- * modify it under the terms of the GNU General Public License as
! n3 ~/ W, h0 b& C - * published by the Free Software Foundation version 2.9 D% }4 g( p3 Y8 j2 p
- *
6 X; U4 y6 C0 k* f& e, {; o( U( s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# g. N/ y+ I) w, v - * kind, whether express or implied; without even the implied warranty, y+ _5 |4 V4 X3 c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, O7 U+ y4 x4 v3 R' U
- * GNU General Public License for more details.
- o( v0 E x# A - */
! C. T4 G; P5 z- C - , o7 t, N/ h' J1 w3 I
- #include <linux/module.h>
7 ?/ ]9 p% d8 W0 P" ?% L" \ - #include <linux/init.h> S7 |5 |" {5 t6 k: Z
- #include <linux/errno.h>
/ V1 q+ ]- X2 u$ f - #include <linux/types.h>3 q, R7 ?9 q* m* D: N% }
- #include <linux/interrupt.h>
# V* k& e: @3 t: s& u) n - #include <asm/io.h>
2 u; O' {5 Y( r* k# ~' D - #include <linux/moduleparam.h>
9 S2 B( c' \1 o u - #include <linux/sysctl.h>
- V, S7 g1 r7 B8 L. m% p6 T/ ? - #include <linux/mm.h>
7 N; O, R7 _9 L" a - #include <linux/dma-mapping.h>7 k) K* I( ^3 E" C. P8 T ~; u
- 5 Q' k9 U8 C* Q5 Q. k0 Z' e! a
- #include <mach/memory.h>; S6 [6 s, _; J' H$ a( [; X$ V
- #include <mach/hardware.h>
5 U) V( O2 k/ u) g0 R) @ - #include <mach/irqs.h>4 E2 A; F4 ^+ D! C
- #include <asm/hardware/edma.h>) b, @( z5 q* u2 Q. ]' p( v
% x. Y. k2 ~* E* S- #undef EDMA3_DEBUG
; q0 D& O5 T$ c" ~. Y; M - /*#define EDMA3_DEBUG*/: h) ?/ @$ d" |! E6 [6 x
- / j- j6 ]" Y, Z5 ^2 ~
- #ifdef EDMA3_DEBUG4 `" f( Q# d' V# p, @3 C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ A9 U8 j4 {3 n3 s7 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ M* I- r6 l/ z9 e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 E+ J& K; V2 w# D) q) e
- #else6 L% Y) `3 L5 ?8 ?: u
- #define DMA_PRINTK( x... )
1 u" C% M4 k% v, d7 A) @8 @' h) R - #define DMA_FN_IN
8 Q0 C4 s4 m8 F) L, n' E0 h - #define DMA_FN_OUT) {2 C* D+ E8 G+ q" s: i9 L8 r
- #endif6 t$ }; s6 q! X/ a- m
, w! C8 l( F' v t8 Z; _' b" j$ b* |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 @/ C+ v4 ^7 K1 T0 y - #define STATIC_SHIFT 34 F% N/ Q7 v" U$ y3 A- k
- #define TCINTEN_SHIFT 208 D. B( r# j, \8 k b; w, q
- #define ITCINTEN_SHIFT 21
7 M. |4 [1 f9 N7 J ` - #define TCCHEN_SHIFT 22
& M. W; k% V- o4 M u6 |* U6 k4 g - #define ITCCHEN_SHIFT 23
3 h7 W8 p! X5 c1 }
; Z6 P' r, l# Z$ c2 o- static volatile int irqraised1 = 0;
' X5 R" s$ i9 I" ^' q% b# e - static volatile int irqraised2 = 0;
3 f) z J. ~; d
2 T6 U1 e9 a# ^- P1 z" r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 K4 `( K, G8 I- p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# S- H4 i0 a6 S& q. Q" c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Q! x* E6 D1 i; S: Y6 U1 W6 r
5 c3 F1 t" O1 r9 {9 L: {' t# ?- dma_addr_t dmaphyssrc1 = 0;
$ I2 I' i# y" M/ l5 P! \ - dma_addr_t dmaphyssrc2 = 0;
4 L; E1 A/ V" j) e& g' r4 Z2 o C - dma_addr_t dmaphysdest1 = 0;
- C S, s* B: |7 ^5 i3 v - dma_addr_t dmaphysdest2 = 0;$ C# U; i/ I n3 e! W0 e! K n
! A: z5 B2 ]- l' E* ^- char *dmabufsrc1 = NULL;
% w/ ?3 [ l3 U+ y - char *dmabufsrc2 = NULL;" f# M3 u- o; P# ^
- char *dmabufdest1 = NULL;
- `1 _* j5 ~* i - char *dmabufdest2 = NULL;! s( L: t( `" ?/ p; [- B
- ) A+ @. H/ J$ ?) k6 J$ [4 @8 Q# W
- static int acnt = 512;
2 X Q6 d1 d# J1 o - static int bcnt = 8;, A/ b- {+ ?+ C% [& B
- static int ccnt = 8;
5 ^; a" Q1 W" A, d* q6 `0 [% Z
% v: n, u2 m6 [- module_param(acnt, int, S_IRUGO);
8 l, n% s9 h& ^+ F5 O0 G/ X# e - module_param(bcnt, int, S_IRUGO);
! H- C% f5 X q3 ] B! _ - module_param(ccnt, int, S_IRUGO);
复制代码
8 R: `3 \2 Y" P+ `1 C8 Z" K1 B$ Q, O
! l8 I, |/ s# [/ `" J* _# Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' \5 h) L$ r' y J" H3 j% tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 v7 D9 Y; A& v2 f; H) U* | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* g5 e. _' E6 I0 K. C% O; R
( }' h6 E8 Y, e7 j, [: L: |8 u: L# t6 s4 W% {9 g
|
|