|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) x1 t) v6 `9 x2 \6 I& a" f) a- [code]EDMA sample test application' l2 ^0 h9 L7 G
- /*
* l3 B/ M% N1 k( V - * edma_test.c
! M5 k8 l$ B! t) R - *2 o9 s: V, T% `& T/ g% h
- * brief EDMA3 Test Application& r- ]( r$ \, ]" m7 u8 U+ ?
- *
0 _+ I5 k: E' v* `6 |+ n. i) {- k - * This file contains EDMA3 Test code.
3 g8 I' U3 G7 ^& n1 g7 Y - *6 N: j! ^; A ?7 ~3 |: ]0 A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 r4 U$ c0 V! w) S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 o4 G3 h* H* I$ O- F3 O: X
- * TO CHANGE.
4 Q/ k0 M$ Y0 P: E - *
\ ?: R' Z$ }* o# T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% P5 \; c# b$ _- M - *
; Z( \2 S0 ~6 G# R# x7 ]0 q - * This program is free software; you can redistribute it and/or2 j6 n& }3 {3 V$ V
- * modify it under the terms of the GNU General Public License as( e6 L( k& g! \* P
- * published by the Free Software Foundation version 2.
?1 D5 K r4 d! Z' ~- W - *$ Q% W9 p2 j3 [2 _' x p$ u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, a$ Q6 l9 B: @3 h( a. B - * kind, whether express or implied; without even the implied warranty
5 m# P' P3 K# ]9 x# `, ^. f' v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) B8 y' m+ F% X, _7 [9 S - * GNU General Public License for more details.: R! a A" }( C& R. V, J2 P( R7 K; U7 A6 z
- */
' M/ w5 `6 V0 V6 F- m - 3 z/ W3 k& B, ~1 |3 h4 e
- #include <linux/module.h>
7 E" v, P1 \0 D/ ~- [' g2 q - #include <linux/init.h>; j" u3 G; N+ v |4 n! ?
- #include <linux/errno.h>
0 |! w4 b# }! N: _$ ~" R9 F - #include <linux/types.h>0 c8 t0 K3 v# a% {( N: k1 M# h
- #include <linux/interrupt.h>
, P c9 Z( k& ^% t0 ^+ r% ^; G - #include <asm/io.h>
# ?$ J$ d4 u3 M8 C9 K - #include <linux/moduleparam.h>8 i* P) |# a4 F* N4 U! U5 H
- #include <linux/sysctl.h>" D3 c/ S7 K* L
- #include <linux/mm.h>
+ l& }7 Q3 X0 S" E6 i - #include <linux/dma-mapping.h>
& e7 \# w0 Y' D Q% p7 l% U U4 V
* y1 ^, h, o& v& x- Q( L- #include <mach/memory.h>, J4 w5 f+ C* ]* W* s, K
- #include <mach/hardware.h>
8 j* _. q+ Y& z* p j4 D - #include <mach/irqs.h>
+ I' p- `1 S! X- g7 | - #include <asm/hardware/edma.h>
/ }+ m; I: ~2 r4 ^, s
W8 Q/ t! i, \3 n; f8 w- #undef EDMA3_DEBUG4 y9 R+ U; W5 Z, z
- /*#define EDMA3_DEBUG*/
8 Y" U0 x9 y& j2 {$ Z2 z4 l' R - & w/ G" G- t* v# \' T
- #ifdef EDMA3_DEBUG
! ? H" E6 w6 P: J1 H5 o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). m. g2 W; Q3 q9 K9 G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 }8 p( S5 \0 I' J$ x$ h2 T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- T1 r9 C" k6 D4 K' j: W0 H' | - #else! ?2 _; y! \: c( T
- #define DMA_PRINTK( x... )
4 F4 V! M* Q+ w5 J - #define DMA_FN_IN' I* x, H! I; ~/ A# A" r
- #define DMA_FN_OUT
, C. }' P7 |" Q) _, G1 z; b" F - #endif2 z0 K* @- i2 s( _6 f/ a" M
7 h% ?) R0 G5 [# S8 d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ b# y, K. ~. c2 {2 n - #define STATIC_SHIFT 3
/ Q! e, ?& f- W+ m3 L; `% _ - #define TCINTEN_SHIFT 20$ E% I2 Q) u: R
- #define ITCINTEN_SHIFT 21( O, j- p- o: N& k' s( x! d
- #define TCCHEN_SHIFT 229 ~1 R' v! n+ B5 m2 f( z7 h$ H
- #define ITCCHEN_SHIFT 233 m) l: \, T/ G+ i. I2 M/ O. {
- + [+ D/ E4 J, Q+ c% y$ k. G. n
- static volatile int irqraised1 = 0;# s! L5 P5 w; K1 m
- static volatile int irqraised2 = 0;6 e+ l, Z4 j) ~6 `2 S1 m
% L$ |4 [0 x# X8 F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 x0 }) _) I: y# C, _, c" ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 k6 W3 }4 c/ J5 V5 l( R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 p- q( K6 D1 ?4 ]
9 j* l% u( T; c2 T- dma_addr_t dmaphyssrc1 = 0;, a. B2 j+ N7 j+ I. z1 |
- dma_addr_t dmaphyssrc2 = 0;
! D6 {- s9 k+ e$ M- B - dma_addr_t dmaphysdest1 = 0;' u. v9 z5 D }. F3 M
- dma_addr_t dmaphysdest2 = 0;
' k% m4 _: ^# N. M5 z% _( ?0 f - . S! n" e1 B7 Z! g4 g( q
- char *dmabufsrc1 = NULL;7 ?9 V8 P& Z! K
- char *dmabufsrc2 = NULL;
8 f6 C6 {8 \5 \. g& E% Q - char *dmabufdest1 = NULL;
0 q) s& P# L6 F) C - char *dmabufdest2 = NULL;& T B$ ~" R e+ [* a6 ~
- 8 C" \! f. J7 X/ b2 x
- static int acnt = 512;! O) ?7 D) @8 L
- static int bcnt = 8;
: F6 h L/ H. F- s9 {0 @7 s - static int ccnt = 8;
7 \6 ~: K4 [' z j6 F! _ - 7 M. Y9 f6 `8 G
- module_param(acnt, int, S_IRUGO);
, h; i" }2 ]6 F, O - module_param(bcnt, int, S_IRUGO);
8 {5 e. `: K2 w) w! Y g) q - module_param(ccnt, int, S_IRUGO);
复制代码
- P: x" D1 ^2 I) `; n& {, R# M0 j' t& Z4 s% g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% G o: S+ z$ a$ C' u/ q2 f% x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* S, P( B8 c. E% h4 P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ N! r; s, T9 Q' e( V6 W" |$ C# p) r5 M5 Y$ e) a L* d1 r8 o
" t5 M& s4 C, i4 P( p
|
|