1f9f848faSopenharmony_ci/*- 2f9f848faSopenharmony_ci * Copyright (c) 2010 Isilon Systems, Inc. 3f9f848faSopenharmony_ci * Copyright (c) 2010 iX Systems, Inc. 4f9f848faSopenharmony_ci * Copyright (c) 2010 Panasas, Inc. 5f9f848faSopenharmony_ci * Copyright (c) 2013-2015 Mellanox Technologies, Ltd. 6f9f848faSopenharmony_ci * Copyright (c) 2014 François Tigeot 7f9f848faSopenharmony_ci * All rights reserved. 8f9f848faSopenharmony_ci * 9f9f848faSopenharmony_ci * Redistribution and use in source and binary forms, with or without 10f9f848faSopenharmony_ci * modification, are permitted provided that the following conditions 11f9f848faSopenharmony_ci * are met: 12f9f848faSopenharmony_ci * 1. Redistributions of source code must retain the above copyright 13f9f848faSopenharmony_ci * notice unmodified, this list of conditions, and the following 14f9f848faSopenharmony_ci * disclaimer. 15f9f848faSopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright 16f9f848faSopenharmony_ci * notice, this list of conditions and the following disclaimer in the 17f9f848faSopenharmony_ci * documentation and/or other materials provided with the distribution. 18f9f848faSopenharmony_ci * 19f9f848faSopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20f9f848faSopenharmony_ci * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21f9f848faSopenharmony_ci * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22f9f848faSopenharmony_ci * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23f9f848faSopenharmony_ci * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24f9f848faSopenharmony_ci * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25f9f848faSopenharmony_ci * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26f9f848faSopenharmony_ci * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27f9f848faSopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28f9f848faSopenharmony_ci * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29f9f848faSopenharmony_ci */ 30f9f848faSopenharmony_ci#ifndef _LINUXKPI_LINUX_DELAY_H_ 31f9f848faSopenharmony_ci#define _LINUXKPI_LINUX_DELAY_H_ 32f9f848faSopenharmony_ci 33f9f848faSopenharmony_ci#include "los_typedef.h" 34f9f848faSopenharmony_ci#include "los_tick.h" 35f9f848faSopenharmony_ci#include "los_base.h" 36f9f848faSopenharmony_ci 37f9f848faSopenharmony_ci#ifdef __cplusplus 38f9f848faSopenharmony_ci#if __cplusplus 39f9f848faSopenharmony_ciextern "C" { 40f9f848faSopenharmony_ci#endif /* __cplusplus */ 41f9f848faSopenharmony_ci#endif /* __cplusplus */ 42f9f848faSopenharmony_ci 43f9f848faSopenharmony_cistatic inline void 44f9f848faSopenharmony_cilinux_msleep(unsigned int msecs) 45f9f848faSopenharmony_ci{ 46f9f848faSopenharmony_ci LOS_Msleep(msecs); 47f9f848faSopenharmony_ci} 48f9f848faSopenharmony_ci 49f9f848faSopenharmony_ci#define msleep(m) linux_msleep(m) 50f9f848faSopenharmony_ci 51f9f848faSopenharmony_ci#ifndef udelay 52f9f848faSopenharmony_ci#define udelay(n) LOS_Udelay(n) 53f9f848faSopenharmony_ci#endif 54f9f848faSopenharmony_ci#ifndef mdelay 55f9f848faSopenharmony_ci#define mdelay(n) LOS_Mdelay(n) 56f9f848faSopenharmony_ci#endif 57f9f848faSopenharmony_ci 58f9f848faSopenharmony_cistatic inline void 59f9f848faSopenharmony_cindelay(unsigned long x) 60f9f848faSopenharmony_ci{ 61f9f848faSopenharmony_ci unsigned long msecs = (x + 1000 - 1) / 1000; /* 1000ns = 1us */ 62f9f848faSopenharmony_ci LOS_Udelay(msecs); 63f9f848faSopenharmony_ci} 64f9f848faSopenharmony_ci 65f9f848faSopenharmony_cistatic inline void 66f9f848faSopenharmony_ciusleep_range(unsigned long min, unsigned long max) 67f9f848faSopenharmony_ci{ 68f9f848faSopenharmony_ci (void)max; 69f9f848faSopenharmony_ci LOS_Udelay(min); 70f9f848faSopenharmony_ci} 71f9f848faSopenharmony_ci 72f9f848faSopenharmony_ci#ifdef __cplusplus 73f9f848faSopenharmony_ci#if __cplusplus 74f9f848faSopenharmony_ci} 75f9f848faSopenharmony_ci#endif /* __cplusplus */ 76f9f848faSopenharmony_ci#endif /* __cplusplus */ 77f9f848faSopenharmony_ci 78f9f848faSopenharmony_ci#endif /* _LINUXKPI_LINUX_DELAY_H_ */ 79