|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : K& t* P) F. R4 W- z
- [code]EDMA sample test application: E4 E1 r9 e$ c+ O$ S4 N
- /*& V& h3 C& X, b1 d/ R# Z) K8 f+ H
- * edma_test.c
( k |4 b, ?0 `& Q" Q - *
4 d4 V+ u9 T6 ? - * brief EDMA3 Test Application
. O% W2 f) ]2 ~- e3 W - *
+ t2 B( c$ d/ L" n - * This file contains EDMA3 Test code.
9 m3 t$ f$ j- a& b - *
0 b/ D2 S$ E: e F# a# p& h7 S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 V$ K1 Y I- c! [' r8 \! y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 T! ]6 _5 x: R- D' i - * TO CHANGE.
/ E! M0 }1 h @, O) C - *
4 [$ w2 m/ G7 D- a4 B6 N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 p% Y4 x$ z O0 N6 I6 Y4 ~
- *; p4 u. _/ {4 B$ x f
- * This program is free software; you can redistribute it and/or a$ S. c7 k+ P3 ?* t
- * modify it under the terms of the GNU General Public License as. b) l' @% F5 M) J a+ R
- * published by the Free Software Foundation version 2./ j% _7 M$ F! @! o2 q3 v
- *+ y* ?/ C! r% q+ f. C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% @9 `- B4 l- ^1 A* z, }# } - * kind, whether express or implied; without even the implied warranty3 @& w4 t1 }- |( d1 X! K Y: p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 \& a3 h1 J: @4 q* X - * GNU General Public License for more details., Z) L) u9 m, _+ C4 _
- */
) r$ X6 j* J- k) ^; M9 v/ z. Q
# t9 f" J( ~1 j! D$ B3 A$ M- #include <linux/module.h>1 s& A' W' y! d$ r$ H
- #include <linux/init.h>
$ R/ |" Z1 x. Q9 O% H" q n - #include <linux/errno.h>, h& u: e, d! q
- #include <linux/types.h>' K3 j0 y6 _) q0 {& M& \
- #include <linux/interrupt.h># G3 `& u, x3 G- N% _! R
- #include <asm/io.h>
3 G0 f- y' F' B% d. ^ O - #include <linux/moduleparam.h>
1 ^5 K2 j7 k9 E+ e$ V - #include <linux/sysctl.h>3 a. |% x" W- X: Q( R
- #include <linux/mm.h>
! z7 _0 i- m# @4 W9 u0 E' W - #include <linux/dma-mapping.h>7 z; v- D8 ^% E! c# h
- 0 f$ k/ d' V2 E$ I- ~8 ]
- #include <mach/memory.h>+ j8 i& Q! F/ h& p) u) g' @* [
- #include <mach/hardware.h>* m' c! p# z4 k, m6 u; g
- #include <mach/irqs.h>0 B1 i- f# m f2 p
- #include <asm/hardware/edma.h>6 p1 z* e `8 A4 e2 B8 l* {' T
5 D9 H3 b7 G' ~5 u! p* d- #undef EDMA3_DEBUG# E2 n2 d: @" V9 Y( t
- /*#define EDMA3_DEBUG*/
! K W" z% y( U/ l - L+ L% C( B1 j) t- N; R
- #ifdef EDMA3_DEBUG" g6 M2 R9 Y" W- T d9 L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ C4 Z0 j [3 M' `5 ^- k3 p) z( R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); g8 } u6 p/ i p
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! V+ A% q( u, v6 I
- #else
: g7 w4 b; R; U+ ?# l - #define DMA_PRINTK( x... )" Q }$ p. P( f, P. }4 R/ e1 s
- #define DMA_FN_IN
# Y& E1 x/ _3 r; t+ T; s - #define DMA_FN_OUT
1 Y% L2 g! x% B6 t) f- o - #endif' ^4 m* k) |* s( ^! v
- + Z; j: m! H0 w5 a9 {) l1 N& D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" y- `( x ^0 y* t9 a$ k1 a3 p( G! M
- #define STATIC_SHIFT 3
3 ] @. T1 Q/ W" V& _0 `7 C - #define TCINTEN_SHIFT 20: y, ^: p* O* H3 J
- #define ITCINTEN_SHIFT 213 m4 g5 ~3 s* h. O. [
- #define TCCHEN_SHIFT 22
: X) I* v6 `9 [0 I. @. z - #define ITCCHEN_SHIFT 23
. r6 s, l- a. ?7 C+ N4 v
# D! N% d# o7 X ?% s, n- static volatile int irqraised1 = 0;
- l* L D8 J# e% P - static volatile int irqraised2 = 0;' Q" A1 Q5 ^5 I6 }$ R( q, h2 N
- 6 w. Q2 q6 D' q0 N% e: ~$ L9 R+ ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 v' c: D. s" f$ x" r. P, d% X# Z# R& y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ x0 @7 X i8 o8 W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. j% \7 m- l5 a4 I7 J
" B. i, W$ h9 U6 p# v- dma_addr_t dmaphyssrc1 = 0;
/ E# K. x3 {# t7 u - dma_addr_t dmaphyssrc2 = 0;: |! \4 |% X! G$ M9 O" M
- dma_addr_t dmaphysdest1 = 0; O& g- ~3 e. p- K
- dma_addr_t dmaphysdest2 = 0;
# [$ ]- @; m6 i; O& ^ - / d0 e. U2 z3 a. c
- char *dmabufsrc1 = NULL;2 c- Z% Y, @0 T* S
- char *dmabufsrc2 = NULL;
_* I+ {: ^% ^+ U; N - char *dmabufdest1 = NULL;
[: O) y9 R5 t9 | - char *dmabufdest2 = NULL;
6 P! z- O) A) \/ @
$ q) T# d! w" N6 n0 ? x }- static int acnt = 512;
" ]% h& o9 A7 f+ }4 d - static int bcnt = 8;
9 _" d* ^8 p* I' h5 P% P5 r - static int ccnt = 8;
6 @, D/ Q. c$ a z - - h4 J8 S! x# t0 g" W- C
- module_param(acnt, int, S_IRUGO);
$ R& ?9 D9 }5 o- K* n* G4 N - module_param(bcnt, int, S_IRUGO);
0 F0 u/ _9 J. @+ E p$ q - module_param(ccnt, int, S_IRUGO);
复制代码 & A2 p* w+ Y: B6 `4 m
, J; C6 P7 ]) U) x2 M' c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& ~+ b- i$ u; }8 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 e" C" D) n+ \' H# Y& \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* a, n0 M H* l- i$ u3 W6 t: d/ n5 g# V+ {
. |& H% B: U% O. u* t
|
|