|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 G/ F8 _6 M* V) O- [code]EDMA sample test application% c: X7 @/ u2 G" ?0 s% [- {
- /*, b: ?, J7 m- S' T F; Q
- * edma_test.c
% M7 t( l' \: M9 M - *
! q7 L# b) {- h5 S$ w3 Y( ~ - * brief EDMA3 Test Application
, H+ m% [' m# ^( m4 F - *
* I$ l8 q8 I: ^+ z3 M - * This file contains EDMA3 Test code.9 w& U; o+ z( E, _8 y4 d8 b# J
- *
4 g# C" G" R- U. H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 }5 [, H5 \) e8 A$ N& S0 H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ R+ A- i& A P' k' f6 P; O - * TO CHANGE.
- W# O9 k- `- i; K0 E8 @ - *
5 L9 {: U9 t9 d6 i& b5 n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ O+ `; I( v) {9 f" ?1 s7 n- A
- *
/ j7 ^7 X# s5 u* I - * This program is free software; you can redistribute it and/or2 p7 e, t# @5 D/ ]) g( c
- * modify it under the terms of the GNU General Public License as
! Q2 ^5 P- w- |( r F - * published by the Free Software Foundation version 2.3 J- v* j6 P H7 H% v& F4 p! ~
- *- ^6 ^ M+ k/ ~8 \9 T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ g% Y# w n; |6 P - * kind, whether express or implied; without even the implied warranty
. H6 I% ~. F! g1 ~& R: y! g/ V# K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ C. }; L; P, I9 r0 l3 H2 U2 Z - * GNU General Public License for more details.
. k" m: \ ]% s2 s - */
# D* h, a# |* b% R2 `( F - 2 b6 h5 m& g: @
- #include <linux/module.h>
0 Y/ t1 f2 x# d - #include <linux/init.h>
) p8 c2 R. J& u7 w) T - #include <linux/errno.h>8 C- D+ o. Z3 y+ X8 I- b
- #include <linux/types.h>' v) B# F& f( i# n9 O' M
- #include <linux/interrupt.h>
% Q2 W0 S3 ~: o, S u X8 [ - #include <asm/io.h>. D% c( f" p! G5 v% w$ _; j7 z
- #include <linux/moduleparam.h>0 Z% y9 `# M. T$ O/ O3 h
- #include <linux/sysctl.h>
% @7 I: l; W7 U: u v - #include <linux/mm.h>
, z8 Z0 E7 T8 j: r& h7 t: z" T$ a - #include <linux/dma-mapping.h>
( G" p$ T/ k; a5 i& `9 ]
" m; H% j% H. V/ A/ O- #include <mach/memory.h>
! p2 u# A1 a1 W7 B& t" i - #include <mach/hardware.h>
# ~' a4 v. T4 p2 l - #include <mach/irqs.h>& S6 F0 p U* l- _ H1 O# H8 {! A/ Z
- #include <asm/hardware/edma.h>+ J* }7 Q; l0 Z# b7 v& s& M
, _5 d7 k2 @. Z( a- a/ s- #undef EDMA3_DEBUG& v, V) ]7 @- o( x+ z% B
- /*#define EDMA3_DEBUG*/
) m# Q* Z3 B. \; A6 q" }: X" Q; B
! ]6 B+ B, j% n+ [' C- #ifdef EDMA3_DEBUG$ ~( [/ d8 O" f) |2 P4 {8 T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). {/ Y, F5 ~) J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 R1 S: X4 N K/ K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ ?: n5 d. w; _2 T! p1 D! l4 ` - #else# l* t+ \. {% T6 G% [: w$ n; Q) q
- #define DMA_PRINTK( x... )
2 {$ V" j6 O) o' A' U - #define DMA_FN_IN
. k, v7 F+ ]% }- v, X2 U - #define DMA_FN_OUT) b4 M# r/ k9 E8 S& k O
- #endif6 F* c/ ^# c, d! t# S4 Z
- ! C, v" R7 }/ i3 K0 ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 I5 a" W7 j8 T! v$ {2 O7 V+ L r - #define STATIC_SHIFT 31 c0 X( h' f! q) A
- #define TCINTEN_SHIFT 20
3 G3 _2 C) }/ \ h' n, m! H' N2 l! X - #define ITCINTEN_SHIFT 21$ a5 r l4 x( x `
- #define TCCHEN_SHIFT 22+ C% ~4 x* P, [5 N8 g
- #define ITCCHEN_SHIFT 23. O! R/ Y' U+ i& v( a9 Q9 {. I
0 h. M0 o8 D# h* A1 i- static volatile int irqraised1 = 0;! T" A- B" r' [6 k# b
- static volatile int irqraised2 = 0; s2 \& h7 I' K0 O- b2 R/ j$ B
- ; C2 ?/ E4 K1 i% }' }+ e; t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) p) P1 l0 {" u3 Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ z, A. {' g' h% H& | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. s- |. N0 c% g) U2 r f
: T B' u: e: D5 q U- dma_addr_t dmaphyssrc1 = 0;! ` {3 C% J' a
- dma_addr_t dmaphyssrc2 = 0;4 Z L2 l7 ]) L$ \- U
- dma_addr_t dmaphysdest1 = 0;
" z, N1 Q% E1 p5 m9 _ - dma_addr_t dmaphysdest2 = 0;
9 j2 L U7 K9 h) l' L. p
, c) ^1 P! z8 h& ~8 P# p- char *dmabufsrc1 = NULL;$ F& B3 r: v3 X
- char *dmabufsrc2 = NULL;1 ?+ {: [7 c+ P, i
- char *dmabufdest1 = NULL;
2 E v1 @ t; ]7 v4 W4 t - char *dmabufdest2 = NULL;
9 d% d5 s6 Z" N' q& [2 q2 [ - / B4 x8 b2 d. w7 w5 ]6 C
- static int acnt = 512;9 M2 n2 B2 P' T- K( t, p
- static int bcnt = 8;
3 P& @6 P* \. \6 E' \ - static int ccnt = 8;% t: D+ F$ L# Q3 ~
- ; p. \) F* l V' B
- module_param(acnt, int, S_IRUGO);
# \+ M# W3 @0 U* R$ Q' a - module_param(bcnt, int, S_IRUGO);
, a/ c/ {1 }9 P9 `$ l0 S& K - module_param(ccnt, int, S_IRUGO);
复制代码 8 O! s& J- v( b* X/ Y/ q) c
- K i( I" J4 s8 w6 ?1 x: k* n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( o' {; o1 g; {: K$ _+ p7 c2 p7 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( V" W+ b8 w& f! z, O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" t/ |" d7 @, U6 U- k* D
- c( G' d2 y* m# I1 y; K! U* L
B6 {( x. h ?' _8 A6 S" a d |
|