|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 `+ W" H% ^1 d7 w) ?3 F
- [code]EDMA sample test application
; C7 `' ]! F8 C. _ - /*1 N+ L& o# h$ p! w3 `
- * edma_test.c. W1 F# `' w% B& I
- *
4 @' p, v: K; O8 c: A - * brief EDMA3 Test Application5 z. U0 `# L' J& }: C- J+ ^/ \5 b
- *0 F8 |- c W% s8 h
- * This file contains EDMA3 Test code.
$ A7 _" z1 B& ]) ^ - *
5 ^% ?, B7 i& s2 k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 d1 a8 Z* ?! I" s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT v0 x0 R1 s2 b- `% }. E
- * TO CHANGE./ m( ^! |/ c% {: n8 ^
- *) Z: R' z) D z! ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" z! ?( P0 \; \ U; Y
- *
' V* l$ ?- Y! s - * This program is free software; you can redistribute it and/or: W7 b3 [- y( T! v
- * modify it under the terms of the GNU General Public License as
6 D/ ~) Y8 N2 ~. G - * published by the Free Software Foundation version 2.
; h9 r( d. [3 M _- _( F5 W - */ c6 o2 X/ m: W& G( H9 J/ ]1 H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# V5 F$ w3 f3 u& `( o
- * kind, whether express or implied; without even the implied warranty
1 d; {3 H, ], D: [6 H+ Y: o/ X - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ y+ ?: b |) ^" b8 }- x
- * GNU General Public License for more details.% ]1 n6 V2 {- L: m2 T5 V
- */4 N9 Q' Y. u% B+ [9 |4 Y- b
- 4 j2 e! H9 E. [& g$ d* N% ^
- #include <linux/module.h>1 ^0 N4 s# U5 J/ D4 d4 h B7 L
- #include <linux/init.h>6 s2 N, C! A1 |
- #include <linux/errno.h>. U7 V9 \6 u1 G9 E( D
- #include <linux/types.h>
$ R( G0 F; ? l+ a3 [- V' `& c - #include <linux/interrupt.h>. ?" a4 `! l9 g4 j( [
- #include <asm/io.h>. R8 o+ \% |; }( D) D. [) H
- #include <linux/moduleparam.h># h, J: g$ a; k
- #include <linux/sysctl.h>
% j+ o' |3 N! L/ x - #include <linux/mm.h>
1 ~3 @. N3 z6 t2 j - #include <linux/dma-mapping.h>1 s. ] Q7 C% r! @8 |3 p8 D, ~, I j1 m
# K& D" Y1 H8 G5 S7 k0 R, i- #include <mach/memory.h>4 z! I) C1 {" e& ^( I8 t1 F2 Q, D
- #include <mach/hardware.h>
; z& W# Y; n( A - #include <mach/irqs.h>6 h; j4 ~+ u, j: |. \& M9 i
- #include <asm/hardware/edma.h>
6 \3 J0 k4 ~. t! U7 q - * r( \& m5 E, A& l* N! F6 M; o
- #undef EDMA3_DEBUG0 Z3 ?; W& q7 ~' e1 `9 G
- /*#define EDMA3_DEBUG*/
( S5 p) V1 o$ K3 L3 s# {8 B5 p2 m" I
! F( A! @; s0 W" U" S e2 e) v- #ifdef EDMA3_DEBUG+ v" ]: O6 b6 t* o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ K" {* N+ }' Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ O* s- F. m+ f- j' m H5 I. A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, l# e; @. Y2 l& u @7 } - #else8 |$ Y& `7 i( |! T) \4 n
- #define DMA_PRINTK( x... )5 E+ V4 f$ k% }# I
- #define DMA_FN_IN
7 P0 { _( P# g% c, B - #define DMA_FN_OUT. t* _: K3 b% y/ W, q9 h* h
- #endif9 G8 m: X L0 U% @
- 9 Z5 M% |! [& r ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); S/ Y0 C! i: ]+ ~( e
- #define STATIC_SHIFT 3
( @: Q5 z# e" b0 \( K - #define TCINTEN_SHIFT 208 ?5 t+ W% i5 O" G# a' u+ S/ |
- #define ITCINTEN_SHIFT 21
9 T+ ]6 X2 n2 W7 @, C* U- D - #define TCCHEN_SHIFT 221 ~4 F1 g; L" ]+ m0 M0 e
- #define ITCCHEN_SHIFT 23/ d1 o( x4 X- a$ Y
3 x- J, X6 V. o0 J- r K- static volatile int irqraised1 = 0;( K) j/ @# K4 `5 O+ }7 }
- static volatile int irqraised2 = 0;
- v/ D( S' R+ _+ I [7 U' q - / u) @. y* ~% f( R7 \! C7 H) v. W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ u; M# c! t; n' X" u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 f8 K' m2 ?' P- a; f9 i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) @! a( ]$ y0 Z - 9 z7 v* Q$ `$ H3 V5 |1 e
- dma_addr_t dmaphyssrc1 = 0; T& @/ w" I. U) _; `
- dma_addr_t dmaphyssrc2 = 0;
4 b5 ^% v2 p' k; j" K* P* O - dma_addr_t dmaphysdest1 = 0;2 W+ v3 }( U& _" U/ r
- dma_addr_t dmaphysdest2 = 0;9 C8 }- b5 O, U$ L4 @$ N) x
- ( F% S; Z* H; `5 D
- char *dmabufsrc1 = NULL;
; q: N2 ~) U8 E- r" X( L# w - char *dmabufsrc2 = NULL;& c0 T1 T) b, h& N( K
- char *dmabufdest1 = NULL;
9 j1 X# f a0 n8 Z S' M - char *dmabufdest2 = NULL;
' r m, h% Y/ F& M* i8 q
* v, i. N0 K1 @- A- static int acnt = 512;8 T! [& s, \% ^* \* E) L9 T3 z( J
- static int bcnt = 8;
; U. B# ?( T Z' P) l ^ - static int ccnt = 8;
4 W f/ w- I$ i4 m1 J8 M - 0 p3 P4 e" |) i) B7 z) t& l; T
- module_param(acnt, int, S_IRUGO);2 Z) B! j3 j l8 s
- module_param(bcnt, int, S_IRUGO);: @7 {4 k" N4 Z( ~( ]
- module_param(ccnt, int, S_IRUGO);
复制代码 9 I' G1 G, X' L& `1 t
9 i- g" q; ^. R: P& z7 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 ~5 E( n- q s1 H! n3 I1 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 j& I% Y9 k4 L2 N4 v3 M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 l5 z6 _- h, z% N5 p9 }+ X
5 w4 }5 W* e1 B. E" k+ r! F( F
. K' g1 R: {; | i1 V& I2 H! R2 e
|
|