|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! m2 E' R$ I' H- [code]EDMA sample test application1 O" w5 ?) F+ G# H q
- /** k5 n" W/ A5 [$ e+ K* V" h
- * edma_test.c
; n3 F( I( t) A! H m( [ - *
+ V- ]0 B- \* M% m - * brief EDMA3 Test Application' B, |, B% v1 p. h* Z
- *
4 M& x& | a" v% C Y - * This file contains EDMA3 Test code.
0 N) a- ]; p5 t& p9 g0 n+ i - ** b3 f* T! Z! {
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 e0 C8 O7 z/ g+ h1 o0 X5 l$ v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) t! O! K8 n: C- D1 X1 U' j
- * TO CHANGE.$ D" H: G3 q8 u! O) l# e' y
- *
$ n; b. |( ~& y! G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 T6 `, @; w. G" B7 d - *" z) b5 y6 D+ p. L I; Y1 A$ [( t) S
- * This program is free software; you can redistribute it and/or
5 u8 p1 V) T: ~& z% _; Y - * modify it under the terms of the GNU General Public License as
2 B* t6 K5 M1 l/ m - * published by the Free Software Foundation version 2.# F2 ?7 \# c+ O$ B& X- Z
- *
7 v. ~( Z% k$ P+ p! Z( w/ Y1 s$ S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ {! W; Z, Z! D) @ - * kind, whether express or implied; without even the implied warranty6 A3 p# ^, T; |1 B% {8 c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ F5 t8 F6 s! M D% m0 ?
- * GNU General Public License for more details., s5 d+ W# `* q
- */
0 R( k% t" v# Q4 p! e# W. c! k ^ - , y$ J, k# q/ x
- #include <linux/module.h>' f- j% d" {" g* L8 j* u- D
- #include <linux/init.h>/ s$ u. I7 U# p
- #include <linux/errno.h>9 i, M: F( ]5 U) R! _
- #include <linux/types.h>' P8 ~1 }6 {$ M5 |) e6 k5 i
- #include <linux/interrupt.h>
8 |6 n0 O1 ^* p! \* W - #include <asm/io.h>
- n/ n; J4 s8 l' C/ m- i5 V, T( S- L - #include <linux/moduleparam.h>
# D" f% B# U. w* N. J+ b3 q! V4 X - #include <linux/sysctl.h>$ @1 Z0 `/ q4 G+ L2 ]. R
- #include <linux/mm.h>
3 U6 P, Y& O" y2 }# e; g8 R - #include <linux/dma-mapping.h>$ H# |0 B7 H/ c5 X1 v# u9 ~- @4 ^$ S
: Z- T0 g. r0 H f9 j# y- #include <mach/memory.h>
]8 }5 z1 j% N: w+ V9 q/ L) G' P# U - #include <mach/hardware.h>
! V( l( O: T9 h! }1 W1 @ - #include <mach/irqs.h>
" y0 A1 Q6 x4 c7 ~7 W1 u3 T - #include <asm/hardware/edma.h>
1 m1 P( K+ O+ _
7 I ~( `: l2 _, V' O- #undef EDMA3_DEBUG% o h- V+ E! z Q3 [
- /*#define EDMA3_DEBUG*/
2 r8 z" r& W7 |5 a+ ?/ n- H
: f/ e5 v: U$ _* X* w9 X- #ifdef EDMA3_DEBUG9 ^; D9 {6 F" T0 `- @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 K+ x4 l5 y& J* r+ L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ f J# {: U# ]* F3 _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 d/ L0 B1 r$ Z+ |
- #else
2 _) m& L, l' _7 H+ c' q1 V/ q - #define DMA_PRINTK( x... )
2 `& |# q) d* n7 a - #define DMA_FN_IN
* P/ O; j3 F; L5 ~0 l7 ~$ a - #define DMA_FN_OUT# ^' `: u+ [# v3 n' b( n
- #endif
, @$ g' b- Y: L: F - + W6 C9 }* _+ H. ` y6 r$ `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ ~9 c4 i' _) o! o - #define STATIC_SHIFT 30 d) `7 X( M0 q4 b' [& V: m4 b
- #define TCINTEN_SHIFT 20
' V# H9 X* @/ ]9 e; i, d - #define ITCINTEN_SHIFT 21
. l4 `3 s! n+ @) X7 } - #define TCCHEN_SHIFT 22
; h" ?9 [% ]# r - #define ITCCHEN_SHIFT 23. b+ Y( L4 \5 {; ]+ Q
- l" H- Z$ E5 C3 d/ F9 X1 k
- static volatile int irqraised1 = 0;
! m" ?1 o& v- X# s. S/ t - static volatile int irqraised2 = 0;* v) ?- l) k1 F. o5 ~* |0 i
- ) ~( b0 T. m# B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ A3 J; F; z, J7 C! O. B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 p1 |$ [7 z+ @7 E" V' {; O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ?' X6 ^7 H" I* R9 q
- : v, R Z# d) h1 h+ a# K
- dma_addr_t dmaphyssrc1 = 0;
: a6 b( z r) `% C; f# U( u8 ` - dma_addr_t dmaphyssrc2 = 0;
$ [+ ^. E# e9 _1 b0 H - dma_addr_t dmaphysdest1 = 0;# L( O( b0 y% {$ Q
- dma_addr_t dmaphysdest2 = 0;6 ~/ ]6 b" d% Q9 @- y4 |
- + z" ]. r4 E1 V3 i: I1 m
- char *dmabufsrc1 = NULL;6 F2 M4 o; Y) S9 k1 g+ }; I
- char *dmabufsrc2 = NULL;6 g7 Y- h+ w' |
- char *dmabufdest1 = NULL;
9 W2 a5 Z4 v3 \- s' D - char *dmabufdest2 = NULL;
! m3 C5 A1 O E N- ^% U) x
: h5 f3 n! h8 {" u- static int acnt = 512;
/ c- l) w7 z0 R7 a' D9 p! C7 t" Z) k - static int bcnt = 8;7 I# a* n4 Q+ n J
- static int ccnt = 8;
3 m) f3 C$ f/ W j7 _( k# } - $ z5 g/ H: ]' l8 B$ _2 R
- module_param(acnt, int, S_IRUGO);: Y U, N/ ^% `: X) M; W2 `% l! |
- module_param(bcnt, int, S_IRUGO);. N% x4 e0 z7 _+ }% l
- module_param(ccnt, int, S_IRUGO);
复制代码
5 k( G; d" _8 X& V! l
) q1 \& ~2 O6 d- s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 |6 n! t7 D5 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 O3 U, u) h% r- ] h. P/ X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" U3 f3 A% y" I$ }2 {5 T
3 `' i( ]% c7 c2 P7 x* {/ t+ b
$ h0 y# G5 d, y) m" A+ b |
|