|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ M `: t; A9 q0 w; _' Z- [code]EDMA sample test application
- F/ f/ ^2 L0 Q# _7 ?5 a& v - /*
% u5 u3 w3 {! ] - * edma_test.c
& u: f5 y3 I( T" o - *: m/ O! h/ p( v' t' v( g
- * brief EDMA3 Test Application
8 c' C. r, q9 n, q - *
% ]3 e7 g/ \: j: E: _ - * This file contains EDMA3 Test code.! T/ X# v& o3 [; N
- *
; S- X- a# u, }& F7 [. B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 L& ?1 B6 Z* F' h8 @. ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. h, G0 ?( r$ @$ K - * TO CHANGE.
/ m8 b( z' `# z( R$ y; X5 i - *
' |3 \- u( M9 x6 I3 z, m. ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( n9 D% ?8 Z/ H" \: T - *4 b+ T7 J; x; Z( K3 ~$ \
- * This program is free software; you can redistribute it and/or
7 I5 P# a6 y% y$ B - * modify it under the terms of the GNU General Public License as, Y* ]# `; P1 n9 U w
- * published by the Free Software Foundation version 2.
+ S) n8 u( d3 k; t( x1 i$ \$ j - *+ G* Z& d: r% y' t4 c7 Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, n% P1 a3 Z( A8 S - * kind, whether express or implied; without even the implied warranty
5 \1 x5 {- ^$ O% M' i% l; @2 S# u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 W+ c7 @& \7 ~' Y* S - * GNU General Public License for more details.: E% _( c2 {) D9 t* ~' w$ ? ?3 j
- */
' a# q$ @- Y; L; d# o) C- m - - P/ Q \2 b' E# E" X% T! A
- #include <linux/module.h>
5 o8 a$ E# v, U7 f* S* p - #include <linux/init.h>
: B$ ]" R3 J# Z, D - #include <linux/errno.h>
& O* e% I a, @# S9 r9 } - #include <linux/types.h>
- p, k5 n$ j' D9 y) ` m - #include <linux/interrupt.h>% w: Z& `3 J7 }. f# K2 x/ L% |6 p
- #include <asm/io.h>
* y* U! ]; ^; Z& Y/ M - #include <linux/moduleparam.h>
% e9 d2 b+ Q2 o$ |7 X$ } - #include <linux/sysctl.h>
$ [( B, a% [5 `* U8 ~3 Y; C - #include <linux/mm.h>
3 p: b, `( [2 s$ O - #include <linux/dma-mapping.h>7 L! n" A, _9 i& w8 }
- ( W. H6 U' S1 I+ X, g) \+ z
- #include <mach/memory.h># j* D0 m% D9 {8 a: r
- #include <mach/hardware.h>
k3 g0 o. h2 l1 J! `" U - #include <mach/irqs.h>
$ V) t" o7 N% W - #include <asm/hardware/edma.h>2 w- G; [: T# z5 ]- k3 W& n; y" B
5 C8 P" p7 G/ `3 S, Y4 R0 g- #undef EDMA3_DEBUG
$ d: A0 B2 L0 m2 F3 Y/ t - /*#define EDMA3_DEBUG*/
5 X" M$ u4 [2 V1 u" ~* n
" M0 d L0 l: ^. I- #ifdef EDMA3_DEBUG: q8 L: p2 L5 ]* l& B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' l0 d( [2 e" U$ O7 o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 {! {* T$ z3 q8 ~$ x# c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ ]9 e7 d' J! {: Y - #else$ n( p) D6 q5 b. `5 ?
- #define DMA_PRINTK( x... )* w9 x, U* Y# d4 L+ U4 e
- #define DMA_FN_IN
7 z1 ^# c3 I& K" _: Q3 [" b - #define DMA_FN_OUT
, p' m# i8 J6 O3 i+ l - #endif
* e4 `5 S+ t) x0 y. s. k* m! g
; R4 A/ w% n7 r0 [4 i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 M) |) G" Z7 a - #define STATIC_SHIFT 3
( e9 l0 F# h3 v5 _1 } - #define TCINTEN_SHIFT 208 V/ N [% v2 P/ a. A6 ^+ I
- #define ITCINTEN_SHIFT 21
; W% w1 m# T: @* h- a - #define TCCHEN_SHIFT 22
. ~5 ~% S- L4 }* R8 K - #define ITCCHEN_SHIFT 23
9 s5 U* \; ~* h5 v3 a - % H) e9 J5 L# o/ U. l
- static volatile int irqraised1 = 0;! P6 P7 U5 t& O' Y8 Z/ d
- static volatile int irqraised2 = 0;
# t4 ? @3 O3 ]. A; V - ; U) ^; v7 ^% [1 I9 l$ P7 K6 V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) U+ h0 Y2 w( S( k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' e- G- U; U; ~! z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 I _9 k% L% x6 B7 f& v0 q% U
; d/ m4 t) |+ d, h) S7 G% {: I- dma_addr_t dmaphyssrc1 = 0;
7 [/ F9 X) i1 G7 ~: e4 y- J! J9 q - dma_addr_t dmaphyssrc2 = 0;" p9 ]# E7 Z. [: {
- dma_addr_t dmaphysdest1 = 0;
3 K, H5 m2 J |! T( `; c% @0 i - dma_addr_t dmaphysdest2 = 0;
4 }1 V& R) ^3 f7 r, m6 y/ R3 b! \
4 C* I0 R ^0 ]- char *dmabufsrc1 = NULL;+ s3 c( q& b- R6 T
- char *dmabufsrc2 = NULL;
- S' T* A3 n1 K4 |- S - char *dmabufdest1 = NULL;& \* H* f- f0 M. j4 H
- char *dmabufdest2 = NULL;0 S' k, L9 C0 E; u8 Y
- 3 D8 q5 ]; H' G3 \
- static int acnt = 512;. ^( v4 B8 V+ a, l$ b9 x$ M0 }' B
- static int bcnt = 8;
2 d; A j' _3 f# m0 ?: A - static int ccnt = 8;+ p! X7 x* N. H; F& q
- . y6 z# m) A0 g0 `+ j1 ]7 r/ ~# @
- module_param(acnt, int, S_IRUGO);' l, C3 A2 R6 ]- ~1 L9 }9 e
- module_param(bcnt, int, S_IRUGO);
0 r3 G2 D% H& ?6 y5 F! Y - module_param(ccnt, int, S_IRUGO);
复制代码
. E) R* ]' T S2 U) N% X g3 j1 Y( o/ U; d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* b" {$ Q) o. f7 t/ O5 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 Y5 U$ V, o: d- [# p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! C) y: I6 q- h# [$ N: J. t
% M: N+ X* N0 D, M( B7 \5 J. P) N+ h, ]% E `$ C! h8 s% J3 `+ _; @0 D8 U
|
|