|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. O) x, n8 v' j' A3 @- [code]EDMA sample test application8 i/ @+ [& c* M: f% ]: S
- /*0 a; h! s+ b" u- d" F) _
- * edma_test.c2 F5 f! ~, W* k2 G1 g! e6 Q
- *
H1 Y5 I4 X. p9 b) D - * brief EDMA3 Test Application
' ^5 N/ o4 E! k' C$ U9 k - *
# x6 d, u$ R& y( u( j0 h+ D ^ - * This file contains EDMA3 Test code.
2 h, I0 c: y& ^: Z - *: p% Q' |) H0 W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 C1 J0 L% Q& E, e$ K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ i. j1 i5 ~9 }0 l& g
- * TO CHANGE.4 a; R+ [; g5 O8 P& u8 u
- *8 M, A: ~+ m0 n; o0 u: U( L! |, G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; [0 Z. w; k, e; g# g: | - *
! r \" ]4 l) J9 l" U4 ] - * This program is free software; you can redistribute it and/or
, r) P* `( t& v ~' m& f8 L: o% E - * modify it under the terms of the GNU General Public License as
3 u* M" l+ G* E) G' A, e$ d - * published by the Free Software Foundation version 2.2 R& s2 H" | ?3 H: o
- *
9 ~' H; N0 R O" q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' K# J U' W$ R9 O/ i9 l, K( j - * kind, whether express or implied; without even the implied warranty
- z; y. X+ M- r' M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. [8 H2 R) P0 ^& ]) ^ - * GNU General Public License for more details.
- X% ]) r/ |/ P) }6 t3 [( W: | - */
. f4 R$ z a; m, V7 U - ! W ?+ T2 o" E4 r
- #include <linux/module.h>
2 t- }$ W3 J& ?" i3 q6 ]1 j* I - #include <linux/init.h>
7 I4 g. ^9 N9 `) o4 A' @2 l - #include <linux/errno.h>
* O) F8 U* u5 a' w - #include <linux/types.h>
! c6 d/ g7 C5 K - #include <linux/interrupt.h>6 p5 G, ~, b2 e5 `
- #include <asm/io.h>! a& [/ O" R* s, i( q9 q
- #include <linux/moduleparam.h>
% @0 e+ K, u6 a% J' L - #include <linux/sysctl.h>
, d. i" X2 \& g0 y2 B - #include <linux/mm.h>
2 K/ D* P8 \+ j- x/ s7 F7 C7 z - #include <linux/dma-mapping.h>
* M- H8 p7 y2 D K - ) r& k' @( G) N& H3 m
- #include <mach/memory.h>& L9 F# g+ f2 R8 J, X
- #include <mach/hardware.h>
1 K8 }2 z+ H: P2 r8 E6 i; I - #include <mach/irqs.h>1 X. z! P5 [0 X9 y* C4 x8 d5 o
- #include <asm/hardware/edma.h>5 }$ f7 O; b$ Q( `% Z
- : x6 r, w+ `! d) r3 J
- #undef EDMA3_DEBUG
' B" _' c$ G9 H4 N* J - /*#define EDMA3_DEBUG*/
- S; [* Y+ d4 T' h/ |( P
9 {5 }) t' J6 w$ q- #ifdef EDMA3_DEBUG
?# |% P. J* g2 }7 }# O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' W- l* V, q! D" c0 V+ b2 m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 V1 @* s: r$ V+ @9 _7 S* Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 b& B3 j2 Q) D: s3 y - #else F: M5 K+ d9 I w* n# |
- #define DMA_PRINTK( x... )% D" p7 i& ~9 q8 i8 G2 B
- #define DMA_FN_IN
' \2 T2 B- f7 k6 q& ~- A - #define DMA_FN_OUT7 ~: K. z' {- P1 G6 b
- #endif7 r2 x7 u |9 J) _
- & X! H. O. a& Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- n# S a+ f4 J - #define STATIC_SHIFT 3& h p. ?& }: f1 E- z- i
- #define TCINTEN_SHIFT 20( |! o9 i+ \7 T a2 |
- #define ITCINTEN_SHIFT 21
/ z# ^7 O X u - #define TCCHEN_SHIFT 22" x& Z/ \4 w' `4 X
- #define ITCCHEN_SHIFT 23
7 S7 B) g& ~) V# F6 v
0 `1 S; c0 f- [1 k- static volatile int irqraised1 = 0;
& x; |3 @% ` h! i8 B: z - static volatile int irqraised2 = 0;( N, K3 r6 z% `3 y: O
- 6 S! O* u4 _& B8 |5 j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 A4 `3 c& M q- ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 c, v1 \1 c0 c$ d% z' p$ ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 H6 O7 G2 i( ~$ {* N$ _
3 B$ T$ ?/ e# p2 E- }- dma_addr_t dmaphyssrc1 = 0;
! n! C6 b8 F& v; ]2 ` - dma_addr_t dmaphyssrc2 = 0;" F5 z, {# P# { I" i
- dma_addr_t dmaphysdest1 = 0;
/ r- r$ y1 y8 H6 L- k+ \ - dma_addr_t dmaphysdest2 = 0;% H& S- |5 i, S8 }/ b
- : g4 K% i5 S! b% x6 |3 H3 A
- char *dmabufsrc1 = NULL;6 i5 p( V" G' J4 f9 n8 N1 R
- char *dmabufsrc2 = NULL;' v2 \: w H# H( ?- M1 w
- char *dmabufdest1 = NULL;
( D3 B, l! {) Z, q6 D9 _; L/ h - char *dmabufdest2 = NULL;
% ~8 o3 ~% s- `- S% l
( O u8 ^2 y, ]0 x; U- static int acnt = 512;( }7 ?& a% A3 X6 r- K1 p: D1 j6 Q* ]
- static int bcnt = 8;2 t! P% ~4 y9 L* [
- static int ccnt = 8;' |+ r8 O& `' c# e6 G! N2 t
- $ U( G; f6 Z% k+ O
- module_param(acnt, int, S_IRUGO);
# n, D) z6 v0 L+ I3 Z8 X - module_param(bcnt, int, S_IRUGO);' t) d4 A* a6 u4 b& v0 n6 [4 G' w
- module_param(ccnt, int, S_IRUGO);
复制代码
5 h! \( g' N$ w6 j: C) U; ] l2 t1 \" X) _8 f: a+ ~, y# P+ t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 n0 v5 S3 |+ B) n2 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- ~( w/ W/ W) S% z. ?" f O5 i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, g1 e- V* `$ O3 J9 @ E$ ~. | c
7 }. f8 W8 t2 k5 m) `( j5 V" C- s/ M/ O
|
|