|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 P) y+ h7 r: \$ l; x
- [code]EDMA sample test application4 k) Q* B' r& O" ^/ Q2 u
- /*6 D. I' w9 H7 n4 u2 q0 m% F; Y
- * edma_test.c, l$ b4 t t, j3 J: J
- *
X2 y; h5 l8 [8 c - * brief EDMA3 Test Application
s) ^8 S, Q( w6 ?6 n - *1 t. ?3 @ T" u0 b" f
- * This file contains EDMA3 Test code.
8 X( F; }! [9 `2 P: `' t - *& R% \+ o T3 C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' \# y/ l5 k; c6 G" p1 d, Q e$ J6 P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- f' m' B: f" B. m' u
- * TO CHANGE.
! i% H; b; g8 K2 r* Q1 d* V. L - *: G* }6 f& S& Z2 D R/ \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( C6 V, H# u) c' [ - *
4 M8 Y0 C7 q$ q: y - * This program is free software; you can redistribute it and/or% @/ X/ W1 E9 A9 T( F" M
- * modify it under the terms of the GNU General Public License as% G# v0 @) t3 I4 s* G- f
- * published by the Free Software Foundation version 2.) y9 `# e2 {: N* R6 Y6 v) x4 `
- *2 `! v4 {6 b* `; M- v& B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! G- c3 Y0 J& @
- * kind, whether express or implied; without even the implied warranty
6 h# E3 u9 V' \1 V& n1 S5 \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 Y0 V9 p; a) f( Q) I
- * GNU General Public License for more details.
1 Q, H+ P$ u' m - */6 B) d! R2 u5 G+ I
- * h8 S) v/ p' Z+ F6 w+ \: r
- #include <linux/module.h>
: a$ @5 |1 d2 T. A6 Z. c - #include <linux/init.h>
6 o, F% n7 ^5 n j2 b$ a - #include <linux/errno.h>
/ K$ L+ z% I* I) I0 x - #include <linux/types.h>
! Q2 v# [3 z: e/ ?' s$ V - #include <linux/interrupt.h>2 q4 \& r. j; g1 p: `' Z3 y
- #include <asm/io.h>
; M' A$ q+ y4 u7 a J" i3 q - #include <linux/moduleparam.h>; J2 w2 d' `8 e8 M
- #include <linux/sysctl.h>
2 [7 s6 U$ C. e* l - #include <linux/mm.h>* I$ Y: V" J* d, c0 ~
- #include <linux/dma-mapping.h>
/ N, b$ z9 Z i8 T% e/ X
0 ~0 w: K# _# O7 E' J- #include <mach/memory.h>8 T# U! z8 K; k( \' V
- #include <mach/hardware.h>
1 t- T, F/ h. t: e - #include <mach/irqs.h>
2 S3 _+ }, G2 h f# Z - #include <asm/hardware/edma.h>
. W+ k. x" f' y! P6 ?2 d7 u$ S* u - , {4 k% ^- x. K# E5 n
- #undef EDMA3_DEBUG
, U1 e- x: G8 z: z - /*#define EDMA3_DEBUG*/
- y9 q1 ]1 M( V( \% x( r! C - ' D! x, Z0 T6 I5 C
- #ifdef EDMA3_DEBUG1 K% b& O, _ h; |( w* V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! s4 m6 p! z T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! C/ j6 | G1 O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- J8 D( E! x$ D
- #else
8 W$ c8 D0 _. s2 @ - #define DMA_PRINTK( x... )' T' i' s6 C$ D+ c
- #define DMA_FN_IN
% E( O6 T7 Y8 v' D2 b* D - #define DMA_FN_OUT2 @* ^& i& k' V* _7 ^9 Z
- #endif7 X/ U: ~6 y( s" R$ |- |
+ C- \; C" v' M9 {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 Q2 a9 x3 u _, `2 l - #define STATIC_SHIFT 3
\, @# e( n3 ~$ } - #define TCINTEN_SHIFT 20
( Y2 I9 _+ a- ~: c7 S2 X - #define ITCINTEN_SHIFT 21
. b; L3 l1 Y' J9 J- X6 L - #define TCCHEN_SHIFT 226 I; {: F' |# W* a6 w$ t- V
- #define ITCCHEN_SHIFT 234 j5 c9 R' G2 b; f1 m- ~
( A( V0 k! e9 b& J% Y( f- static volatile int irqraised1 = 0;1 Y) i5 l! b' d: W! B
- static volatile int irqraised2 = 0; L! [9 H9 C. C
- $ V, V& K2 U; W* m4 k! N) v2 j9 Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 [% ~: @# u2 Y- K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Z4 ^# m8 @- v, e: G2 I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ n9 M5 u2 z+ N- J( P
+ C V3 V+ O+ T0 F- dma_addr_t dmaphyssrc1 = 0;1 V+ R# d; q7 m5 ?9 j
- dma_addr_t dmaphyssrc2 = 0;
3 X& {6 K' V' |: b - dma_addr_t dmaphysdest1 = 0;
1 G5 S+ ]) w. S- `! P - dma_addr_t dmaphysdest2 = 0;
+ R' T* \; H2 B0 M- F
/ y0 E+ e B+ _* }- char *dmabufsrc1 = NULL;
$ @( l4 h% Y. Q3 s3 C9 {7 s - char *dmabufsrc2 = NULL;7 b9 B* W+ z8 W) W3 x) V
- char *dmabufdest1 = NULL;
! ]0 d: L3 t2 R6 _ - char *dmabufdest2 = NULL;
' |3 f0 n& y5 L# P* B+ Q - ' L, s4 v; k. w9 _
- static int acnt = 512;
. d. e' C8 ^; q9 N; p7 L+ c1 H; Y$ G - static int bcnt = 8;) o1 d8 W% }; @- R# q1 D- n
- static int ccnt = 8;( w! H- d+ \4 r6 K# ~
* j+ F' C# S9 n/ n1 C4 z( v- module_param(acnt, int, S_IRUGO);' A) z) B! e9 l4 v% Y
- module_param(bcnt, int, S_IRUGO);5 H5 M6 v, ~ v( x3 `! G) S6 w) \& Q
- module_param(ccnt, int, S_IRUGO);
复制代码
1 ~; ^' @% Z, T2 v3 {! P
4 c+ L3 X4 r- m+ P9 r8 P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% T; r! W* Q7 _' [( n- O- w0 B9 L7 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" r$ d6 l# h8 l8 M1 s5 [0 `8 `; c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- z. P+ a, S9 W
7 x ^. E; p) @: S; W$ L# |1 H
|
|