Enable FreeRTOS SMP (multicore) (#90)
This commit is contained in:
parent
dfd9349e6c
commit
d06137ba76
@ -3,7 +3,6 @@
|
|||||||
#include "CoreExtraDefines.h"
|
#include "CoreExtraDefines.h"
|
||||||
|
|
||||||
#ifdef ESP_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
#include "freertos/portmacro.h"
|
|
||||||
#else
|
#else
|
||||||
#include "portmacro.h"
|
#include "portmacro.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -4,11 +4,9 @@
|
|||||||
#ifdef ESP_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "freertos/portmacro.h"
|
|
||||||
#else
|
#else
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "portmacro.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ESP_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
|
|||||||
@ -6,11 +6,9 @@
|
|||||||
#ifdef ESP_TARGET
|
#ifdef ESP_TARGET
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/event_groups.h"
|
#include "freertos/event_groups.h"
|
||||||
#include "freertos/portmacro.h"
|
|
||||||
#else
|
#else
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "event_groups.h"
|
#include "event_groups.h"
|
||||||
#include "portmacro.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TT_EVENT_FLAG_MAX_BITS_EVENT_GROUPS 24U
|
#define TT_EVENT_FLAG_MAX_BITS_EVENT_GROUPS 24U
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "I2cCompat.h"
|
#include "I2cCompat.h"
|
||||||
#include "CoreTypes.h"
|
#include "CoreTypes.h"
|
||||||
|
#include <climits>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ typedef struct {
|
|||||||
/** Whether configuration can be changed. */
|
/** Whether configuration can be changed. */
|
||||||
bool hasMutableConfiguration;
|
bool hasMutableConfiguration;
|
||||||
/** Read/write timeout (not related to mutex locking mechanism) */
|
/** Read/write timeout (not related to mutex locking mechanism) */
|
||||||
TickType_t timeout;
|
unsigned long timeout;
|
||||||
/** Configuration that must be valid when initAtBoot is set to true. */
|
/** Configuration that must be valid when initAtBoot is set to true. */
|
||||||
i2c_config_t config;
|
i2c_config_t config;
|
||||||
} Configuration;
|
} Configuration;
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef ESP_TARGET
|
#ifdef ESP_TARGET
|
||||||
|
#include <hal/i2c_types.h>
|
||||||
#include <driver/i2c.h>
|
#include <driver/i2c.h>
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "portmacro.h"
|
|
||||||
|
|
||||||
typedef int esp_err_t;
|
typedef int esp_err_t;
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,8 @@ typedef enum {
|
|||||||
WifiMessageTypeRadioOff,
|
WifiMessageTypeRadioOff,
|
||||||
WifiMessageTypeScan,
|
WifiMessageTypeScan,
|
||||||
WifiMessageTypeConnect,
|
WifiMessageTypeConnect,
|
||||||
WifiMessageTypeDisconnect
|
WifiMessageTypeDisconnect,
|
||||||
|
WifiMessageTypeAutoConnect,
|
||||||
} WifiMessageType;
|
} WifiMessageType;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -282,7 +283,7 @@ static bool copy_scan_list(Wifi* wifi) {
|
|||||||
|
|
||||||
static void auto_connect(Wifi* wifi) {
|
static void auto_connect(Wifi* wifi) {
|
||||||
for (int i = 0; i < wifi->scan_list_count; ++i) {
|
for (int i = 0; i < wifi->scan_list_count; ++i) {
|
||||||
const char* ssid = (const char*)wifi->scan_list[i].ssid;
|
auto ssid = reinterpret_cast<const char*>(wifi->scan_list[i].ssid);
|
||||||
if (settings::contains(ssid)) {
|
if (settings::contains(ssid)) {
|
||||||
static_assert(sizeof(wifi->scan_list[i].ssid) == (TT_WIFI_SSID_LIMIT + 1), "SSID size mismatch");
|
static_assert(sizeof(wifi->scan_list[i].ssid) == (TT_WIFI_SSID_LIMIT + 1), "SSID size mismatch");
|
||||||
settings::WifiApSettings ap_settings;
|
settings::WifiApSettings ap_settings;
|
||||||
@ -334,7 +335,9 @@ static void event_handler(TT_UNUSED void* arg, esp_event_base_t event_base, int3
|
|||||||
TT_LOG_I(TAG, "Finished scan");
|
TT_LOG_I(TAG, "Finished scan");
|
||||||
|
|
||||||
if (copied_list && wifi_singleton->radio_state == WIFI_RADIO_ON) {
|
if (copied_list && wifi_singleton->radio_state == WIFI_RADIO_ON) {
|
||||||
auto_connect(wifi_singleton);
|
WifiMessage message = {.type = WifiMessageTypeAutoConnect};
|
||||||
|
// No need to lock for queue
|
||||||
|
wifi_singleton->queue.put(&message, 100 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unlock(wifi_singleton);
|
unlock(wifi_singleton);
|
||||||
@ -709,6 +712,11 @@ _Noreturn int32_t wifi_main(TT_UNUSED void* parameter) {
|
|||||||
disconnect_internal_but_keep_active(wifi);
|
disconnect_internal_but_keep_active(wifi);
|
||||||
unlock(wifi);
|
unlock(wifi);
|
||||||
break;
|
break;
|
||||||
|
case WifiMessageTypeAutoConnect:
|
||||||
|
lock(wifi);
|
||||||
|
auto_connect(wifi_singleton);
|
||||||
|
unlock(wifi);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ CONFIG_LV_USE_CLIB_MALLOC=y
|
|||||||
CONFIG_FREERTOS_HZ=1000
|
CONFIG_FREERTOS_HZ=1000
|
||||||
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
||||||
CONFIG_FREERTOS_SMP=n
|
CONFIG_FREERTOS_SMP=n
|
||||||
CONFIG_FREERTOS_UNICORE=y
|
CONFIG_FREERTOS_UNICORE=n
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||||
|
|||||||
@ -12,7 +12,8 @@ CONFIG_LV_USE_CLIB_MALLOC=y
|
|||||||
CONFIG_FREERTOS_HZ=1000
|
CONFIG_FREERTOS_HZ=1000
|
||||||
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
||||||
CONFIG_FREERTOS_SMP=n
|
CONFIG_FREERTOS_SMP=n
|
||||||
CONFIG_FREERTOS_UNICORE=y
|
CONFIG_FREERTOS_UNICORE=n
|
||||||
|
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||||
|
|||||||
@ -12,7 +12,8 @@ CONFIG_LV_USE_CLIB_MALLOC=y
|
|||||||
CONFIG_FREERTOS_HZ=1000
|
CONFIG_FREERTOS_HZ=1000
|
||||||
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
||||||
CONFIG_FREERTOS_SMP=n
|
CONFIG_FREERTOS_SMP=n
|
||||||
CONFIG_FREERTOS_UNICORE=y
|
CONFIG_FREERTOS_UNICORE=n
|
||||||
|
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||||
|
|||||||
@ -12,7 +12,7 @@ CONFIG_LV_USE_CLIB_MALLOC=y
|
|||||||
CONFIG_FREERTOS_HZ=1000
|
CONFIG_FREERTOS_HZ=1000
|
||||||
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
||||||
CONFIG_FREERTOS_SMP=n
|
CONFIG_FREERTOS_SMP=n
|
||||||
CONFIG_FREERTOS_UNICORE=y
|
CONFIG_FREERTOS_UNICORE=n
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||||
|
|||||||
@ -12,7 +12,7 @@ CONFIG_LV_USE_CLIB_MALLOC=y
|
|||||||
CONFIG_FREERTOS_HZ=1000
|
CONFIG_FREERTOS_HZ=1000
|
||||||
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
||||||
CONFIG_FREERTOS_SMP=n
|
CONFIG_FREERTOS_SMP=n
|
||||||
CONFIG_FREERTOS_UNICORE=y
|
CONFIG_FREERTOS_UNICORE=n
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||||
|
|||||||
@ -12,7 +12,7 @@ CONFIG_LV_USE_CLIB_MALLOC=y
|
|||||||
CONFIG_FREERTOS_HZ=1000
|
CONFIG_FREERTOS_HZ=1000
|
||||||
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
||||||
CONFIG_FREERTOS_SMP=n
|
CONFIG_FREERTOS_SMP=n
|
||||||
CONFIG_FREERTOS_UNICORE=y
|
CONFIG_FREERTOS_UNICORE=n
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user