|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + x9 \3 `/ ^2 V6 ~
- [code]EDMA sample test application9 P; q! ^5 X' e) ~' h5 v8 T
- /*
9 L! e; ], w. C' H - * edma_test.c8 @. M+ u/ X2 x$ }' M# q! m
- *5 m+ o7 e1 @! V3 v! P# q, c
- * brief EDMA3 Test Application$ G' I0 z$ f9 l. |2 ]$ d9 c' z5 F
- *
7 h6 _7 X, o! V: T: J: ?. c; y - * This file contains EDMA3 Test code.
% \/ p9 ]' e: R, P1 h! v, C4 [/ w; h8 d - *
( k% |; ^( E: l, n0 U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 D2 c$ `5 z- C9 b! l) H/ m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
t3 q% E1 F4 `1 E2 K$ z7 h - * TO CHANGE.
% K, a5 D% r! ]7 o S - *
) T1 z* x. \; o* R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 p2 ^4 L) }1 h - *2 N( D! U( ~1 D, Y( [9 t7 \
- * This program is free software; you can redistribute it and/or
6 V& L" |6 }9 x9 ^ - * modify it under the terms of the GNU General Public License as
; s4 k* ^2 C2 _( m9 d8 Y+ q: H - * published by the Free Software Foundation version 2.! r7 R) i. P9 K) S# Y: S
- *
) k9 K7 R( ~# h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 M! S8 ~( |; X2 ?4 k ?9 ]7 T
- * kind, whether express or implied; without even the implied warranty" N$ i7 t( @9 n( b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ S `+ j. R8 d+ u8 d* E) ` - * GNU General Public License for more details.
! n9 F M) P# r: \% _ - */9 g8 P: G1 a/ f3 I% J& _
- _: k- {$ Y0 {- #include <linux/module.h>% @# b* ?5 |2 s! l- K
- #include <linux/init.h>1 R# \3 s6 x' p3 X7 a$ x) S1 o- t/ J
- #include <linux/errno.h># t6 q. r6 E5 t7 F4 V
- #include <linux/types.h>
% Z3 L- x3 a |0 Z7 z g - #include <linux/interrupt.h>
5 k# f4 q* X6 s1 h' G - #include <asm/io.h>
7 s0 w3 Z" D: W! n8 h - #include <linux/moduleparam.h>5 X# \4 V3 w& ^, W8 T2 ]' v
- #include <linux/sysctl.h>
- m9 V' S; x' E - #include <linux/mm.h> v) D8 N8 P( H |+ M( @% C& I
- #include <linux/dma-mapping.h>
, ~* E. u, o7 Q6 @' ^1 J* ?! Q - - A; B: |: D) _5 D6 B. ? D" @
- #include <mach/memory.h>7 E( V2 X0 I9 g+ B9 ~' }
- #include <mach/hardware.h>
% A8 Q6 z, t0 R* u7 N - #include <mach/irqs.h>$ P# X1 L; ?/ }2 Y
- #include <asm/hardware/edma.h>
% h8 g7 |+ S; i0 r( V
V: l8 l, ^1 ?- ?) {9 w. `- #undef EDMA3_DEBUG
4 H( y# F0 V, p/ r5 u - /*#define EDMA3_DEBUG*/: F; L- z' j2 E
% ^* h: D- {$ W: ] k) b. k- #ifdef EDMA3_DEBUG$ ]5 r: n" V, Y5 K1 n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% ~; l1 ?; W1 L5 v- H* J, g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ P! |* u: Q1 t9 D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' ?/ A# D, b2 @& D% c: o1 Q5 ]
- #else
" S ~% r C: I7 n f+ e0 ^ - #define DMA_PRINTK( x... )* d6 K, t: L' g0 E7 o6 d
- #define DMA_FN_IN- j! l8 h8 p; I- o- T
- #define DMA_FN_OUT
: b2 K. {. q! A+ A - #endif. {( F4 W! U; y* E& u3 E2 W9 ~
$ o4 q% I$ q8 N& y9 f- ^# A: N- #define MAX_DMA_TRANSFER_IN_BYTES (32768); m R2 s# T0 U1 Q, E% o$ j
- #define STATIC_SHIFT 3$ d' v7 g9 t, b- e$ _# `5 N
- #define TCINTEN_SHIFT 20* R4 c {; e7 `4 b% ^8 C
- #define ITCINTEN_SHIFT 21
# z7 l$ q# P" M4 ? - #define TCCHEN_SHIFT 22
+ H; b; S/ r) V$ j# f \7 h$ e - #define ITCCHEN_SHIFT 23
2 Y; O% `* z3 r: U8 Z - : N x6 u7 y E7 j) t
- static volatile int irqraised1 = 0;" `, E; f4 D# Y2 @$ U9 D
- static volatile int irqraised2 = 0;
% a, b$ y+ ]2 O" ]0 Z: e5 h; n - 3 V0 E# k, M0 g" B2 X% j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 u6 q' H7 [' v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 n' m+ `; Z4 [9 T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! G' u' R! ], A2 `
. Q/ p$ v7 i' b/ T" y j- dma_addr_t dmaphyssrc1 = 0;1 r3 p7 K4 r# [# ?# o+ k+ f: G
- dma_addr_t dmaphyssrc2 = 0;
1 n( p' M( C0 k5 a# f* W - dma_addr_t dmaphysdest1 = 0;
0 w2 _+ g' F0 e$ ] - dma_addr_t dmaphysdest2 = 0;0 L. D7 b' m- b
- 9 r. L7 ?6 y1 u- l# s' ^# R
- char *dmabufsrc1 = NULL;. D4 ]' D: f' \6 I v5 M5 g/ b
- char *dmabufsrc2 = NULL;$ \& V, o z5 u% K; Q7 X
- char *dmabufdest1 = NULL;# @1 t& H u; K3 ~- K
- char *dmabufdest2 = NULL;) W. A9 ?- q: Q! R2 D3 d. w( u5 m
- $ t; E3 ]9 l* |7 H* J
- static int acnt = 512;
* r& x" b) q7 `3 N" N; V, N - static int bcnt = 8;
: d0 i7 X- y9 Y2 O - static int ccnt = 8;
: ?7 K/ Q/ X: s8 X- f - N2 I/ Z6 ^: ~/ c# o- r
- module_param(acnt, int, S_IRUGO);
( f! E6 S$ H, G3 F$ @- x1 c - module_param(bcnt, int, S_IRUGO);! e+ V5 K- K* d5 }
- module_param(ccnt, int, S_IRUGO);
复制代码 : x( ^7 q3 w* M- l- Z6 Q- Q+ S
& O. p( U: W2 r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ c3 ] R6 Z ]6 Narm-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 L' T* u* |/ j3 x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* @8 P& Y! a" M! e5 y; N1 b$ W; i/ O* f/ `
3 Q4 J3 \( X& U7 k6 Y' Y* @
|
|