|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 v1 C D$ s5 s/ Y: G# f7 e* `1 x3 {$ l- [code]EDMA sample test application: R7 N% {- r( X8 ?( m- w; q
- /*
; Z% N0 q* Q* X1 `% ?5 j4 _ - * edma_test.c
/ z6 l) x4 e: M& E/ B* V3 m9 |( x - *8 K& ?' f# \! a' s# ^/ Z
- * brief EDMA3 Test Application
& V, u! z3 P5 U- a9 ~* ] - *& e" q: E( x4 \ k5 e3 b1 D; b
- * This file contains EDMA3 Test code.
& o) w, n' Z3 V1 X7 a$ T6 \1 A+ n - *
! |% g/ N- g6 H" M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 F4 [. I' M8 x( U8 h' E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 ~6 ` u" W5 a& v/ }2 C) ^ - * TO CHANGE.- D2 C( b. F P/ p2 z
- *9 Z7 Y" a2 y* N. N4 @/ K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ S& X* E' m0 Z/ u - *
3 P; l4 T5 g, e - * This program is free software; you can redistribute it and/or
/ n: Q1 @9 Z6 S7 [4 C - * modify it under the terms of the GNU General Public License as
; M2 h- {2 i; l- o - * published by the Free Software Foundation version 2.( P: X& i3 y# C# I5 D" }
- *
7 f0 A* a& }+ H5 I/ { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 D+ r L$ d6 ?3 F - * kind, whether express or implied; without even the implied warranty
; r: {& M' _* E- G" A" v* ^% R6 R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' T( a' x' s4 ?7 j
- * GNU General Public License for more details.
7 T6 l" O" [, O4 A7 S - */
- s' V/ O. f# V$ V$ D' k, p1 a - ! S# r- D) l& k1 N1 b+ J' R" j
- #include <linux/module.h>9 |' m% m0 v+ K' O8 O+ O
- #include <linux/init.h>3 z) Z7 I/ I7 v' W! J# ?
- #include <linux/errno.h>9 X3 f8 x7 b6 C
- #include <linux/types.h># j0 A, Q+ d* ~' v
- #include <linux/interrupt.h>3 ~5 {9 N! Y# H$ Q/ p& s. \
- #include <asm/io.h>
" |$ S. m4 c8 `6 O - #include <linux/moduleparam.h>& P7 S& c! D6 z- V+ D; @
- #include <linux/sysctl.h>/ |: H' v+ \& c7 ?! N
- #include <linux/mm.h>
8 Z' u) [: x% b - #include <linux/dma-mapping.h>
8 d" M2 S8 f1 `* v- k2 W - ; |4 j' C/ M8 x3 {$ l) I
- #include <mach/memory.h>
) g. Q1 k+ }- O - #include <mach/hardware.h>
8 ]+ S4 w$ ]7 u! H8 u# _* ^7 e9 i - #include <mach/irqs.h>
5 P( e6 q! X& ~" \" | - #include <asm/hardware/edma.h>
+ z2 r# ]6 Q3 ~% {* z - 7 S9 j6 e4 q/ B7 P: i
- #undef EDMA3_DEBUG
5 a* ]2 R0 `3 z2 b5 ~ - /*#define EDMA3_DEBUG*/
}" ?. d( U: p! g" c - : m ]$ L L3 s, e
- #ifdef EDMA3_DEBUG
3 ~, x+ l) N8 _( W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 A5 |5 f/ ] P6 F' Y: v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- T+ c; `1 ^" R( Q0 R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' y2 y9 H0 l/ R - #else
9 [9 W/ [& o% p7 X - #define DMA_PRINTK( x... )
0 J `( @' c% K7 `- N k+ { - #define DMA_FN_IN
4 x9 {8 \" ~) ^2 x% |$ K - #define DMA_FN_OUT
4 u; Y ^* s; f8 x6 [0 [: w& }4 Y - #endif5 d$ c# D& P/ i. k4 i8 N
- " W# A5 F" H# f1 e& [$ N% d/ R. f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). }& p) f2 Z0 l1 s8 ]% t! [
- #define STATIC_SHIFT 3
* e; L/ w& k1 F1 x* V) F# @! `) y - #define TCINTEN_SHIFT 20
1 m; l# b& O: e0 ? - #define ITCINTEN_SHIFT 21
" T2 n6 e5 L5 ?7 {7 q2 @ - #define TCCHEN_SHIFT 22
5 \5 U) E) w- c* S3 G5 M - #define ITCCHEN_SHIFT 23
" J: x0 W% A* s. D0 X& F. R - - A% t4 E! x' _' ~, ]3 o
- static volatile int irqraised1 = 0;( n; h: K5 k; W4 T, I" A5 l8 } v
- static volatile int irqraised2 = 0;3 I6 P( P1 O5 _2 O; P
1 p. Z! K, K8 h$ h, x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! I7 q% @7 l* M# ]2 E# Z. e+ \; V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" a- i! A) |0 @$ f: ~, t1 \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- p1 `+ [1 V# z" L
- x8 K+ ~' e0 n8 M$ f- dma_addr_t dmaphyssrc1 = 0;& E# u% U5 c$ l
- dma_addr_t dmaphyssrc2 = 0;
% q; `. l: }$ U9 C: Z+ X1 s- F - dma_addr_t dmaphysdest1 = 0;
" x! W/ V" K$ O: R - dma_addr_t dmaphysdest2 = 0;; J3 M) x# b% E$ y' y# r5 n1 t% [
- " R" {; ]8 f/ \2 v1 J' f9 ]
- char *dmabufsrc1 = NULL;
3 J: b3 s) \6 Z7 G) {4 q - char *dmabufsrc2 = NULL;- e. O( p- a6 C+ I8 [; x
- char *dmabufdest1 = NULL;$ r, N# o& ]5 @: M2 T& s
- char *dmabufdest2 = NULL;: f, x4 L; T( y0 O
- 6 B5 _' f8 q# F4 u
- static int acnt = 512;4 T; r* R6 V1 B' V# T4 f' s
- static int bcnt = 8;2 l- b7 {8 p2 T
- static int ccnt = 8;
( o/ Y9 e! X5 r v! a7 I, K; L
6 @$ U% [5 ^+ U& U& q5 J2 ~/ d3 Q- module_param(acnt, int, S_IRUGO);9 m- @/ Y" b o: g3 m
- module_param(bcnt, int, S_IRUGO);
2 j! e" w% b9 [- k" f - module_param(ccnt, int, S_IRUGO);
复制代码
! `" @# K: J8 A- a/ N
7 O# Y) _# d! p) @8 ^: _/ A9 E, S, C7 P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 M; X3 r( {9 v# u, Warm-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 u; Q: M0 N* j$ f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 R; `7 A! k$ x W; R
& a+ U1 u6 f; a: H6 o
6 K- o% l- d5 a: B9 @ |
|