|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & d4 ?$ S7 X4 A$ t
- [code]EDMA sample test application
3 ? ]4 ^0 _+ z$ _! E' d0 J, ~ - /*& j% R* h m4 q! |) Q. l
- * edma_test.c9 [% {. s, ]4 p6 o* ~/ ?- |
- *+ V: c0 z; @- W* S5 `) L
- * brief EDMA3 Test Application7 P O( I0 Q7 @9 K' e( F ?3 A/ v2 V
- *! x, I# X$ j, b. o5 F
- * This file contains EDMA3 Test code.
5 R) F" o: m ~6 w7 \* b8 ? - *
3 v& k3 |- n$ H! t( A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) l; ]" z7 {! ~' X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ V! B4 b @4 n7 A5 ^
- * TO CHANGE.; c3 @; j: b! l& a1 p+ ~/ c
- *
4 m( u2 I; C& W+ f5 K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 u8 U' D/ {3 Q1 c2 F! X9 Y( ]3 I
- *# U ^. f4 u: @3 S) O2 P3 P3 G
- * This program is free software; you can redistribute it and/or
. S" ]4 n' `5 t9 H - * modify it under the terms of the GNU General Public License as/ y/ H" F$ Z$ q% j/ {
- * published by the Free Software Foundation version 2.
: v' n! M, q; L k2 H5 p; J& v - *, j+ Y6 Y" F# V% d0 G; U* A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% @( p' J- o; @- A% m& D/ V - * kind, whether express or implied; without even the implied warranty4 x9 B( {6 i+ _$ }6 A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 N8 x2 j6 w' W% A: y- J - * GNU General Public License for more details.
0 ]" R, \& N4 h - */5 i0 A4 y% N* y* b+ t/ j2 }3 m
- ; k; w! J; C) y# y& m* y
- #include <linux/module.h>+ M# O) Z$ `' {4 z5 b P
- #include <linux/init.h>
! W+ l$ o4 h& O, e4 {4 C4 M - #include <linux/errno.h>
7 L# [- s' n/ x2 d - #include <linux/types.h>( g# }9 J W) v- P/ u7 J2 P$ c- M
- #include <linux/interrupt.h>
( ?. ? d% [3 J - #include <asm/io.h>) N+ d, ]3 F3 S
- #include <linux/moduleparam.h>" z3 a" W, o# f* p
- #include <linux/sysctl.h>
$ c4 l5 q! ]3 k* D% J# G( d! K5 S - #include <linux/mm.h>" {% i: H z. t* q! ?
- #include <linux/dma-mapping.h>
! Z; I2 M4 ?3 Y. {; } - 1 [$ G5 f" F8 e( w4 R" r7 u; ~
- #include <mach/memory.h>
4 j4 `3 \0 \. Z - #include <mach/hardware.h>
- e3 f) E, j, b9 m4 W5 U' G' U8 Q - #include <mach/irqs.h>
, I) a' K9 U$ g) p. p - #include <asm/hardware/edma.h>
* G |' o( e8 K8 v
/ m2 n: d. L- N) C1 G- #undef EDMA3_DEBUG
9 e+ g, F) y0 y" o, d% } - /*#define EDMA3_DEBUG*/
- Q8 d# D/ Z3 }
& B% F/ `$ P$ w' L. i- #ifdef EDMA3_DEBUG
1 X% t4 R" x- t+ ?& C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ Y6 H6 ?" X7 ~8 z) h! f2 }3 R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 S% N* U* K7 t, U) C0 R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 i1 j/ G+ {! h/ c) I2 ~6 l' s9 p% O
- #else
7 D" w4 s& ]) R: J# g - #define DMA_PRINTK( x... )2 c+ l1 F3 l6 C/ ?; w
- #define DMA_FN_IN2 f0 |" S8 h2 j* `
- #define DMA_FN_OUT
0 [' P- L5 j, f - #endif) T: n0 _/ M& }0 `/ d. Z
- ! }! }( H# g, p0 r. \" W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 ] n; u, B. Y& U! @. q - #define STATIC_SHIFT 3 J! l4 E, U( E, L
- #define TCINTEN_SHIFT 202 _2 [5 w7 q- k1 K( d( Q
- #define ITCINTEN_SHIFT 21
7 g+ C- c7 E% i. @) L$ n, L. |" b - #define TCCHEN_SHIFT 22! |, l7 Q* M* _& \9 a/ O
- #define ITCCHEN_SHIFT 238 D* `/ s) {# o2 B L6 x0 b
- 4 w( r/ L2 l7 [% _! R' t- V* S* c
- static volatile int irqraised1 = 0;
5 P! `9 {; Z0 ]3 k, B8 \ - static volatile int irqraised2 = 0;3 c6 F0 _, ]+ U9 ~: I* t
- 9 x3 }* d' P) l4 V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# p* N d3 U. n( R$ H$ ^- _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 h; C7 a; Y6 ]1 k+ o/ W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ~# \! ], k! d9 l1 O: Z' S
- 8 v$ U/ k! G" M" G
- dma_addr_t dmaphyssrc1 = 0;& R7 N: m, i @6 {3 G& g0 r
- dma_addr_t dmaphyssrc2 = 0;0 j$ N+ g: w2 |' [" Q5 d
- dma_addr_t dmaphysdest1 = 0;
$ B: V' ^6 ~$ l+ a1 Q" g) m - dma_addr_t dmaphysdest2 = 0;* v2 H5 }( v/ d- I- [ b+ z+ J
- * }& u( q3 G+ S
- char *dmabufsrc1 = NULL;
5 A( f0 ?5 c# x/ m6 ^# k4 G* B - char *dmabufsrc2 = NULL;5 r! V( ~9 @. E+ }( {' p
- char *dmabufdest1 = NULL;6 j/ P2 _. o1 E4 y, w
- char *dmabufdest2 = NULL;
7 j9 ^: u6 S3 ]/ Q7 i - ; g6 A" J- q. d3 @: {% D1 R
- static int acnt = 512;
* U6 F3 b7 j+ A3 j( _6 B! c# S6 j8 t8 P - static int bcnt = 8;
4 Z( V% K! J" ^6 y. [6 p: B* [- M - static int ccnt = 8;
]0 _. D( Z" l0 K+ E6 }' ?& F$ s - " D+ f, j: V/ I, [ q W
- module_param(acnt, int, S_IRUGO);/ @/ B# w5 b. b8 C; u i
- module_param(bcnt, int, S_IRUGO);
* b, q+ ?: ]) o9 C* L) C% \, u - module_param(ccnt, int, S_IRUGO);
复制代码 ! k6 f% h. I4 I$ Y& o
. n( { L4 x% _8 T0 ~3 O8 O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ ]& W& I4 q2 f# Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, l7 K$ _9 j+ q6 r8 \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" ?' F8 f' F$ g$ N7 @2 o/ @0 E3 p, O. w
1 H9 U( Q6 {) x! B |
|