|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # V% M; V! m' X. V
- [code]EDMA sample test application V: u' q* U. X1 J. W5 l2 R
- /*
( ~7 R# o, E" s2 h% B( n - * edma_test.c- B1 a( L1 t# s2 L& k; t
- *% _( u# f3 J, c, G% X9 m8 o5 @1 ?) H
- * brief EDMA3 Test Application c% a7 `, D; m7 W
- *
7 A1 s" Q9 _+ f5 S' v - * This file contains EDMA3 Test code.
0 ]( a8 ^: m( T) g" P: z, |" C6 N - *( u! b/ Z" A& ~) e9 a+ S' p, |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; O* p, b. ?6 O# L$ Y7 ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ p8 X; g9 f7 I2 f. U$ l' h - * TO CHANGE.
; h7 l& R7 z) E* x4 v' l - *
/ I3 Z1 E* }1 f+ x8 u( C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, ]& ~2 r! B2 S$ r - *
+ [6 ]/ t& a- N: q - * This program is free software; you can redistribute it and/or# L8 {0 H- _, C: r+ h1 r N4 G
- * modify it under the terms of the GNU General Public License as F1 u6 ^0 Y$ S( ?3 w
- * published by the Free Software Foundation version 2.% t% h7 x% F9 X; f' W
- *; m, a4 E0 x6 P4 f+ l" N3 U9 J4 w6 e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 Q8 j" ` H& q, ^7 s - * kind, whether express or implied; without even the implied warranty
+ n8 D, Q0 j( N) x$ q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& [9 k6 `+ m2 G! \% D7 |. j2 ]% z
- * GNU General Public License for more details.; w2 R- H# Q+ o
- */
) R0 U) ^" `% F" Q* R4 L
- q0 c6 L+ Y1 m1 \1 b5 y2 i: b- #include <linux/module.h>9 H/ D7 P0 n9 W5 o
- #include <linux/init.h>5 f* S- d* `+ ^+ U* |
- #include <linux/errno.h>
0 Z$ r' h1 R' ^9 P1 z2 f - #include <linux/types.h>7 `- ^1 B0 H' c X( p
- #include <linux/interrupt.h>
( O/ W2 C0 q% i7 A6 t9 [ - #include <asm/io.h>: |5 g% O+ h" c* |2 N
- #include <linux/moduleparam.h>
7 }. b0 P+ V% g' W3 t/ |# v! m2 F, s) E - #include <linux/sysctl.h>
2 c: t7 D# ^0 } - #include <linux/mm.h>
% R7 |3 C) u2 f7 }6 Q7 r - #include <linux/dma-mapping.h>
# n: L" Z, V0 k
7 t8 K& o/ t3 g) F7 d8 X- #include <mach/memory.h>) U) `7 A; B, C b; a. G# N5 r
- #include <mach/hardware.h>
4 t- E4 b9 @$ t( ` - #include <mach/irqs.h>6 |- |3 I/ C8 d; S
- #include <asm/hardware/edma.h>; u o; ]9 S. f) t6 y% E* R U
- 7 k6 A {# w- K: e2 X
- #undef EDMA3_DEBUG8 ~7 C& N+ q0 n5 k5 U9 u; j& N
- /*#define EDMA3_DEBUG*/
[+ @- \. W# g% O - 5 D0 T$ j1 J1 n
- #ifdef EDMA3_DEBUG
3 @9 ?$ {3 t- m- U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), W0 K7 p$ D# w) d! a6 W( B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 Q" K0 X( [. ~4 _. h" X% S$ B4 K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ {. F2 R/ s+ n- U9 ]- l5 P
- #else# F/ I Q _/ k9 P- l
- #define DMA_PRINTK( x... )0 C% e- c+ N" i$ }( {% ^6 C3 w
- #define DMA_FN_IN5 h& g2 O4 M! y# H) t9 T$ c+ A' F; a
- #define DMA_FN_OUT
2 t4 u# D; ?" o* G6 [ - #endif
$ F" n7 W# G& t - " T: E) ?& F! z! H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 k7 B2 z X) V- d - #define STATIC_SHIFT 3
% N4 x6 O- z3 K6 h - #define TCINTEN_SHIFT 20" B- V! U+ e0 D% E
- #define ITCINTEN_SHIFT 21
5 U$ u" v; n+ \! ^- Y9 J3 V - #define TCCHEN_SHIFT 22
) C; ]" |) F4 R% Y, P7 f7 D - #define ITCCHEN_SHIFT 238 |2 n! h6 Y$ l% s9 i
7 d: J1 m7 J- ^$ n- static volatile int irqraised1 = 0;
' x$ U5 K# \& K* |# n - static volatile int irqraised2 = 0;7 t* U. u) v' ?' p- Z
- 8 n* Q2 p6 g ~) E, c. V% r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ N: B3 D) |! j) f5 g$ \$ l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 J8 O, _& v7 D' U) V2 g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) t, s6 {8 E- ?! x/ h7 G: \: A; Y - 4 Z! Y" }2 c% }6 W, j2 L1 {8 H) X3 ]
- dma_addr_t dmaphyssrc1 = 0;4 V9 \9 x% p8 Z) V( O& @7 \
- dma_addr_t dmaphyssrc2 = 0;* ^- b/ g% q2 y6 F& e- f3 h& k
- dma_addr_t dmaphysdest1 = 0;) u0 `+ c, R2 P8 W2 ^) w0 B+ J
- dma_addr_t dmaphysdest2 = 0;
- @1 ?/ |' a# }8 a4 y9 w4 I# p - * q# V {* P% B
- char *dmabufsrc1 = NULL;
0 e$ A8 j& t3 F0 g# } - char *dmabufsrc2 = NULL;
5 o- O3 {0 g2 c- ]1 i9 c - char *dmabufdest1 = NULL;% {/ ?0 |) v( G/ E# k, R
- char *dmabufdest2 = NULL;, Y4 w' k' b$ n @
- 5 t/ g1 U( }. H" w- ]3 @( r
- static int acnt = 512;0 ^/ D) N8 ~/ k2 i
- static int bcnt = 8;, z4 x5 {2 V2 X, K, K( h! Z7 F
- static int ccnt = 8;
" T/ {/ W- C% z: O
+ h$ R, y# W3 y' u/ M- module_param(acnt, int, S_IRUGO);
1 U6 ~& l* }2 e8 c, e% q; y" U - module_param(bcnt, int, S_IRUGO);/ m; n, l b9 u
- module_param(ccnt, int, S_IRUGO);
复制代码
! a9 Y( u! D2 @ T/ g6 }6 {- O7 H8 u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ l2 u: m# {3 v) T: w: j( w9 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 K# N4 G% y B4 _' Q5 ?! P& x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% X v$ c- J+ `! t- B7 J' F
+ ?4 I! \6 r5 j7 v; S: {; l/ e8 a1 D; d/ B
|
|