|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; H' u; J4 k! e5 z g7 W8 f- [code]EDMA sample test application* \( U+ \+ {) I2 j. m9 s% u
- /*, `; h: B. d2 A
- * edma_test.c/ [4 ^9 m# m N) w
- *
7 N1 |( O2 _9 D" G# M, m/ X3 ~ - * brief EDMA3 Test Application9 D. D2 {3 ^2 |* a) N& ?
- *& q! F( s$ l* Z& u7 l
- * This file contains EDMA3 Test code.
/ O2 A8 M" D3 g' E( k - *% k& S* Z& ~& w8 M3 W- N- s* c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ ^: T# L7 O- X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ G8 b+ V$ ~0 ` W6 i* S - * TO CHANGE.
; E u% ?& {) r' e - */ d, R8 x$ O4 S% {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( H7 r* F1 H) K9 Y - *
- J( h8 x2 d2 ^# b* S - * This program is free software; you can redistribute it and/or* s3 [$ N- J8 j+ Y1 _5 t" e0 @
- * modify it under the terms of the GNU General Public License as; @' u. K8 V3 A' D& f
- * published by the Free Software Foundation version 2.7 U( {4 x2 n1 q" N3 p5 E3 ?
- *6 r& r* W6 B9 ]" u: ]; @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 V: j: j; t$ R: N6 E
- * kind, whether express or implied; without even the implied warranty9 F& [; R( ^1 ]7 S z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& f8 K$ V" S: l1 o8 v
- * GNU General Public License for more details.
9 U4 F4 Y7 a4 M6 U# p7 B9 P - */
; h2 J1 l& A# O$ J9 a5 Q6 E - $ O8 t! Y& ?8 s1 s: y- a% T
- #include <linux/module.h>
$ R, H" o/ F8 ]. F - #include <linux/init.h>
0 |2 m! ]0 a# p J- E P0 q - #include <linux/errno.h>! `2 v" V0 T* Y i2 E3 P1 h) d1 S/ D
- #include <linux/types.h>2 Y" y; N# r& R0 k3 m# C/ U
- #include <linux/interrupt.h>
' O5 H9 Z7 y( L; O ]9 ]7 |$ W - #include <asm/io.h>* L- j2 I6 a4 D+ a& v
- #include <linux/moduleparam.h>
' U7 x: Z- t2 q, Q( g - #include <linux/sysctl.h>
6 W# a0 t( B7 d @- U' N0 o: z9 [ - #include <linux/mm.h>
z5 w" q& A& L1 d - #include <linux/dma-mapping.h>
+ f g! l: g4 a" k* e+ a; J
" L( q' J) q( k6 Q- #include <mach/memory.h> L; g6 r3 Z5 w- y% z
- #include <mach/hardware.h>9 n) X' r I# w+ E+ C3 a0 @- x
- #include <mach/irqs.h>
# l3 M5 Z8 M/ G2 I( i+ H3 m - #include <asm/hardware/edma.h>& c; @) t" l) O. x& x T
- R6 N c, s _0 B9 T7 q/ C- #undef EDMA3_DEBUG4 Q# ^' V; g6 ?) ~/ C' V( k
- /*#define EDMA3_DEBUG*/
/ ?) p: ]& k2 |. P - . ?6 [* C ` @
- #ifdef EDMA3_DEBUG1 |5 b1 j/ \! S3 J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: c( k9 Z, b$ F1 F4 K# e# m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 T, P* S' u4 O) n- l0 I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 L) m. m, Q7 N9 [+ n! k - #else# b" E& r4 B- g0 K+ T [, n* C
- #define DMA_PRINTK( x... )
7 w5 B3 ?2 M9 ]2 \7 ` x" Y - #define DMA_FN_IN
% S3 D; R8 t% D6 W& p( [4 O1 S0 s1 j - #define DMA_FN_OUT# Q! a2 ^( I& d b; P
- #endif
" G& M) f( H# u( H% R: F q
p- v$ O$ ~" d7 a- [- @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) v# ^) e' ?8 V: Y
- #define STATIC_SHIFT 3' T& T1 ~ h1 [: n
- #define TCINTEN_SHIFT 208 R& f; \; S# ]; l
- #define ITCINTEN_SHIFT 21
1 `9 ?; i" s% K" N1 c' ^3 } - #define TCCHEN_SHIFT 22
( c8 v+ ~3 D7 \ - #define ITCCHEN_SHIFT 23, k, U. L9 J! D
- " @) f$ S& x- c1 |0 S! g
- static volatile int irqraised1 = 0;; @/ I) |$ M' k' d* k9 K
- static volatile int irqraised2 = 0;- m% d% H! _ B8 l4 F, I
- 3 ~5 w& o$ }, B+ R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! o$ g& _8 X. l2 _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 o& P. i) @ G9 l* z& [: o9 N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, B ~6 [1 p/ B% x7 S0 b* d! Z
9 M9 X; H( V$ ]* U/ V3 X- dma_addr_t dmaphyssrc1 = 0;% x' [3 T" w- f* ^7 @$ s
- dma_addr_t dmaphyssrc2 = 0;! v3 P0 ~. k+ ~# _- M' n" d- ^
- dma_addr_t dmaphysdest1 = 0;
: O' [4 p: ^6 O$ s - dma_addr_t dmaphysdest2 = 0;+ w" G- E7 M$ O7 Z8 H
- * z' ^, D* ] U- d; r3 L
- char *dmabufsrc1 = NULL;4 l! b! E& G* ]. n4 G0 j
- char *dmabufsrc2 = NULL;
+ V- r/ U, T0 o+ u# L. h - char *dmabufdest1 = NULL;& @0 Y) m" h' ?+ D6 e/ n) T. W
- char *dmabufdest2 = NULL;
: ~ Y; R( Q/ v
! B+ j- G; X$ _. _5 X. [& V% v9 G% T- static int acnt = 512;7 o, i# X3 T/ W# v
- static int bcnt = 8;
7 h3 M& _( {) E- w, q3 g - static int ccnt = 8;
7 r) L J, O$ g" \2 R7 I: Y6 i9 }
0 W8 e- q$ I$ z, w" _& L; j- module_param(acnt, int, S_IRUGO);. s @* `+ B" u
- module_param(bcnt, int, S_IRUGO);
# R2 M. r7 f& x# ~. D3 g" z' a - module_param(ccnt, int, S_IRUGO);
复制代码
) ^# V4 z2 C' R5 h. L' r7 {) S" _- ^; p+ I/ Y: q+ X# K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 P7 E+ m' p2 U6 ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) p/ G+ v' h" ^% q- z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. ]1 v8 x4 U7 f' W6 b# V [" n7 g3 P7 m. K/ [3 I
: G7 {& M- t/ B" @ R3 T. f$ |
|
|