|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. H) Q5 m! z$ X- [code]EDMA sample test application, l5 K2 H4 v! g8 ~; p
- /*; m# S( ~3 u+ Q' ^) b$ X
- * edma_test.c
# ] U& [& Y( ~, D% z4 F2 @ - *
. F- u6 a$ K6 [& y: Z# Q' L8 k - * brief EDMA3 Test Application
. Q$ M8 D4 T- Z9 B* {' c - *
K! T) \& M3 G; i: a - * This file contains EDMA3 Test code.
( D, d: h* l. j- M( l - *, r; ]3 c) _3 M; N& r7 F, ~% t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* V- L: P: R! O& K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" K% R% h3 p7 O* t9 Y - * TO CHANGE.: t8 ^+ A, |% z+ p7 ~' D5 ^
- *$ J/ g m( ` a" x6 c# r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) O) R6 ?1 W+ N: r' n, t2 p
- *; c/ ~& A9 w( n. \
- * This program is free software; you can redistribute it and/or- U& H1 U: o' \2 m" o! l _0 m
- * modify it under the terms of the GNU General Public License as
; @$ Q' `5 `' i {4 p0 j - * published by the Free Software Foundation version 2.
* o! A4 ~+ \# X- o - *" E0 B A* T5 o- R; Q$ F/ }! D$ V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' V5 T0 X; ~/ b2 L9 J
- * kind, whether express or implied; without even the implied warranty, t5 M8 y5 n# ?3 k: ~0 y! J- c F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 z# W. u" f. |1 k# M - * GNU General Public License for more details.' P9 C1 I4 \7 F$ S
- */
+ F; y+ }; J1 K6 C% t+ o - & E% k q6 ]* U
- #include <linux/module.h>
% t# I. z( ]" } - #include <linux/init.h>
) j9 e" Z" j: ]. s( X - #include <linux/errno.h>
- g! y9 F% h( F - #include <linux/types.h>$ E! j5 K b, h2 R6 G
- #include <linux/interrupt.h>8 v4 S9 w( k& u2 e7 G
- #include <asm/io.h>7 G- i7 f) D9 ?* l/ b1 w
- #include <linux/moduleparam.h>
" I$ ~0 K* Q% t - #include <linux/sysctl.h>
3 ]) J2 s& T* Y3 X+ y; s4 @( h) n$ ] U - #include <linux/mm.h>
" p5 {9 L t, r3 w/ [ - #include <linux/dma-mapping.h> ]1 L4 p, }- I
- / u8 O8 o0 f# E! c" z8 ~' j
- #include <mach/memory.h>2 V5 n+ @' L6 z8 t9 R
- #include <mach/hardware.h>
, H0 X3 u5 B. ?1 u. ]3 r& Y8 w6 K - #include <mach/irqs.h>
+ p/ J3 c9 b Y' s x% ~' T9 m - #include <asm/hardware/edma.h>
, P, Z! v8 Q$ o5 j% e% }! O - 9 U" y6 L: F8 o" E% v, ]9 L
- #undef EDMA3_DEBUG
p ^' u, [2 D0 y( N' S& O - /*#define EDMA3_DEBUG*/. O: |( W) h4 [$ g) X3 E
( x1 W3 |$ ]/ J+ ?# ~- #ifdef EDMA3_DEBUG3 b6 w* r# c& s7 X5 q6 ]+ J0 j0 g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( O" V) y [3 n% R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( S9 g3 e$ F- j3 @8 M5 Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' R' F. C& [; P. V - #else
: I% d6 J& X3 J2 \8 l - #define DMA_PRINTK( x... )
: ^. Z* d3 G3 _0 }4 t - #define DMA_FN_IN
" E7 F# A9 ^1 e, L( V4 A0 d6 K - #define DMA_FN_OUT. d0 n5 G. i! R5 j* P* d) _
- #endif
0 P! K: t: i; g* @8 u3 r" M% ?, P - ; r/ K4 F4 f7 m- k0 l/ J* Y7 ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# h5 r! b) k5 q: t - #define STATIC_SHIFT 3& F* E- ~. s+ h/ \
- #define TCINTEN_SHIFT 20
$ \, q( H2 D, Y0 D - #define ITCINTEN_SHIFT 21
1 m* G, j. ?% b! `+ | - #define TCCHEN_SHIFT 22
8 A M' J; r, i" G' b% F - #define ITCCHEN_SHIFT 23
9 y& R+ ~8 L6 ?0 }8 X# n - + _% P5 h% ?6 ^$ k, s: ~9 V2 u
- static volatile int irqraised1 = 0;+ C1 U; I1 q; {1 T: L+ R: R
- static volatile int irqraised2 = 0;8 ~8 q! o+ b) D& a; O
- 9 |& U8 Z8 ?" B# w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 m( b/ R3 }+ b$ B( S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ?7 C1 K$ K4 M- C' E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 v+ }( Q4 S6 t5 y0 q( [! [. U& Z: f: p3 t, z - 2 }2 t! ~3 x+ x8 A1 y! f8 I" D
- dma_addr_t dmaphyssrc1 = 0;0 t3 V$ D8 T w" ^& n, ]
- dma_addr_t dmaphyssrc2 = 0;( L: t0 d3 Q8 y b7 L4 b
- dma_addr_t dmaphysdest1 = 0; I* e# m1 e# `( c! d6 i
- dma_addr_t dmaphysdest2 = 0;/ @/ ]0 T& r/ N: w/ D, n
- " b2 r; I z: M" l
- char *dmabufsrc1 = NULL;
& x8 v! D* c( t" ? - char *dmabufsrc2 = NULL;+ G8 ^/ p5 T0 S# P0 d0 d# a0 F* c
- char *dmabufdest1 = NULL;
- {( U! s; B2 t+ m; c# o! b - char *dmabufdest2 = NULL;& n- d: q. G; N
* m$ T: L% J& }- static int acnt = 512;
" d( j. U) T% k! O, e2 G - static int bcnt = 8;# x# S$ E8 S5 M, H# Y9 }
- static int ccnt = 8;
+ _5 [, O' E3 R! E3 A: k5 T* y9 B4 {5 }
$ \; L- O+ n" u! u% s/ x: B- module_param(acnt, int, S_IRUGO);
4 v" y/ \/ e2 `: [. @ - module_param(bcnt, int, S_IRUGO);
2 A. C8 {6 M1 q% U3 B$ V - module_param(ccnt, int, S_IRUGO);
复制代码 % L0 Q2 V, I' L
6 b/ \& h+ \' O* H% M' {1 [% H7 m H, f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. R7 [! v; |+ d5 w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) |! d$ y. g& S! q: T9 c" y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- P% r* H5 m. X2 {4 B9 Z' |4 m$ Z5 m& R; e
9 S! O* w" B2 I* q& W |
|