Second round to make it work for ESP32S3.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2024-04-08 16:47:16 +02:00
parent 49f05e9e13
commit 06fd241f49
13 changed files with 196 additions and 164 deletions

View File

@@ -25,14 +25,17 @@
typedef QueueHandle_t queue_t;
#define queue_init(a,b,c) do { *(a) = xQueueCreate(c, b); } while(0)
#define queue_add_blocking(a,b) xQueueSend(*(a), b, portMAX_DELAY)
#define queue_remove_blocking(a,b) xQueueReceive(*(a), b, portMAX_DELAY)
#define queue_try_add(a,b) xQueueSend(*(a), b, 0)
#define queue_is_empty(a) (uxQueueMessagesWaiting(*(a)) == 0)
#define queue_try_remove(a,b) xQueueReceive(*(a), b, 0)
extern TaskHandle_t hcore0, hcore1;
#define multicore_launch_core1(a) xTaskCreate(a, "core1", 512, NULL, tskIDLE_PRIORITY, &hcore1)
#define multicore_reset_core1 vTaskEndScheduler
#define multicore_launch_core1(a) xTaskCreate((void(*)(void *))a, "core1", 4096, NULL, CONFIG_TINYUSB_TASK_PRIORITY + 2, &hcore1)
#define multicore_reset_core1() do { if (hcore1) { eTaskState e = eTaskGetState(hcore1); if (e == eRunning) { vTaskDelete(hcore1); }} }while(0)
#define sleep_ms(a) vTaskDelay(a / portTICK_PERIOD_MS)
#define board_millis xTaskGetTickCount
static inline uint32_t board_millis(void) {
return ( ( ((uint64_t) xTaskGetTickCount()) * 1000) / configTICK_RATE_HZ );
}
#define PICO_UNIQUE_BOARD_ID_SIZE_BYTES 8
typedef struct { uint8_t id[PICO_UNIQUE_BOARD_ID_SIZE_BYTES]; } pico_unique_board_id_t;
#define pico_get_unique_board_id(a) memset(a, 0, sizeof(pico_unique_board_id_t))
@@ -57,10 +60,8 @@ static inline bool multicore_lockout_end_timeout_us(int a) {
vTaskResume(hcore1); return true; }
#define save_and_disable_interrupts() 1
#include "esp_partition.h"
extern esp_partition_t part0;
#define flash_range_erase(a,b) esp_partition_erase_range(&part0, a, b)
#define flash_range_program(a,b,c) esp_partition_write(&part0, a, b, c)
#define flash_range_erase(a,b) esp_partition_erase_range(part0, a, b)
#define flash_range_program(a,b,c) esp_partition_write(part0, a, b, c)
#define restore_interrupts(a) (void)a
#endif