|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* t Z" c7 x4 e. k. B0 w" P- [code]EDMA sample test application% y8 s S: F }* c: u5 h4 u( g" {
- /*
% T. k/ I3 I% |& T - * edma_test.c
4 _5 C0 g4 M- W: k - *
9 {( o6 S) L1 X7 v. ?! U - * brief EDMA3 Test Application; u7 {: ]& ?/ k# n6 A6 M
- *
5 S8 o6 j0 r( W( L/ } - * This file contains EDMA3 Test code.
0 x+ n. X: D: w' Y) z0 j7 D6 W8 q2 Z - *8 E% e' |( q& V- n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 Y& a- h1 b7 b0 F/ S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 F1 A& y; c* @: p7 F
- * TO CHANGE.
9 G! Q& Z8 ?& Z+ P- A( m - *" s( o z! ~& s% k) Z" l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: T# u7 Y" e5 d* i! u, y5 ^1 B
- *9 Q- d1 W& v4 p
- * This program is free software; you can redistribute it and/or/ j, e' ~3 `9 h1 @
- * modify it under the terms of the GNU General Public License as4 K6 k1 u4 R) n
- * published by the Free Software Foundation version 2.
9 f0 @+ u/ w6 l0 C - *; d- S8 Q; R0 M: e* i+ k2 Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 ?& X# e( c; a b0 |+ p9 P
- * kind, whether express or implied; without even the implied warranty
$ ^* b- K$ _# o6 m$ m: Z9 K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 F$ |' F- w) ?. V f7 V
- * GNU General Public License for more details.! v. ~+ V3 j+ P$ }
- */
8 [2 | N( |2 p5 I/ j
g2 U) w$ ^. t' l& ]: v- #include <linux/module.h>& l! m7 f6 |( }
- #include <linux/init.h>5 h: i1 o1 |; v! a! Y1 k. e" j" I
- #include <linux/errno.h>
4 Z* F$ }( ]& `$ Z6 `* F, q# K+ `" Q2 s - #include <linux/types.h>8 e+ D) h' v% Z2 D2 s; t! v, N
- #include <linux/interrupt.h>
: I8 l4 Q, a7 a6 H4 f6 H - #include <asm/io.h>
) a/ o/ G. W& v3 C6 q - #include <linux/moduleparam.h>
8 o% n8 k- J& E9 u0 l' V5 h0 L2 @1 t - #include <linux/sysctl.h>
* Z6 ~6 d# N# e" W( v, G; \ - #include <linux/mm.h>
* ^6 o& v* F0 E+ z - #include <linux/dma-mapping.h>6 k% M9 [ C' \0 I7 E
n5 n8 Z# d$ V# ?5 V0 ?- #include <mach/memory.h>
9 \: z. y9 B! M4 U# D _ - #include <mach/hardware.h>
! U! k5 H( Q- _+ x2 ~; X - #include <mach/irqs.h>1 c( m! H4 {8 u+ }6 p
- #include <asm/hardware/edma.h>7 m0 c5 @1 K: o9 R9 X1 x1 p
- 3 g9 V/ F. o/ E5 M4 A3 T" e3 I! d9 f
- #undef EDMA3_DEBUG
3 Z. Q* w' v+ w/ h' ?: P - /*#define EDMA3_DEBUG*/
% Q) O# s9 U6 |/ \- O/ P( E
$ d3 r. u- X! \" d; k& e7 Q- #ifdef EDMA3_DEBUG
7 @$ H9 v+ o/ p" G9 s) a. y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ k5 @# q8 E h+ p/ d) {; x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 ]4 b+ E, ]1 J {* i( f/ I9 u! { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), y6 X7 i9 o2 y* W- d# `. o
- #else
: Y* Z+ x% _2 y; n - #define DMA_PRINTK( x... ), q+ X4 s* B! i- D, t& d4 h: j
- #define DMA_FN_IN; }2 [' `+ b1 i5 ^
- #define DMA_FN_OUT
V& Y3 k0 J) C! M( k* r6 { - #endif
: B$ F' u) Y) k3 x& A2 N4 O - 8 d' E* r& q6 D# O8 V, I$ l% R6 _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), b3 C( d: s6 \% n
- #define STATIC_SHIFT 3
- b+ s1 q) @8 o; o* @, h6 ^ - #define TCINTEN_SHIFT 20- D& Y* E/ K/ L5 Q8 h, b+ s9 i3 K
- #define ITCINTEN_SHIFT 214 h: w7 a' w0 ^' j
- #define TCCHEN_SHIFT 22! j! U, B, m! u$ P' n
- #define ITCCHEN_SHIFT 23$ q& G* h2 I# J; l4 z! u- m3 H
- , d$ s& |. ?' j6 ~1 V* W
- static volatile int irqraised1 = 0;* k, u' b# E# g0 k6 A
- static volatile int irqraised2 = 0;8 I# R# P* \+ {5 Y8 v
8 l" H! K: y$ H; [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 k+ h1 b4 T2 c0 Y6 U, g1 b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ _* b7 r5 I B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 f" W8 y6 s1 W5 {# G& a
! ]+ L4 p$ n7 j! h- dma_addr_t dmaphyssrc1 = 0;
. S3 k+ O* k$ y: p - dma_addr_t dmaphyssrc2 = 0;, X/ {1 {! j; I2 ?
- dma_addr_t dmaphysdest1 = 0;) `' s" j1 Q. f( r
- dma_addr_t dmaphysdest2 = 0;. N8 J' p- ~% N, ?7 T0 m" [
* x$ |9 V( P- F- char *dmabufsrc1 = NULL;
+ q6 K% N+ O# }# l9 X! p - char *dmabufsrc2 = NULL;
f. P0 ?9 G4 Y - char *dmabufdest1 = NULL;
( B- J$ a# q7 n- L/ b) @7 k - char *dmabufdest2 = NULL;: F5 z4 G( G5 B- ]( V% E6 R j; O
- , V0 D- B+ `! j4 H
- static int acnt = 512;- G2 l7 N* J1 V$ W
- static int bcnt = 8;
6 u- q7 e$ Y, G/ `3 v - static int ccnt = 8;' V4 P( |' X6 A9 G
8 K, J1 _, l$ U; L% o% h2 D/ }- module_param(acnt, int, S_IRUGO);3 S( b' B0 h# }4 Z* ~' }7 x. u# _5 C
- module_param(bcnt, int, S_IRUGO);2 N" _9 S- c/ M* B2 |$ C8 r+ i
- module_param(ccnt, int, S_IRUGO);
复制代码
% |% b) L* C( u! p0 S/ Q: Q1 [. m7 s3 E7 s& I( Z2 R# a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ V8 b5 S6 ^ J3 d) ]5 x: w
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 O" Z8 ]+ g- }1 B; [, O$ O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 M" f" d5 N7 l/ `# \- u+ _
" R1 [/ p2 ?# m% C
1 b, x: w0 f& x8 N7 Y0 Q: i |
|