clib: Add platform-specific replacements for the Watcom delay function

This commit is contained in:
RichardG867
2025-01-05 18:31:32 -03:00
parent a897ac21e0
commit 55324a40f2
2 changed files with 25 additions and 0 deletions

View File

@@ -16,6 +16,13 @@
*
*/
#include "clib_sys.h"
#ifdef __POSIX_UEFI__
# include <uefi.h>
#elif defined(_WIN32)
# include <windows.h>
#elif defined(__GNUC__) && !defined(__POSIX_UEFI__)
# include <unistd.h>
#endif
/* Interrupt functions. */
#ifdef __WATCOMC__
@@ -44,6 +51,19 @@ sti()
}
#endif
/* Time functions. */
#ifndef __WATCOMC__
void
delay(unsigned int ms)
{
# ifdef _WIN32
Sleep(ms);
# else
usleep(ms * 1000);
# endif
}
#endif
/* Port I/O functions. */
#ifdef __WATCOMC__
/* Defined in header. */

View File

@@ -30,6 +30,11 @@ extern void cli();
extern void sti();
#endif
/* Time functions. */
#ifndef __WATCOMC__
extern void delay(unsigned int ms);
#endif
/* Port I/O functions. */
#ifdef __WATCOMC__
uint8_t inb(uint16_t port);