|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 H6 C( o& K8 A' _6 H1 s0 J- [code]EDMA sample test application. ]% @- B# `% B5 \' y c
- /*
' v+ E X E, J1 f7 J* I - * edma_test.c
" u1 `% r3 f# K. ?# N6 c! B - *% K4 ^7 b7 t5 B j
- * brief EDMA3 Test Application" W# t3 Z4 X- t
- *
; ]( [" T0 s% O; C - * This file contains EDMA3 Test code./ e; _# q! {9 U1 j, I
- *. ?8 s Z/ M# \; S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 K' R; s! q3 N; B1 {& d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 C/ F9 ]& S) h2 ?
- * TO CHANGE.5 k2 i* T$ y8 ]6 A- U
- *4 U6 j, l5 ]! K' ]. x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ H. h( o7 c6 V) E0 R
- *- x% U* T: Y% Z: }
- * This program is free software; you can redistribute it and/or+ o5 o; B" V, C
- * modify it under the terms of the GNU General Public License as
) I1 G- y# D7 x4 L - * published by the Free Software Foundation version 2.6 G5 b! h- N* X8 I4 H
- *
" H1 A* m' k, W7 k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 x: [0 V5 A3 v9 Z7 g: N- Z4 h - * kind, whether express or implied; without even the implied warranty7 q2 _" o z( w* W' b( m$ w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 V4 H% n9 A' B+ U8 V8 N - * GNU General Public License for more details.+ [. T- r2 K8 [7 r0 I3 @; S* K# M
- */
* V: {2 w6 _" f7 r: o2 J% c+ z/ ?$ f
& S3 A# H4 p; q S9 V- #include <linux/module.h>
5 U: D1 c* Y9 `1 g( F- H - #include <linux/init.h>$ V2 H, o; L6 N" x D; l5 \
- #include <linux/errno.h>
" k6 s! h" v. j, Z+ C& ]' _ - #include <linux/types.h>' H' z& |2 q. a i" m
- #include <linux/interrupt.h># h6 f9 G, Y) p. g. K: W* G
- #include <asm/io.h>
' Z! ?9 X! N, c# F6 V - #include <linux/moduleparam.h>7 W& e! F1 L6 }1 [
- #include <linux/sysctl.h>% |" i" x+ e5 q8 C
- #include <linux/mm.h>
8 _! z! j) \, r1 Z& y - #include <linux/dma-mapping.h>* j% W( A: {; c, M: @0 v+ V. Z9 @
+ k+ q7 ^$ b6 G( {2 f- #include <mach/memory.h>% t% M: \' `' r% L
- #include <mach/hardware.h>
7 h% a# V5 n9 y/ m6 H+ H4 V - #include <mach/irqs.h>
9 i& }' Y# u) ^- x - #include <asm/hardware/edma.h>
, ^" J0 x4 F$ Q2 S! {; s* F, l$ H - 8 o- |4 L( o. z! h9 @
- #undef EDMA3_DEBUG
" A& K5 R$ K5 n& a2 O) m4 D$ t+ y - /*#define EDMA3_DEBUG*/. H/ b5 V9 g' d& Q
3 B$ w' i) _* [4 A0 B- #ifdef EDMA3_DEBUG3 f2 s+ }/ {" h1 [4 g: Z1 u H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& d7 w8 B; h6 }* r l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 E+ R8 r; l9 S: u. Q, R3 Z& P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
x2 W5 A' Y% t1 u+ | - #else
4 E% v4 x7 ~& w* M& X - #define DMA_PRINTK( x... ); X+ d: H; d' o8 O. a" ^* s
- #define DMA_FN_IN$ y% W( Y) a, L% J! `* d0 N( F
- #define DMA_FN_OUT: C4 V' z: L/ W4 }
- #endif
1 L6 W; S$ i" ~6 @. F/ f - : u5 ?' R: R! P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ p/ E% b7 m6 b6 j( ]1 ?1 @7 ^
- #define STATIC_SHIFT 3
# l8 C9 x' s, z& h, Y7 o - #define TCINTEN_SHIFT 20
0 X4 w7 Y/ j4 e& _0 |; T - #define ITCINTEN_SHIFT 21
& H% s4 Y1 c/ @. I1 L0 n - #define TCCHEN_SHIFT 22' C' P0 B- ]( @9 E$ Y$ r* f4 |
- #define ITCCHEN_SHIFT 23
% J! h( d& Y) B4 ?6 [
! v6 S- |! m' d- M- static volatile int irqraised1 = 0;
3 I1 O7 ^; @/ T) ~ - static volatile int irqraised2 = 0;9 h6 _: v2 K2 U0 K. N6 T9 x& |) P
( K) P$ O. ~) Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* l' V4 k! Y0 L0 u+ C0 E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 d% e. d! X3 d, v' s; }( q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' ^& q9 r3 u/ l2 T5 ?* m9 Y; q" L
- + n/ ?. ~9 u2 Z7 _8 o6 J
- dma_addr_t dmaphyssrc1 = 0;: X) D/ }# e/ \. ^3 q' s* }0 {& U- `
- dma_addr_t dmaphyssrc2 = 0;
+ K7 {+ h( o' _. b - dma_addr_t dmaphysdest1 = 0;
: \# z1 m$ m. C+ s- c - dma_addr_t dmaphysdest2 = 0;2 E s# ^3 h% W( F6 }
- & |4 j u5 Q9 W" y* g. I
- char *dmabufsrc1 = NULL;
4 H% D9 }% I+ }- N+ g - char *dmabufsrc2 = NULL;4 ~" N) b+ J& [" D, S+ D) y: t$ a
- char *dmabufdest1 = NULL;" ?% |1 [) Y# {: w/ I) S/ x
- char *dmabufdest2 = NULL;. ]4 X9 n, w. G1 E1 s* |2 T
- 7 b5 r& `4 e [* k) {6 a
- static int acnt = 512;
/ U6 D1 j5 ^3 e! j1 C! z/ L - static int bcnt = 8;
k3 @# w2 w' r- y; u. x% c - static int ccnt = 8;; M' V s4 q6 j5 n1 w6 b' ?
# |) d' W7 m7 e u5 @" m, K9 Y9 h6 u/ W- module_param(acnt, int, S_IRUGO);6 f, L! L. P6 B" o, a& e
- module_param(bcnt, int, S_IRUGO);
6 @) V) i' P: T - module_param(ccnt, int, S_IRUGO);
复制代码
* B7 f$ H. Z* F( e1 [7 `" K7 N' A* Q7 D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: u, S9 J; P% m' t: c, w7 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! G# q H/ w" i+ t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* ` Q# u; L) R/ W& n4 d
' ?+ T1 j3 }6 B4 q
) M8 ?' ]& T1 N+ i& a |
|