|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, M! M: ]# A# e3 s4 ?- [code]EDMA sample test application5 [, A( g: K5 e' A: j c; a( K
- /*
: y- K8 v1 {/ V5 l' x - * edma_test.c& a0 C# v- H- W8 g2 T9 }. f0 Y% a
- *
2 T2 z4 n. n" z - * brief EDMA3 Test Application
/ w* S z5 b, U - *
! `& @. l# c0 b3 h: N9 b3 ? - * This file contains EDMA3 Test code.
' k1 w; C S8 Y" u- ~ A) O' P+ L - *; ?: S! H8 ~7 u" b" X2 \' q, n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ S% k$ v6 f5 \$ y% J+ n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" q8 s1 A2 N) z6 X" X. _ - * TO CHANGE.
3 u! F9 W# b3 H; @# L/ v - *8 }( v5 s0 e: R" m0 H6 c$ z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; t+ _: G" v4 l+ F! @- m - *
9 H- ]! o; C/ W - * This program is free software; you can redistribute it and/or
: Q& a: f7 ]$ m, @+ b - * modify it under the terms of the GNU General Public License as$ d7 g, G1 k% j
- * published by the Free Software Foundation version 2.
. A5 |/ v' M( m7 R0 \& y - *
- g+ W4 L) n3 V" ^) O+ Q: W4 h* [# n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ o4 b) f9 Y0 |. m% p
- * kind, whether express or implied; without even the implied warranty% A, L, e( I; v h/ y! K ]" f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 p" @/ d: H" T/ W$ ]: n2 e
- * GNU General Public License for more details.1 E/ M, D9 H' t" p( ]: Z9 |
- */
i6 @ S6 r) ]) s" Q+ p. w
' K0 L+ m. B, b/ R- z- #include <linux/module.h>: [8 f5 T6 M( s5 I" E. @
- #include <linux/init.h>
; ` L* ?9 |' V1 t - #include <linux/errno.h>
+ z, j# s# E! k% o3 ^3 q$ }) P - #include <linux/types.h>: B( H. R; x% S N* ?
- #include <linux/interrupt.h>
0 @6 S! z' ~! x* } - #include <asm/io.h>
; o: y* @) \/ S/ g1 K - #include <linux/moduleparam.h>4 |/ H8 b+ s# M" \2 j
- #include <linux/sysctl.h>4 @! O/ b, } N$ t
- #include <linux/mm.h>
1 ^9 Z: N" [6 w, Z. P - #include <linux/dma-mapping.h>" U' ?* n$ y4 p
8 B, I2 v; e$ X( R5 f/ D5 p- #include <mach/memory.h>
- d# i9 u' W ~7 [ - #include <mach/hardware.h>
. q! I- @ p9 Z5 z5 E4 Y4 I - #include <mach/irqs.h>- D0 H [" S- w- a5 i( p; X F9 ~
- #include <asm/hardware/edma.h>
; p* F- n4 [7 Z; X5 V; @; B
7 |+ E0 x: k& ?* b- #undef EDMA3_DEBUG, s" v3 S/ u2 |# }9 u: z
- /*#define EDMA3_DEBUG*/- B. I- ~# H9 @6 K0 Y5 y
- + k D3 G8 _5 Y- G, c3 Z `3 O
- #ifdef EDMA3_DEBUG3 _) p# X- b6 r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 E2 b3 `4 g" i3 [6 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): a4 E5 M6 Q/ A# M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! G. x$ u* T4 f - #else
E# Q) x/ g3 K( r$ X" ~ - #define DMA_PRINTK( x... )" Z: R$ w X1 f, Z; f, S/ `
- #define DMA_FN_IN2 I4 X: q' F! J7 B `: J
- #define DMA_FN_OUT' ~$ v4 m9 b7 z ]% s( C0 U
- #endif
2 @0 w. q1 T, j - + w- ?$ i9 B5 k% v( S$ G" X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 u! R+ f. {+ k7 {# n, H9 {1 X1 z
- #define STATIC_SHIFT 3
& Q* @. T; @3 t' k! ^+ x - #define TCINTEN_SHIFT 20
. ~; j8 Z; f1 X) _! I - #define ITCINTEN_SHIFT 21& w f; d& H* O! e/ n- u/ A
- #define TCCHEN_SHIFT 22
6 ]5 g q! k4 R0 |; f" t# o6 d6 G - #define ITCCHEN_SHIFT 23
! q1 z' w. z# u, | - # Z) A+ x6 S0 w( s. i* W# S
- static volatile int irqraised1 = 0;0 B1 C; h& {; ?
- static volatile int irqraised2 = 0;( P1 f9 v. z6 v" c
M( o. r$ v- U: N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 O; L5 C. `6 d8 i# G: ~8 r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* s3 ~' {9 b* ~( n7 l* E% l- }! `4 ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 q4 E7 y; R5 s- J" z8 C" g5 g$ o
" c: X' ^9 o' |4 L8 T1 S- dma_addr_t dmaphyssrc1 = 0;! I4 d$ Q6 I. m( s) Z @1 e0 p
- dma_addr_t dmaphyssrc2 = 0;) C- e7 J( @* {3 u' N9 Y5 L
- dma_addr_t dmaphysdest1 = 0;
0 Y8 a) r8 s8 P7 a - dma_addr_t dmaphysdest2 = 0;
. Q2 s% j! h* p5 t' z6 v - 7 i, s) m! A0 o, K$ n9 m
- char *dmabufsrc1 = NULL;" p1 Y0 L, f+ T! Y. O- H4 Z
- char *dmabufsrc2 = NULL;
* U" {* L+ @! H, g# U) A2 J - char *dmabufdest1 = NULL;: ^9 g3 V* T( W6 m
- char *dmabufdest2 = NULL;
! J) }1 W. E: \# t
( g# B ^. z% Y3 a- static int acnt = 512;
! C S8 E0 o; v' B: k - static int bcnt = 8;2 C: a# n0 E: o, [8 A+ |8 d) a4 s
- static int ccnt = 8;6 G" k- Y5 m3 Q1 K
: v9 c C ]+ @: N- module_param(acnt, int, S_IRUGO);4 b( z b! b% K1 c9 C
- module_param(bcnt, int, S_IRUGO);' Z i; u4 b. c1 c3 r/ `
- module_param(ccnt, int, S_IRUGO);
复制代码
' U: x7 A& ~: e+ w' z7 s, f+ F3 U* C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* n$ R! i1 k3 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 D* K$ J8 f0 u5 { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! v* D; I0 m, O/ I3 W7 a) {3 \
& C& ?& h4 d# D8 H; K, i; J
! t$ r& ^! \2 R& i* y& K5 I |
|