|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / W( E2 p( l, O* |' k1 Q6 n
- [code]EDMA sample test application/ H7 Y# y m( `2 Y' D# `# n8 @
- /* }+ l. W3 s! a* a* M5 c* M5 B8 U
- * edma_test.c" _/ [, t1 F, c0 F7 X" `1 Z
- *1 y% w8 [! k" ]# u
- * brief EDMA3 Test Application
1 L4 J- N' b$ c7 X X - *
# h4 [( ]- z( O& d& Y8 a4 ~" o - * This file contains EDMA3 Test code.
$ ?' E* k( x3 |# c0 i, s - *
/ p$ K1 O; ~8 N( z& _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 ~$ S" k0 a: t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT J$ _% L6 b- a `
- * TO CHANGE.
1 x" ^& I7 [! T - *3 Q6 n: T" M& u+ {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, a/ Q* M4 S* c* O! \- @" ~ - *% Z/ i0 M9 y# x
- * This program is free software; you can redistribute it and/or) H1 H$ ~3 }4 ]" [! d
- * modify it under the terms of the GNU General Public License as8 t$ r2 Y& j }. Z, ~4 k0 Y* V6 r
- * published by the Free Software Foundation version 2.
4 A. x8 G' b$ C: n; h - *! ^' z* y( H" ? v- b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# v. m- H( D2 j" i3 W - * kind, whether express or implied; without even the implied warranty
2 r2 X* A5 q, F+ x) Z, ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ m) n) z9 m$ M9 K& O8 j
- * GNU General Public License for more details.8 ]0 Y$ C% y7 k8 c
- */
6 O; B. C; S1 \" o - + _& U6 Z; G) X5 X
- #include <linux/module.h>
$ o0 x, h. e7 E4 _& p: q - #include <linux/init.h>
; B4 J& t3 Y0 p- `+ ~ - #include <linux/errno.h>
2 M; s4 I1 |2 M( E, W+ E - #include <linux/types.h>
" x- b( {* V7 q, F; k4 [ - #include <linux/interrupt.h>
/ S8 n, |9 \. o7 E: j$ B3 N: j - #include <asm/io.h>& R0 D. g, F7 D5 D& v r- M* O n
- #include <linux/moduleparam.h>0 @1 p/ l$ P& J3 R
- #include <linux/sysctl.h>8 z% u( y7 D8 ~: L
- #include <linux/mm.h>( s, N+ O. q: B
- #include <linux/dma-mapping.h>
7 [7 \; _! u. s, m - 4 K( z0 M3 D4 T& T
- #include <mach/memory.h>
M2 e0 i& C+ m; a1 L L - #include <mach/hardware.h>$ O" K2 e! |/ t9 A9 T
- #include <mach/irqs.h>$ g1 g+ o0 ^0 w% o2 } v# {
- #include <asm/hardware/edma.h>
$ ?' O+ `8 {5 a" O5 u6 h2 v
; a7 |) s; ^# J. S- #undef EDMA3_DEBUG; I! N/ V; B, o0 s. c W1 J9 \: [* K
- /*#define EDMA3_DEBUG*/& b5 m- m# m9 D, i+ O
- 0 O3 l6 b- K; @% R. C( S9 p, |. W
- #ifdef EDMA3_DEBUG
( r( N% y, \9 O2 n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ O* Y, n6 \! S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' z5 A6 L1 w2 Q; }' z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( C( m; }- O6 n; Y - #else
* C* o5 i, H% q# @9 s - #define DMA_PRINTK( x... )
]- q( p1 A. a z0 t- U0 d: I - #define DMA_FN_IN
* K: g- W' }. V' K1 ? - #define DMA_FN_OUT
; J# H: Q5 T5 N% X1 `0 q- O - #endif
5 B% C/ Y2 {7 d C/ s - $ G5 g6 X" H$ E, v8 p f2 K; j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& l/ f5 l- {7 J - #define STATIC_SHIFT 3
7 q6 g- @7 q5 d. T: `! e! l' E - #define TCINTEN_SHIFT 20
, C# x5 E# y" a# v - #define ITCINTEN_SHIFT 21
8 L( e {3 M% N8 C7 B( T - #define TCCHEN_SHIFT 22- }0 U0 d4 G2 Y0 \ [& R4 P9 ^
- #define ITCCHEN_SHIFT 23
7 I( d) a) h" h* I - - L+ t: m1 }( U' n4 I- k- T1 @; A
- static volatile int irqraised1 = 0;
7 k& p7 ~) T: }, N4 {% G ] - static volatile int irqraised2 = 0;) f: C- r% q, U* `6 b
p& A" E6 m/ @5 T$ S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 s) D& g% ?" e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 i1 v8 p& L1 I4 F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: T6 [# l+ G# z7 c2 K+ B - # _+ Q2 q) X/ j1 {
- dma_addr_t dmaphyssrc1 = 0;7 M& Z7 D7 Q0 R6 H6 ]
- dma_addr_t dmaphyssrc2 = 0;+ U% I; h# C& A& z @- |' B, Z
- dma_addr_t dmaphysdest1 = 0;% @1 Y1 `" d. ?: [4 T
- dma_addr_t dmaphysdest2 = 0;" C" N3 J% W7 |5 U/ k; j
- - ]3 {0 N0 X1 a( O1 L* z
- char *dmabufsrc1 = NULL;
: A& F8 S! r" X8 O. O& b - char *dmabufsrc2 = NULL;
& u4 J8 E4 J) E! q" \ - char *dmabufdest1 = NULL;
6 w7 v4 V, L& Z. _% G - char *dmabufdest2 = NULL;
: a2 ?, R' h7 m A/ i( ] - . X* J1 F+ z# W& ^) G5 u
- static int acnt = 512;
3 W6 D6 i2 v- q* j& i( }: O4 d/ k - static int bcnt = 8;# A( `# r, d/ X1 r. l
- static int ccnt = 8;
( ~ A# ^" K& h0 m6 k3 a( u! g
; J) h2 n% Z( x- module_param(acnt, int, S_IRUGO);
+ I( x X: o* f" Y5 h - module_param(bcnt, int, S_IRUGO);
# q' i& u& ^4 J - module_param(ccnt, int, S_IRUGO);
复制代码 % L; T2 O1 x% z; Z3 ~8 N9 G
f6 w# t4 M1 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 P8 W1 ?5 |& ?7 Q7 R8 C# w6 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: N1 Y" |! E5 F" z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( }, Y8 I: z5 d. [8 x
/ [2 N; v( n1 F* l6 o8 A6 L8 e8 d, j. Y# _8 S& ^! i
|
|