Sfoglia il codice sorgente

compile pass on esp32

pikastech 3 anni fa
parent
commit
3da2e18fcf

+ 2 - 2
package/mqtt/platform_mutex.h

@@ -15,8 +15,8 @@
         pthread_mutex_t mutex;
     } platform_mutex_t;
 #elif PIKA_FREERTOS_ENABLE
-    #include "FreeRTOS.h"
-    #include "semphr.h"
+    #include "freertos/FreeRTOS.h"
+    #include "freertos/semphr.h"
     typedef struct platform_mutex {
         SemaphoreHandle_t mutex;
     } platform_mutex_t;

+ 2 - 2
package/mqtt/platform_thread.h

@@ -18,8 +18,8 @@
         pthread_cond_t cond;
     } platform_thread_t;
 #elif PIKA_FREERTOS_ENABLE
-    #include "FreeRTOS.h"
-    #include "task.h"
+    #include "freertos/FreeRTOS.h"
+    #include "freertos/task.h"
     typedef struct platform_thread {
         TaskHandle_t thread;
     } platform_thread_t;

+ 15 - 1
package/mqtt/platform_timer.c

@@ -9,6 +9,20 @@
 
 #include "platform_timer.h"
 
+#if PIKA_FREERTOS_ENABLE
+static uint32_t platform_uptime_ms(void)
+{
+#if (configTICK_RATE_HZ == 1000)
+    return (uint32_t)xTaskGetTickCount();
+#else
+    TickType_t tick = 0u;
+
+    tick = xTaskGetTickCount() * 1000;
+    return (uint32_t)((tick + configTICK_RATE_HZ - 1) / configTICK_RATE_HZ);
+#endif
+}
+#endif
+
 PIKA_WEAK void platform_timer_init(platform_timer_t* timer) {
 #ifdef __linux
     timer->time = (struct timeval){0, 0};
@@ -79,7 +93,7 @@ PIKA_WEAK void platform_timer_usleep(unsigned long usec) {
 #ifdef __linux
     usleep(usec);
 #elif PIKA_FREERTOS_ENABLE
-    TickType_t tick;
+    TickType_t tick = 1;
     if (usec != 0) {
         tick = usec / portTICK_PERIOD_MS;
 

+ 4 - 3
package/mqtt/platform_timer.h

@@ -10,14 +10,16 @@
 #define _PLATFORM_TIMER_H_
 
 #include <stdio.h>
+#include "PikaObj.h"
+
 #ifdef __linux
     #include <sys/time.h>
     typedef struct platform_timer {
         struct timeval time;
     } platform_timer_t;
 #elif PIKA_FREERTOS_ENABLE
-    #include "FreeRTOS.h"
-    #include "task.h"
+    #include "freertos/FreeRTOS.h"
+    #include "freertos/task.h"
     typedef struct platform_timer {
         uint32_t time;
     } platform_timer_t;
@@ -29,7 +31,6 @@
 #endif
 #include <time.h>
 #include <unistd.h>
-#include "PikaObj.h"
 
 #ifdef __cplusplus
 extern "C" {

+ 1 - 1
package/socket/PikaPlatform_socket.c

@@ -71,7 +71,7 @@ PIKA_WEAK int __platform_recv(int __fd, void* __buf, size_t __n, int __flags) {
 
 /* gethostname */
 PIKA_WEAK int __platform_gethostname(char* __name, size_t __len) {
-#if defined(__linux__) || PIKA_LWIP_ENABLE
+#if defined(__linux__)
     return gethostname(__name, __len);
 #else
     WEAK_FUNCTION_NEED_OVERRIDE_ERROR();