|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) c$ H, E6 B, O: d7 e0 a9 j- [code]EDMA sample test application F1 U$ w5 Q3 Q0 H2 b
- /*# M* }: |, x2 s/ G( F
- * edma_test.c9 ]4 ]; h& u9 _: U' Y3 `
- *+ i1 W7 ]9 O0 h1 m
- * brief EDMA3 Test Application4 f6 b: \( A) M& G0 [' o
- *
" |6 t9 D/ E8 {5 j - * This file contains EDMA3 Test code.
& P' n6 G' x% F$ Q - *
3 q; g/ Q& c- u. _- v; |% |$ E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ x* v, D1 h- X" v" ]8 _7 m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* ~# \2 C9 e" O4 o) S$ ? - * TO CHANGE.% B# h0 S( H! i+ p
- *
4 V4 C3 i3 [5 U$ p5 u# y0 e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( ^/ o' J/ q3 e) q
- *+ U+ p' J8 M: w6 |6 c
- * This program is free software; you can redistribute it and/or7 e7 E) ~& g' V, w9 p' L% R
- * modify it under the terms of the GNU General Public License as
$ K+ E8 Z0 b" Y p: x$ a - * published by the Free Software Foundation version 2.
7 F, s3 H% t( S - *
$ m7 ?9 C6 h i+ H6 x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 F. }6 b& ?: I5 ?
- * kind, whether express or implied; without even the implied warranty7 q# D" R2 t! ?) _: w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; B. S @4 l: Y8 K* o! N# v
- * GNU General Public License for more details.
* h) L' y/ S8 i5 t7 w0 z - */+ N9 P% _4 }+ Z% g" v8 H" u) t
. Z6 U$ i+ ]4 v, ]# ^- #include <linux/module.h>2 y& C# R: l' U# m
- #include <linux/init.h>
$ P1 E6 z8 @1 J1 O( e3 L - #include <linux/errno.h>: g, L+ ]1 ~# g! q+ X0 i R# B5 r
- #include <linux/types.h>' W) U# g1 p; h$ Q* X
- #include <linux/interrupt.h>
. x7 z& A. k( M2 s4 X - #include <asm/io.h>
! E( g! [* Z3 r v; n8 X - #include <linux/moduleparam.h>
1 @! Q+ j- D0 x - #include <linux/sysctl.h>+ ~8 r8 i1 A9 ~7 c
- #include <linux/mm.h>) U- {: E$ F/ T! `2 O
- #include <linux/dma-mapping.h>; n) H: y) F l1 D( G& d
- / t& Y8 C# n5 d6 k* `) I" I
- #include <mach/memory.h>
) @9 [+ [: ? [. {6 G6 ^' H - #include <mach/hardware.h>3 N- K9 G9 f" Y4 x, i- T; ~3 }6 ?
- #include <mach/irqs.h>$ D% I' D3 B1 ^( i& u9 Y
- #include <asm/hardware/edma.h>
- b+ ^5 H' F+ E0 J
! F5 |7 D( C2 q1 h0 F- #undef EDMA3_DEBUG
; V/ G4 G/ R# S; @# p- x - /*#define EDMA3_DEBUG*/. f8 f1 e/ X& }) v" L) ?5 h
$ c) v% D; H7 h% U2 |' S# t- #ifdef EDMA3_DEBUG" P& p2 ?$ C# H- o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# q! G) r2 k$ ?) _8 x2 r- c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) Q; n1 }+ ~0 g, |, |: z$ E7 R) O2 G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
l+ f1 P- U! A l' T& l( h - #else+ @/ J- C I9 M8 m* S$ d
- #define DMA_PRINTK( x... )
+ u/ ?$ S5 o' h3 ~' Z; @ - #define DMA_FN_IN
( g5 y6 ?/ x) C O( F: K( R* L - #define DMA_FN_OUT0 ^' ~) P6 u; n% ]8 h- l8 p
- #endif
+ C/ X9 p( X0 R$ k+ n
; O5 l/ T2 X& d5 @" @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. | E8 f: R0 ]! N4 e4 |2 } - #define STATIC_SHIFT 3
: g! ^! r2 Y* }7 `3 O, U1 p - #define TCINTEN_SHIFT 20
* |$ i. r8 ~+ |# ]" e4 E - #define ITCINTEN_SHIFT 21+ Q7 Z O, A" |' _, l3 `$ l9 [) E
- #define TCCHEN_SHIFT 22
9 n& b0 N# g- P9 t5 E2 A! j1 i - #define ITCCHEN_SHIFT 23
4 _( R2 e$ i1 U% z! C: ~* H
& _) Z5 t3 R% U0 G- static volatile int irqraised1 = 0;, z8 ?# t7 S* q) j
- static volatile int irqraised2 = 0;! K9 d8 D, g" G% J; f
- / g4 W5 F9 u8 x7 ]7 ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Y6 v6 C( l8 u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' P9 A3 C3 \6 j# u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ~5 J, J# C+ G1 ~, }0 H# a- E
- {* }& @/ E2 H# W# y- dma_addr_t dmaphyssrc1 = 0;' g6 P f5 Z% I7 \3 o* ~1 C9 [" P
- dma_addr_t dmaphyssrc2 = 0;3 ^2 t5 [$ N8 X6 |) l9 ^
- dma_addr_t dmaphysdest1 = 0;/ }9 a/ Y" _( F- A
- dma_addr_t dmaphysdest2 = 0;! v/ R2 t2 V$ `1 Q. [! E* m8 v# }
- - R$ H$ O! H6 V8 C% I \
- char *dmabufsrc1 = NULL;
' C* a/ e) h& [8 g' Q% B - char *dmabufsrc2 = NULL;
) m) v, D& a8 p9 }1 C, }0 x. m - char *dmabufdest1 = NULL;
: |/ \! I* V7 f! X3 s* y8 s' V7 ` - char *dmabufdest2 = NULL;
3 F9 d s3 i T1 F' } - ( u) w# J2 c+ l" m; P1 P/ m/ b
- static int acnt = 512;
; H$ u: a4 R( s9 b8 a4 T - static int bcnt = 8;
9 I! ~& O! C& k - static int ccnt = 8;
8 A6 H* I$ E) Q - 1 e W/ E0 e. T$ t+ Q
- module_param(acnt, int, S_IRUGO);7 j' |0 e4 V7 j0 b) c6 A7 W
- module_param(bcnt, int, S_IRUGO);
. P6 F$ G& p, {3 q1 J - module_param(ccnt, int, S_IRUGO);
复制代码
# d0 R& W$ _- k0 c
5 d) }6 |0 X! d+ {. Z& ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 _4 U+ w) N0 w* h- ]* w+ t! N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- }% B% {5 }0 ^" I& v% G0 N1 U( U; \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 A& k8 Q- R5 q$ c; {% X+ S% \8 x& h
$ m! F5 F$ p2 X/ ]
, Z! w: b; |% k* X: v0 N6 { |
|