|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 p0 _+ z; I& ?+ s* L" [
- [code]EDMA sample test application# F+ J; C8 Q; C' b( ]3 V% r& w$ B* o
- /*
( r: Z) X# e3 V, C3 |" k - * edma_test.c' x( m* c1 @2 A, ~% N3 ^
- *
* @! t8 I% m: a! T - * brief EDMA3 Test Application
' a8 P% Z8 }: _4 _# B% U* E1 i - *- j1 |6 o! ]' s3 }
- * This file contains EDMA3 Test code.' v. c2 L4 f! R( v* _+ ^$ \& ]
- *
& D t! V( _5 _6 f6 w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& g6 {1 o* [1 X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 g4 e7 u9 b* t+ X0 y! x
- * TO CHANGE.3 A9 {8 k9 M7 V( z
- *4 c; o% i3 P. V, ]9 o* t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, e: h* `1 c" c6 |
- *& ~* d) s0 ?$ f3 M& X
- * This program is free software; you can redistribute it and/or
+ w1 ?0 b8 X4 t% w, h. p- p! W - * modify it under the terms of the GNU General Public License as
9 C6 A7 s! T3 [& h4 e* W8 u$ c. @9 ?& L - * published by the Free Software Foundation version 2.
" B+ k; O. K' d) V+ k+ ?* N - *: r! N1 o' g/ Q! u K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- F9 E i2 z1 h8 ~6 u
- * kind, whether express or implied; without even the implied warranty, x8 m1 }( f: R/ l0 _2 `0 }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 c4 t, ^, T: M7 a/ o
- * GNU General Public License for more details., R( N: L+ f8 `+ X
- */2 }4 B0 B5 f2 w2 d" [
- k! ~9 c- B$ T9 R8 z, K6 o6 d- #include <linux/module.h>
) O @4 @- K/ H( e, C( h - #include <linux/init.h>
. M, {+ f+ X3 X" P& x0 u - #include <linux/errno.h>
: p! s, Z& `" p4 e - #include <linux/types.h>( ]2 g" Q/ @) p/ J/ ]' V
- #include <linux/interrupt.h>, e9 m# W4 G3 k
- #include <asm/io.h>5 x( F, x2 X& q4 q/ d' K
- #include <linux/moduleparam.h>
, |% w# E) g$ e - #include <linux/sysctl.h>1 K4 [( |$ h! F, z# ]5 V! _# }
- #include <linux/mm.h>
7 X, Z* s7 `; d* U) ? - #include <linux/dma-mapping.h>4 K" z' M3 Y7 ~
- : f6 R3 d: v! M! b
- #include <mach/memory.h>
$ p& N/ X% g i3 s" O6 ~% l - #include <mach/hardware.h>
0 \$ C4 M& N! ?5 G% y - #include <mach/irqs.h>7 u4 d( o" S0 _! n* z" f
- #include <asm/hardware/edma.h>2 j, v! D7 d6 m E7 y
: g8 J1 P/ s0 [& E- #undef EDMA3_DEBUG
' `1 J. `6 b8 c8 N4 F - /*#define EDMA3_DEBUG*/
- X. B9 f' e7 |9 V
; O4 @% L X" o7 C6 v) d! N. `5 s5 n- #ifdef EDMA3_DEBUG
, R" T5 H- g) e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; K6 [/ D: A% y7 z+ P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ I* w) Z" t! B, {/ q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
c& r8 @% [( f& G& b$ r9 h - #else
/ e& L- m/ v- n& p7 M- H - #define DMA_PRINTK( x... ) r0 M. x% p' [/ z0 \: D
- #define DMA_FN_IN
1 J4 I2 V- o4 @8 i1 _4 e - #define DMA_FN_OUT
0 h) Q6 f- `9 ` y# E: ]9 [ - #endif
3 x4 F1 Q T5 [% o W4 ~1 }5 X) S
{1 D) P$ L7 g# O* ^& Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 H% g" R. F0 A" d& z
- #define STATIC_SHIFT 3
( F2 z; n7 k' D8 q& i - #define TCINTEN_SHIFT 20/ j5 ~) s1 y5 k
- #define ITCINTEN_SHIFT 218 H l* A0 A. T: E
- #define TCCHEN_SHIFT 22
- z) E r) B- t" f1 R$ ?; g" _& \ - #define ITCCHEN_SHIFT 234 ] L C2 Z/ v. j
- ) L7 }5 k, M+ u z5 m7 N- G
- static volatile int irqraised1 = 0;
$ s, V# K, ^# B& g, z - static volatile int irqraised2 = 0;
. { C1 C2 c- T% b/ t - 2 N8 i5 x. K! i6 P! j' U8 R0 ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% D, _' W9 l5 a R0 ? c7 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- E* V4 z% d5 U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: X- [) C1 {' o. |. U8 f, } - $ b+ }( v. C. I! L0 A1 C
- dma_addr_t dmaphyssrc1 = 0;
2 }7 k5 P* k; Q) I8 {/ c- b8 N& J - dma_addr_t dmaphyssrc2 = 0;
+ D% V, Z2 }0 A2 P ~# q. m - dma_addr_t dmaphysdest1 = 0;
% F- N T, y# w, `( N/ z0 I - dma_addr_t dmaphysdest2 = 0; j3 E5 [8 E: g- F2 n' F
- & K' Q( f7 P) a. |/ j+ ?* w
- char *dmabufsrc1 = NULL;
" F* I( `# ?+ k4 b - char *dmabufsrc2 = NULL;
4 m6 u* x" l( j O) l n - char *dmabufdest1 = NULL;
0 T; }( T X9 ? p - char *dmabufdest2 = NULL;
) B- g, C `$ u# m9 Z& H6 i
5 h( \; D* l! L3 Q- V- static int acnt = 512;- K1 b* K1 j/ f% _) f% U' X1 H
- static int bcnt = 8;
! ^2 \- h' b- x1 D2 `( L - static int ccnt = 8;
+ E4 L9 H6 ]+ L5 C5 J9 C: ` z: e( k
. O: b0 |8 Z; o, S. s( s# s- module_param(acnt, int, S_IRUGO);4 s1 ~5 v# T1 a$ d/ P* F" J! G
- module_param(bcnt, int, S_IRUGO);
8 h9 m; M q# p/ H ^- D% i - module_param(ccnt, int, S_IRUGO);
复制代码 `( k6 ?" F8 c: d- x
8 k. F+ `. S7 v1 F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# D6 F! D& W; h6 K" G. L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- h3 c' L+ F7 C3 a& u; \/ E C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% D9 `) r7 r9 ?/ z1 c5 k
( F" U9 L4 t/ M4 E1 p6 S& y# O) ]. P/ I! Q7 f9 [# z$ ~' n' X0 ~. _8 `
|
|