mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-10 16:31:44 +00:00
5 files changed
+58
No files matched your search
@@ -6023,6 +6023,8 @@ uint64_t mg_millis(void) {
|
|||||||
return (uint64_t)rt_time_get();
|
return (uint64_t)rt_time_get();
|
||||||
#elif MG_ARCH == MG_ARCH_CMSIS_RTOS2
|
#elif MG_ARCH == MG_ARCH_CMSIS_RTOS2
|
||||||
return (uint64_t)((osKernelGetTickCount() * 1000) / osKernelGetTickFreq());
|
return (uint64_t)((osKernelGetTickCount() * 1000) / osKernelGetTickFreq());
|
||||||
|
#elif MG_ARCH == MG_ARCH_RTTHREAD
|
||||||
|
return (uint64_t) ((rt_tick_get() * 1000) / RT_TICK_PER_SECOND);
|
||||||
#elif MG_ARCH == MG_ARCH_UNIX && defined(__APPLE__)
|
#elif MG_ARCH == MG_ARCH_UNIX && defined(__APPLE__)
|
||||||
// Apple CLOCK_MONOTONIC_RAW is equivalent to CLOCK_BOOTTIME on linux
|
// Apple CLOCK_MONOTONIC_RAW is equivalent to CLOCK_BOOTTIME on linux
|
||||||
// Apple CLOCK_UPTIME_RAW is equivalent to CLOCK_MONOTONIC_RAW on linux
|
// Apple CLOCK_UPTIME_RAW is equivalent to CLOCK_MONOTONIC_RAW on linux
|
||||||
|
|||||||
+27
@@ -41,6 +41,7 @@ extern "C" {
|
|||||||
#define MG_ARCH_RP2040 11 // Raspberry Pi RP2040
|
#define MG_ARCH_RP2040 11 // Raspberry Pi RP2040
|
||||||
#define MG_ARCH_ARMCC 12 // Keil MDK-Core with Configuration Wizard
|
#define MG_ARCH_ARMCC 12 // Keil MDK-Core with Configuration Wizard
|
||||||
#define MG_ARCH_CMSIS_RTOS2 13 // CMSIS-RTOS API v2 (Keil RTX5, FreeRTOS)
|
#define MG_ARCH_CMSIS_RTOS2 13 // CMSIS-RTOS API v2 (Keil RTX5, FreeRTOS)
|
||||||
|
#define MG_ARCH_RTTHREAD 14 // RT-Thread RTOS
|
||||||
|
|
||||||
#if !defined(MG_ARCH)
|
#if !defined(MG_ARCH)
|
||||||
#if defined(__unix__) || defined(__APPLE__)
|
#if defined(__unix__) || defined(__APPLE__)
|
||||||
@@ -62,6 +63,8 @@ extern "C" {
|
|||||||
#define MG_ARCH MG_ARCH_RP2040
|
#define MG_ARCH MG_ARCH_RP2040
|
||||||
#elif defined(__ARMCC_VERSION)
|
#elif defined(__ARMCC_VERSION)
|
||||||
#define MG_ARCH MG_ARCH_ARMCC
|
#define MG_ARCH MG_ARCH_ARMCC
|
||||||
|
#elif defined(__RTTHREAD__)
|
||||||
|
#define MG_ARCH MG_ARCH_RTTHREAD
|
||||||
#endif
|
#endif
|
||||||
#endif // !defined(MG_ARCH)
|
#endif // !defined(MG_ARCH)
|
||||||
|
|
||||||
@@ -255,6 +258,30 @@ int mkdir(const char *, mode_t);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if MG_ARCH == MG_ARCH_RTTHREAD
|
||||||
|
|
||||||
|
#include <rtthread.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/select.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#ifndef MG_IO_SIZE
|
||||||
|
#define MG_IO_SIZE 1460
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // MG_ARCH == MG_ARCH_RTTHREAD
|
||||||
|
|
||||||
|
|
||||||
#if MG_ARCH == MG_ARCH_ARMCC || MG_ARCH == MG_ARCH_CMSIS_RTOS1 || \
|
#if MG_ARCH == MG_ARCH_ARMCC || MG_ARCH == MG_ARCH_CMSIS_RTOS1 || \
|
||||||
MG_ARCH == MG_ARCH_CMSIS_RTOS2
|
MG_ARCH == MG_ARCH_CMSIS_RTOS2
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#define MG_ARCH_RP2040 11 // Raspberry Pi RP2040
|
#define MG_ARCH_RP2040 11 // Raspberry Pi RP2040
|
||||||
#define MG_ARCH_ARMCC 12 // Keil MDK-Core with Configuration Wizard
|
#define MG_ARCH_ARMCC 12 // Keil MDK-Core with Configuration Wizard
|
||||||
#define MG_ARCH_CMSIS_RTOS2 13 // CMSIS-RTOS API v2 (Keil RTX5, FreeRTOS)
|
#define MG_ARCH_CMSIS_RTOS2 13 // CMSIS-RTOS API v2 (Keil RTX5, FreeRTOS)
|
||||||
|
#define MG_ARCH_RTTHREAD 14 // RT-Thread RTOS
|
||||||
|
|
||||||
#if !defined(MG_ARCH)
|
#if !defined(MG_ARCH)
|
||||||
#if defined(__unix__) || defined(__APPLE__)
|
#if defined(__unix__) || defined(__APPLE__)
|
||||||
@@ -35,6 +36,8 @@
|
|||||||
#define MG_ARCH MG_ARCH_RP2040
|
#define MG_ARCH MG_ARCH_RP2040
|
||||||
#elif defined(__ARMCC_VERSION)
|
#elif defined(__ARMCC_VERSION)
|
||||||
#define MG_ARCH MG_ARCH_ARMCC
|
#define MG_ARCH MG_ARCH_ARMCC
|
||||||
|
#elif defined(__RTTHREAD__)
|
||||||
|
#define MG_ARCH MG_ARCH_RTTHREAD
|
||||||
#endif
|
#endif
|
||||||
#endif // !defined(MG_ARCH)
|
#endif // !defined(MG_ARCH)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if MG_ARCH == MG_ARCH_RTTHREAD
|
||||||
|
|
||||||
|
#include <rtthread.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/select.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#ifndef MG_IO_SIZE
|
||||||
|
#define MG_IO_SIZE 1460
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // MG_ARCH == MG_ARCH_RTTHREAD
|
||||||
@@ -113,6 +113,8 @@ uint64_t mg_millis(void) {
|
|||||||
return (uint64_t)rt_time_get();
|
return (uint64_t)rt_time_get();
|
||||||
#elif MG_ARCH == MG_ARCH_CMSIS_RTOS2
|
#elif MG_ARCH == MG_ARCH_CMSIS_RTOS2
|
||||||
return (uint64_t)((osKernelGetTickCount() * 1000) / osKernelGetTickFreq());
|
return (uint64_t)((osKernelGetTickCount() * 1000) / osKernelGetTickFreq());
|
||||||
|
#elif MG_ARCH == MG_ARCH_RTTHREAD
|
||||||
|
return (uint64_t) ((rt_tick_get() * 1000) / RT_TICK_PER_SECOND);
|
||||||
#elif MG_ARCH == MG_ARCH_UNIX && defined(__APPLE__)
|
#elif MG_ARCH == MG_ARCH_UNIX && defined(__APPLE__)
|
||||||
// Apple CLOCK_MONOTONIC_RAW is equivalent to CLOCK_BOOTTIME on linux
|
// Apple CLOCK_MONOTONIC_RAW is equivalent to CLOCK_BOOTTIME on linux
|
||||||
// Apple CLOCK_UPTIME_RAW is equivalent to CLOCK_MONOTONIC_RAW on linux
|
// Apple CLOCK_UPTIME_RAW is equivalent to CLOCK_MONOTONIC_RAW on linux
|
||||||
|
|||||||
Reference in new issue
Block a user