|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / o4 r7 R- d0 d- [0 v, c
- [code]EDMA sample test application# z9 c; k& Z# A* _# e6 e' n# n& L( g
- /*
4 T0 \ W4 O: m7 f - * edma_test.c
+ n+ D! B) n# L8 L. E7 L4 L) }7 V - *
6 D6 ^) k1 P m) s# \ - * brief EDMA3 Test Application
# ^' {/ J: a% Y& W( `0 j4 ]1 T2 @) c- E - *8 d" p4 _( @9 D) y
- * This file contains EDMA3 Test code.
1 G& L4 \# e4 \+ | - *4 W& Q" o) O; P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: f( ]( m4 e t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: c7 k$ f0 [! t" C
- * TO CHANGE.5 q0 }6 \. H! s3 Y+ a6 X3 J
- *
* G" c$ ]& g8 z# [+ N' {+ K) l9 G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 d: @) W, A/ ~6 w - *) B, w8 M+ I6 W$ ?5 `, `6 K
- * This program is free software; you can redistribute it and/or. @8 X8 H% U. f- W/ a
- * modify it under the terms of the GNU General Public License as# ?! r* w# U' z
- * published by the Free Software Foundation version 2.. S1 t" H) \2 J. v+ C+ l; {
- *
# M. [2 K. n# H4 G/ {* b% @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" |# D9 N _8 r2 V, c5 f s
- * kind, whether express or implied; without even the implied warranty |" k. m# i6 A+ O- u, D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ g1 G5 F3 o* _- Z0 _6 G
- * GNU General Public License for more details.
3 U6 _) l8 D8 E: A$ H - */
3 c5 ]# P" O; G& H
- ]/ W" T3 N5 Y7 K5 x- #include <linux/module.h>
5 Q9 P ?' X9 ^) n - #include <linux/init.h>( K" ?2 ?0 O% [/ _# {" k
- #include <linux/errno.h>& k. c0 p6 R* Q+ x/ W. j" m
- #include <linux/types.h>% X/ C4 J$ C: X0 f4 U3 |
- #include <linux/interrupt.h>8 C$ i$ L, Y) S5 m. M7 [2 e7 `6 h
- #include <asm/io.h>/ F" K5 ]5 M2 a) C1 `5 X
- #include <linux/moduleparam.h>
7 v8 _- j3 |1 G7 [; ?! X - #include <linux/sysctl.h>
3 y4 P- E- m1 ~: b) f4 ~ - #include <linux/mm.h>3 x C1 l( E$ v9 d4 [
- #include <linux/dma-mapping.h>$ g% L0 n) A9 s( c" ?6 p
- 1 \" z5 w' u6 O; u, B) T/ t! C% s
- #include <mach/memory.h>/ Q7 S0 U) J, E/ E1 V( H; _$ b
- #include <mach/hardware.h>8 k' W7 B' f1 w$ ~' `% W
- #include <mach/irqs.h>
, y$ C3 G5 m- ~2 d/ X. e/ S, P - #include <asm/hardware/edma.h>2 r; T. @3 }4 Q9 p% n2 P
- * S$ H7 K* Z7 {$ n A
- #undef EDMA3_DEBUG$ o' k) q3 R6 U$ [) g5 U
- /*#define EDMA3_DEBUG*/* ~3 _ N6 Q0 R3 i: z' p& I1 d+ u9 i
, _9 ?+ u. k/ D. ~: O- #ifdef EDMA3_DEBUG
. I* \8 t+ j5 o6 a5 }& L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); N" } S; S" z. q" e. l& |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" }! C0 P$ o6 }6 `$ B9 y% b, N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ T6 k0 t o V - #else$ a$ V6 m. k. E1 f( o
- #define DMA_PRINTK( x... )3 \% e, @! S/ _, J- T* |
- #define DMA_FN_IN
: }- z: z+ O z+ f - #define DMA_FN_OUT
1 T' d5 q# h8 L, [ [8 _ - #endif/ u; b2 G, C6 F2 W# [
% }& T. L" v0 y8 V# Q* n8 |; p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 y) {7 P" Q3 d6 g
- #define STATIC_SHIFT 3! ]: P0 T+ R. `, G; ?/ J( u
- #define TCINTEN_SHIFT 20( c1 {2 u9 H7 Q+ m0 f/ o
- #define ITCINTEN_SHIFT 21/ G. T9 c8 [" ]! z0 n" U# @
- #define TCCHEN_SHIFT 227 [0 A+ D7 `( c" r# ^
- #define ITCCHEN_SHIFT 23: k, n: ?; R3 w& e4 C' P
8 s4 }9 @ b' t5 D) ~" e% U' K- static volatile int irqraised1 = 0;$ s3 ]9 ]1 D2 J/ ]1 }! G
- static volatile int irqraised2 = 0;
2 ^0 F t% [$ f3 Y! L5 P - ! [2 N( @0 d# E: d+ K8 q$ H. p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ _3 A6 f x7 E( `( d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 {' L- ~, J. M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) h8 ]/ [1 Y7 C4 Z, O" { - 4 V+ G) F! K1 q+ j R% p
- dma_addr_t dmaphyssrc1 = 0;2 |% l( d& B1 H' `+ p
- dma_addr_t dmaphyssrc2 = 0;
C7 l" d3 I5 \1 V2 n. f - dma_addr_t dmaphysdest1 = 0;" s( p# X, Q- Z/ |6 R+ w3 K
- dma_addr_t dmaphysdest2 = 0;
" [! t1 A- D7 R7 D5 _7 T
5 L* l+ L C5 W6 a) ~( h4 j- char *dmabufsrc1 = NULL;
7 d. l% i) G9 B4 N8 l - char *dmabufsrc2 = NULL;
6 `7 n8 F8 V8 }& a x0 B - char *dmabufdest1 = NULL;1 x: m$ a& d9 Y! U6 i
- char *dmabufdest2 = NULL;0 Q5 i. G+ f7 y7 |$ t$ g. \
& j8 t8 M; j8 i+ O- static int acnt = 512;7 ^# w+ Q: n. o& e9 l
- static int bcnt = 8;
( W! F7 F& s% ?1 y" z5 A - static int ccnt = 8;/ d }* a8 ]) G0 O/ K3 T5 A
# S! W9 l. g$ y6 B$ q& y- module_param(acnt, int, S_IRUGO);
5 w; x- v3 c0 w8 q - module_param(bcnt, int, S_IRUGO);4 T& K5 S6 r' U% @( w
- module_param(ccnt, int, S_IRUGO);
复制代码 : @. n3 S- P+ q( N
- ?8 H( S6 O- i3 O# A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 Y X. s& W. b# e& J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# O. c: W5 A5 i2 |* _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ V+ C4 C# p' F
# ?* }/ _0 D% q* u% i4 g' O9 ^2 E7 o0 g0 e
|
|