|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 B: F2 v0 I$ U$ [) T! X
- [code]EDMA sample test application
9 B* e6 |& i5 `3 B9 W3 A3 n6 L - /*" Q7 d' ^- Y9 q L/ b
- * edma_test.c9 ]* p* g! `' Q4 G ]
- *. S5 Z! W1 _" Z
- * brief EDMA3 Test Application
Y% F' h) j: o) l2 K - * j/ \7 u& P1 e6 k, ]
- * This file contains EDMA3 Test code./ W3 y5 v4 Q. m" {: X4 b+ {
- *
6 n: b4 p0 o7 n6 d$ V* J) V* U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 D4 i& E( O# ]) ]# `0 W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) w1 _0 y% M: u2 [ - * TO CHANGE.; v, ]6 e1 d% \! w, ^# J
- *) S H6 X4 ?) f6 K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: V/ R" E8 b T" N, ]4 U
- *
1 K4 E: P, ]* ^8 j/ [ - * This program is free software; you can redistribute it and/or
4 `2 h5 j6 l3 I' S, B - * modify it under the terms of the GNU General Public License as
! K* C+ [/ e9 Y7 _) F: N - * published by the Free Software Foundation version 2.
3 w4 {# A: {8 y& s7 W/ C/ U - *
- k, z. P Z# @1 H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, @5 C L; a' [
- * kind, whether express or implied; without even the implied warranty
) D+ ?' L, a. ~8 j9 i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! K/ Z" ^& `2 `1 a( \6 X" t - * GNU General Public License for more details.
9 `! _# X/ B' V( ]. M+ g: Y4 r5 { - */
7 \; Z. I- F) H5 s
. Q s J$ G1 W' g- N+ J+ X- #include <linux/module.h>
& i& `6 i7 Q! B* T9 F/ q - #include <linux/init.h>- A5 C1 u. q9 y" P
- #include <linux/errno.h>
( a3 ^& Y% @9 l; C4 c - #include <linux/types.h>
- }, K/ r2 W5 F4 B - #include <linux/interrupt.h>
2 j3 r4 A7 I, s( m+ X - #include <asm/io.h># A1 Q: ]& K+ j1 D3 u& i% C
- #include <linux/moduleparam.h>
7 y4 T! N) A( p - #include <linux/sysctl.h>
$ n6 W. F' Y, L3 D - #include <linux/mm.h>
7 [# C x4 A5 m H - #include <linux/dma-mapping.h>
# m; |4 K, y: w# N9 U u: Q - , G: o! B: k4 {
- #include <mach/memory.h>
/ i% u& L8 _& H - #include <mach/hardware.h>
, d' b* \' T2 f8 l& C ]( K# L - #include <mach/irqs.h>
6 D3 p1 W6 V- K$ t: \ - #include <asm/hardware/edma.h>) [% N; z+ u* B r- e2 v6 h5 A2 F! y
" D3 m/ @. @, T+ y$ X- #undef EDMA3_DEBUG$ N& w3 c+ D6 N+ w
- /*#define EDMA3_DEBUG*/
+ H. Q) ^/ E, i: p
& ?4 F" F: D" l- j6 }4 V- #ifdef EDMA3_DEBUG$ r) u3 c- P' e' K9 P- M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ A3 l# r! y1 ^0 I; t+ H3 r9 ]$ ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ [+ U# U/ _$ H* i# m! } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ O1 f+ o5 V0 f( T
- #else
& i% L% e O, H9 X3 D - #define DMA_PRINTK( x... )
" d5 T6 h' C9 G5 u/ | - #define DMA_FN_IN% S. L* H2 e- y
- #define DMA_FN_OUT' k: a4 E( @7 @* e9 o4 N
- #endif4 u. U$ Q6 ~# a. b x! c
; l" S2 {! D& Z; h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" [% a% E6 ]1 {) p$ j
- #define STATIC_SHIFT 3
6 g- l9 x% C) M8 k6 U - #define TCINTEN_SHIFT 20
1 j+ I# E2 S+ A% M5 d - #define ITCINTEN_SHIFT 21# N( b/ d8 r" ]1 ]0 o9 M8 z0 y
- #define TCCHEN_SHIFT 22
' L" C3 {3 f7 |' r2 ^7 @ - #define ITCCHEN_SHIFT 23
$ }0 z f; |% g$ ?/ q - 5 d, `1 n4 m4 S! z+ q
- static volatile int irqraised1 = 0;8 X& k9 @2 B# E5 d V. O
- static volatile int irqraised2 = 0;# [" j- o7 e" y% E: v
' U2 C$ D+ b# @0 y1 ], C7 M; R8 B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 r, y0 p/ V0 [; T2 w+ ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. n C7 M. _4 |/ H. ~: n) {' E! |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 r& c8 `3 d$ ~& {+ j4 P
! O2 E: B4 O9 x: X- dma_addr_t dmaphyssrc1 = 0;
+ Y- t1 Y4 b9 d9 u - dma_addr_t dmaphyssrc2 = 0;
, w: n- L- \8 X% w - dma_addr_t dmaphysdest1 = 0;) C. }' F& W$ k; W6 U/ V, P$ a
- dma_addr_t dmaphysdest2 = 0;( \: N% I* r9 Q' h$ J
5 W, N$ E* U" n% l( R7 O! X5 K- char *dmabufsrc1 = NULL;
7 s2 P0 J& \3 b. J. | - char *dmabufsrc2 = NULL;6 J4 `9 M0 }, e+ q2 t" R$ _
- char *dmabufdest1 = NULL;
; U; f' `: \' y# p/ { - char *dmabufdest2 = NULL;1 Z; X6 h9 Q' ^0 W1 p% ]2 ` s
( d3 s W/ V; A- static int acnt = 512;- ?$ |( ?* I0 N9 ^- r) p; _8 N
- static int bcnt = 8;; p; G4 X1 @$ v& U7 G
- static int ccnt = 8;, T6 @4 I+ P" N
6 C4 L; v- l$ U" z; W# H- module_param(acnt, int, S_IRUGO);5 a& n a3 _4 ~* O7 q+ r
- module_param(bcnt, int, S_IRUGO);
2 p$ e h% Z+ d; B& G5 C6 N' b2 v6 V - module_param(ccnt, int, S_IRUGO);
复制代码
3 m- M& U1 k# ~: T: \% m: p
' e5 u% M7 N. J' M0 f: ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& C9 z8 n% w! A/ A' i# V1 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ q( G8 A, m3 _: P% m! @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ v1 b/ E) M8 F0 s( D
9 u. ?3 {. l& p& A# E) k% Q5 Z' E% ?) C
9 {: i5 `. |5 W9 `" s" t
|
|