From c8c540b45328f9714fb221689f5ef40cc687df43 Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Mon, 24 Oct 2022 11:48:54 -0300 Subject: [PATCH] Improve TI-RTOS timing support --- mongoose.c | 2 ++ mongoose.h | 2 ++ src/arch_tirtos.h | 2 ++ src/util.c | 2 ++ 4 files changed, 8 insertions(+) diff --git a/mongoose.c b/mongoose.c index bf1fda09..845355bc 100644 --- a/mongoose.c +++ b/mongoose.c @@ -5588,6 +5588,8 @@ uint64_t mg_millis(void) { return xTaskGetTickCount() * portTICK_PERIOD_MS; #elif MG_ARCH == MG_ARCH_AZURERTOS return tx_time_get() * (1000 /* MS per SEC */ / TX_TIMER_TICKS_PER_SECOND); +#elif MG_ARCH == MG_ARCH_TIRTOS + return (uint64_t) Clock_getTicks(); #elif MG_ARCH == MG_ARCH_ZEPHYR return (uint64_t) k_uptime_get(); #elif MG_ARCH == MG_ARCH_UNIX && defined(__APPLE__) diff --git a/mongoose.h b/mongoose.h index bd4049ba..22eed54a 100644 --- a/mongoose.h +++ b/mongoose.h @@ -425,6 +425,8 @@ struct timeval { #include +#include + extern int SockStatus(SOCKET hSock, int request, int *results ); extern int SockSet(SOCKET hSock, int Type, int Prop, void *pbuf, int size); diff --git a/src/arch_tirtos.h b/src/arch_tirtos.h index ea4c2090..dfb6a5f4 100644 --- a/src/arch_tirtos.h +++ b/src/arch_tirtos.h @@ -15,6 +15,8 @@ #include +#include + extern int SockStatus(SOCKET hSock, int request, int *results ); extern int SockSet(SOCKET hSock, int Type, int Prop, void *pbuf, int size); diff --git a/src/util.c b/src/util.c index 9ad8c92e..12924867 100644 --- a/src/util.c +++ b/src/util.c @@ -102,6 +102,8 @@ uint64_t mg_millis(void) { return xTaskGetTickCount() * portTICK_PERIOD_MS; #elif MG_ARCH == MG_ARCH_AZURERTOS return tx_time_get() * (1000 /* MS per SEC */ / TX_TIMER_TICKS_PER_SECOND); +#elif MG_ARCH == MG_ARCH_TIRTOS + return (uint64_t) Clock_getTicks(); #elif MG_ARCH == MG_ARCH_ZEPHYR return (uint64_t) k_uptime_get(); #elif MG_ARCH == MG_ARCH_UNIX && defined(__APPLE__)