|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' r! C+ D4 a! @: Z- y3 J$ [
- [code]EDMA sample test application
+ G) X2 j" N; u8 |" D% ^0 E - /*
+ c0 ^) `8 b7 C* b7 e - * edma_test.c
+ }6 Y5 _" ?* Q+ Q. x$ _ - *$ k1 A" O7 Z. C) c7 |6 Q. D. T
- * brief EDMA3 Test Application
0 _' m d6 i! T4 g* H9 X - *
1 r1 z q3 g/ O$ s; C - * This file contains EDMA3 Test code.
( C0 ?/ u" h$ D: P7 u4 ~& A* D - *4 F' B) F% T5 t' P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 T1 v% o" m% g+ N! x/ g1 L# c3 k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ S4 e7 P' n. R% ~# s
- * TO CHANGE.; N; R1 l+ D" l0 ^% `- e
- *7 t6 t4 A& }' I# E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" E/ F. E6 C8 @3 \( u8 p' F - *3 H) j' `, F6 J( i) {$ [
- * This program is free software; you can redistribute it and/or
0 J% V# J, F8 ~3 V) y9 N# m - * modify it under the terms of the GNU General Public License as
, }4 N$ j8 }. B7 Z' s& | - * published by the Free Software Foundation version 2.& M) T& v, E! g! t3 L) f$ P
- *
( j6 R& x6 Q3 W- C- x( D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ T' s1 \/ y& ?' s
- * kind, whether express or implied; without even the implied warranty
' q8 T% q8 z2 A2 x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- T" e8 j/ d) R7 z7 I U
- * GNU General Public License for more details.6 x& E& a( ?8 x
- */- i0 I( R R( L# V8 P) w9 H
- * M2 [$ c& Z8 Q
- #include <linux/module.h>
/ T1 |% L O$ X$ Y0 I; J# J - #include <linux/init.h>
/ Y8 [/ K7 Q6 Z X) u1 S2 @( W - #include <linux/errno.h>$ ~, ?4 T$ T& p0 S
- #include <linux/types.h>
5 X u/ h2 P: R$ m* |: J- A - #include <linux/interrupt.h>+ x. e+ r9 `. N
- #include <asm/io.h>* O5 B3 g6 A$ n, f' S
- #include <linux/moduleparam.h>2 A) @9 u+ b3 q" [2 D0 H9 `; l$ }( W
- #include <linux/sysctl.h>
: ~4 w- h7 A @' @. u% W - #include <linux/mm.h>4 z3 z. o% c1 {0 N' R( U1 t7 [
- #include <linux/dma-mapping.h> A" J! N/ c: n; Q
- 1 W1 m' {6 _' c7 W' j u5 G( u
- #include <mach/memory.h>3 J* N0 P U+ e' F4 y$ y* B
- #include <mach/hardware.h>
]; R' h6 C) x' H- ^, I - #include <mach/irqs.h>
& M8 ]% k- @% } - #include <asm/hardware/edma.h>
0 K7 Z3 V3 k% C" \8 L2 v
: H5 h: u& K: C i6 ?4 \6 U) f- #undef EDMA3_DEBUG% h1 |! j* f! |: {7 z1 m
- /*#define EDMA3_DEBUG*/
" t5 P3 y" j( |3 ~- K
- J' @0 @3 b( y- B, D# _- #ifdef EDMA3_DEBUG7 c. `* G/ E9 n+ `7 O) _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): Y7 T: j4 A8 N j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 \5 y/ b8 ~- [- C+ R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& t( S, e- O# `
- #else
6 J+ `7 \+ @6 ~ - #define DMA_PRINTK( x... )) L- x( O r& P7 k- S
- #define DMA_FN_IN% }* d6 A# L$ |. m& _
- #define DMA_FN_OUT
* S6 {- Z5 t1 U9 C$ r - #endif5 ]9 O1 M/ h, D) `% `- B
! s6 P2 d7 I$ L/ o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* B( h- s/ g; v p) O- J; [5 Z# o
- #define STATIC_SHIFT 3( x+ k) g# W1 }- p/ a5 _# U
- #define TCINTEN_SHIFT 20
( \: H- c; Z. F - #define ITCINTEN_SHIFT 21
. @/ ]: E* |2 g# ^ - #define TCCHEN_SHIFT 22& ~, t8 L6 h1 K1 N
- #define ITCCHEN_SHIFT 23
$ S# d+ }( p1 N [# z& N, m: h - + w% K( c) w# v/ G+ U" _: r$ R
- static volatile int irqraised1 = 0;! t* ]7 @# K0 ~* c0 K/ n
- static volatile int irqraised2 = 0;
7 T Y+ G$ w! {3 f- W4 n
; W+ A U/ ~0 f# x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 J2 a( E2 \- M( q- t r! s" t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. Q, o( T; U* c: o7 i& F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% z8 T+ g- E; u- v8 }
3 j$ B" L! d. F" u- S+ g: N- dma_addr_t dmaphyssrc1 = 0;
2 B2 r5 ~5 `0 J L - dma_addr_t dmaphyssrc2 = 0;
3 s& a4 x. G% {0 Z - dma_addr_t dmaphysdest1 = 0;
7 S% i1 F0 e( `. j5 { - dma_addr_t dmaphysdest2 = 0;
( I! s0 N! x; j# A8 Y9 _! @ - # ]9 {$ E: o4 `
- char *dmabufsrc1 = NULL;
[) }! o) b. D/ _, F, `3 ]* n" g - char *dmabufsrc2 = NULL;6 l- [, r) K. D! S! _1 b( o& C
- char *dmabufdest1 = NULL;6 h& m) s/ H% `) _3 {6 X& H, V
- char *dmabufdest2 = NULL;
! y. Z$ t q2 J; S" g - * Z* g0 O; W9 x# p, {0 W
- static int acnt = 512;! _$ Q9 o( j+ L! u. n( x% D2 c& o
- static int bcnt = 8;
% m5 N* c' o5 P - static int ccnt = 8;, [: @7 a+ X. A% j' l: J$ `+ a8 i
- : {$ `) O3 e- K2 M8 Z
- module_param(acnt, int, S_IRUGO);
S: C: {& g( V; ? - module_param(bcnt, int, S_IRUGO);
. B0 A- o$ y( B3 @& b - module_param(ccnt, int, S_IRUGO);
复制代码 1 A1 ~0 F' @$ T. u: |/ i
+ R; y6 P! J' E; H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 J N% }6 H0 }% @( B4 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- k8 z0 L$ ^" l: ~" |' q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 t& {+ J1 a' t
* q: i4 a* L0 F% B, e# u6 R% l8 a! R' z, ]
|
|