|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 a) c- X5 j3 R8 W6 f- [code]EDMA sample test application8 E6 t3 K3 r) Q8 `7 v+ r; Y A
- /*) P5 ]; G4 h2 M% ~3 T; b* b' P' Z
- * edma_test.c/ i+ b, k1 G! e- C3 T/ E; c7 p
- *% D) J2 R4 W6 u
- * brief EDMA3 Test Application
) t, B' Y$ D6 E/ O* ?5 k8 q - *
& u# o0 R7 ?2 Y - * This file contains EDMA3 Test code.! P d! c/ r) j8 |; |
- *
" K$ s+ J& E- a4 J" N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) t2 e5 L1 ^. {2 Q2 C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 I4 `( s" L& V v$ z
- * TO CHANGE.0 x0 E Z: X5 k% v- K
- *: w# K( C$ r1 g1 s; t$ s. Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ F( ]/ I7 V; y: e
- *
% Z5 _# D; \3 e& e( Y; w - * This program is free software; you can redistribute it and/or1 m6 n& t* T( P. M* q
- * modify it under the terms of the GNU General Public License as2 {* ?5 E( P5 y7 v$ r/ k. j
- * published by the Free Software Foundation version 2.$ P- I( ?! ]" O1 Y; N# ?
- *( Z- Y/ ?1 C2 Q6 f' `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' p g4 c+ O! v! Q5 S
- * kind, whether express or implied; without even the implied warranty' x& e" K8 A" R7 G: A( R+ D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ I0 Y' V" l, \ - * GNU General Public License for more details.
& ^- L/ L/ }7 m - */! D$ A" G2 F8 a8 M( k) Z
0 B# a- ?: @# ]- #include <linux/module.h>
9 _" f" a2 r" z" h* X5 n4 t - #include <linux/init.h>
5 N" a5 m6 z J( z9 T9 J8 d2 v6 ^ - #include <linux/errno.h>
8 x, A: J* t! A - #include <linux/types.h> s R% O/ r) B' z2 D5 ^
- #include <linux/interrupt.h>9 p3 V; D' W: B% F* R' ^& Y6 l
- #include <asm/io.h>
: w( m8 }( }$ L0 y - #include <linux/moduleparam.h>
& C. ?. g h, W- P# _ - #include <linux/sysctl.h>: u9 h* T% ?( i
- #include <linux/mm.h>
9 N; k% M* \& v" R$ B C3 c( m - #include <linux/dma-mapping.h>
9 c$ S- U* @0 {) \; q; o @% D - 0 s, ?3 d `" a% ?9 P; J. v
- #include <mach/memory.h>( ~. o: l1 M! w, l; S% r
- #include <mach/hardware.h>
2 }* ^% a/ Q/ T; i8 s - #include <mach/irqs.h>
6 y3 }1 C! ^( z8 N: J/ J. z- T+ e - #include <asm/hardware/edma.h>
/ e1 R+ R. R& M+ P- V. g' H" r! K
( S2 ~$ ]) `# @( d" Z- #undef EDMA3_DEBUG
4 f1 \, h# [8 w0 F4 P' f9 c - /*#define EDMA3_DEBUG*/! n0 U5 h. n( w/ B) E. }
0 ?; J- n+ Z. Q- #ifdef EDMA3_DEBUG
" N. k9 ~, Z c; ^* | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 t7 w- q* l% z5 R3 [" } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% @2 `7 k& \5 P: h# \0 R2 \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 ^. m; j0 x) X8 g! Q1 `0 v ~ - #else" {$ B! W: \% @' W3 v: n: m% A
- #define DMA_PRINTK( x... )
5 N, g; \& _& O7 T - #define DMA_FN_IN
/ e/ ~/ m. r) q! R7 S+ J# S' F5 n4 W - #define DMA_FN_OUT
+ D6 T+ O7 r" V* n8 ^) l! [7 a - #endif5 h* x) |6 h0 @& G) K; }2 ?
" @" f: r! m3 I. ^3 _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& I1 k& G: E6 g, n' x3 N& ~' J9 g
- #define STATIC_SHIFT 3
]3 X7 y. n& c- u7 w& A- x - #define TCINTEN_SHIFT 20" X/ h4 [) z8 U
- #define ITCINTEN_SHIFT 21
& V4 m4 C! Q7 r5 H/ F, R - #define TCCHEN_SHIFT 22
7 c& r$ R# v% S- V9 O, f - #define ITCCHEN_SHIFT 231 H H: l& p. _
- ( F* [8 @& Y: V1 i5 v
- static volatile int irqraised1 = 0;1 s! S( z: L# }
- static volatile int irqraised2 = 0;
: F8 E" T4 Q: @6 [) q) U - 1 c9 I8 [; X6 T% J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: f2 |. }8 g( u( g& c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ {! I: l8 i A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 f3 M& |. O) c1 ~6 n - & Q9 H; e$ r1 h( `2 J3 c* ~1 q
- dma_addr_t dmaphyssrc1 = 0;, r/ E3 G3 O9 U5 f) N
- dma_addr_t dmaphyssrc2 = 0;
1 V2 [$ t" m' `+ w9 r1 T6 k - dma_addr_t dmaphysdest1 = 0;
! [3 a4 S( E8 x( }9 M" ^ - dma_addr_t dmaphysdest2 = 0;7 n+ n* k8 D! M! t
- . @+ D* U9 Q, g. b
- char *dmabufsrc1 = NULL;1 L- _3 F* {2 [: w+ Q) Y `
- char *dmabufsrc2 = NULL;
7 C3 C0 r5 j' E. g5 K - char *dmabufdest1 = NULL;
4 G' D- n; N3 P; f3 s6 h - char *dmabufdest2 = NULL;
& M: O. y- `* q/ S, T2 \
* {" B4 S q6 h2 M# d; w- static int acnt = 512;
2 }- s, u g) _9 M' B - static int bcnt = 8;
$ C, J+ _9 c5 y( ]- O7 j - static int ccnt = 8;
$ ]; g* D5 f+ P9 s1 Y# S
4 o/ c$ g0 C8 F0 y- module_param(acnt, int, S_IRUGO);5 \' N. {, l" g: [- @; w; y
- module_param(bcnt, int, S_IRUGO);
8 l5 ^% R/ p3 S! X# {* a+ l - module_param(ccnt, int, S_IRUGO);
复制代码
& Q" Z% Q* a8 E$ z' A' _; a' o$ e7 ~ A( S! e+ s- }( V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! V+ P( x% w$ T$ g; a% \* D, F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ k' ^, h: \1 z+ o' S2 x* @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ i+ A# ?/ C$ f2 ]5 `' ^
/ G& I0 e0 O E
7 i- x1 H$ p% X* X |
|