Merge pull request #4801 from mysterywolf/delay2

implement delay.c/.h
This commit is contained in:
guo 2021-06-21 17:14:05 +08:00 committed by GitHub
commit 6f1a505cd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 66 additions and 11 deletions

View File

@ -55,3 +55,8 @@ void rt_hw_board_init(void)
rt_hw_ipi_handler_install(RT_SCHEDULE_IPI, rt_scheduler_ipi_handler); rt_hw_ipi_handler_install(RT_SCHEDULE_IPI, rt_scheduler_ipi_handler);
#endif #endif
} }
void rt_hw_us_delay(rt_uint32_t us)
{
}

View File

@ -33,16 +33,6 @@ struct eth_device_smc911x
}; };
static struct eth_device_smc911x _emac; static struct eth_device_smc911x _emac;
int udelay(int value)
{
return 0;
}
int mdelay(int value)
{
return 0;
}
#if defined (CONFIG_SMC911X_32_BIT) #if defined (CONFIG_SMC911X_32_BIT)
rt_inline uint32_t smc911x_reg_read(struct eth_device_smc911x *dev, uint32_t offset) rt_inline uint32_t smc911x_reg_read(struct eth_device_smc911x *dev, uint32_t offset)
{ {

View File

@ -10,7 +10,7 @@ CPPPATH = [cwd]
if GetDepend('RT_USING_LIBC'): if GetDepend('RT_USING_LIBC'):
src += Glob('*.c') src += Glob('*.c')
if GetDepend('RT_USING_POSIX') == False: if GetDepend('RT_USING_POSIX') == False:
SrcRemove(src, ['unistd.c']) SrcRemove(src, ['unistd.c', 'delay.c'])
elif GetDepend('RT_LIBC_USING_TIME'): elif GetDepend('RT_LIBC_USING_TIME'):
src += ['time.c'] src += ['time.c']

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-05-07 Meco Man first Version
*/
#include <rtthread.h>
#include <rthw.h>
void msleep(unsigned int msecs)
{
rt_thread_mdelay(msecs);
}
RTM_EXPORT(msleep);
void ssleep(unsigned int seconds)
{
msleep(seconds * 1000);
}
RTM_EXPORT(ssleep);
void mdelay(unsigned long msecs)
{
rt_hw_us_delay(msecs * 1000);
}
RTM_EXPORT(mdelay);
void udelay(unsigned long usecs)
{
rt_hw_us_delay(usecs);
}
RTM_EXPORT(udelay);
void ndelay(unsigned long nsecs)
{
rt_hw_us_delay(1);
}
RTM_EXPORT(ndelay);

View File

@ -0,0 +1,19 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-05-07 Meco Man first Version
*/
#ifndef __DELAY_H__
#define __DELAY_H__
void msleep(unsigned int msecs);
void ssleep(unsigned int seconds);
void mdelay(unsigned long msecs);
void udelay(unsigned long usecs);
void ndelay(unsigned long nsecs);
#endif