mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
97 lines
1.9 KiB
C
97 lines
1.9 KiB
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <pthread.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include "esp32_compat.h"
|
|
|
|
void* g_queue;
|
|
int g_queue_send_shall_fail = 0;
|
|
int g_size = 0;
|
|
|
|
const char * WIFI_EVENT = "wifi_event";
|
|
const char * ETH_EVENT = "eth_event";
|
|
|
|
esp_err_t esp_event_handler_register(const char * event_base,
|
|
int32_t event_id,
|
|
void* event_handler,
|
|
void* event_handler_arg)
|
|
{
|
|
return ESP_OK;
|
|
}
|
|
|
|
esp_err_t esp_event_handler_unregister(const char * event_base, int32_t event_id, void* event_handler)
|
|
{
|
|
return ESP_OK;
|
|
}
|
|
|
|
esp_err_t esp_timer_delete(esp_timer_handle_t timer)
|
|
{
|
|
return ESP_OK;
|
|
}
|
|
|
|
esp_err_t esp_timer_stop(esp_timer_handle_t timer)
|
|
{
|
|
return ESP_OK;
|
|
}
|
|
|
|
esp_err_t esp_timer_start_periodic(esp_timer_handle_t timer, uint64_t period)
|
|
{
|
|
return ESP_OK;
|
|
}
|
|
|
|
esp_err_t esp_timer_create(const esp_timer_create_args_t* create_args,
|
|
esp_timer_handle_t* out_handle)
|
|
{
|
|
return ESP_OK;
|
|
}
|
|
|
|
uint32_t xTaskGetTickCount(void)
|
|
{
|
|
static uint32_t tick = 0;
|
|
return tick++;
|
|
}
|
|
|
|
/// Queue mock
|
|
QueueHandle_t xQueueCreate( uint32_t uxQueueLength, uint32_t uxItemSize )
|
|
{
|
|
g_size = uxItemSize;
|
|
g_queue = malloc((uxQueueLength)*(uxItemSize));
|
|
return g_queue;
|
|
}
|
|
|
|
|
|
void vQueueDelete( QueueHandle_t xQueue )
|
|
{
|
|
free(xQueue);
|
|
}
|
|
|
|
uint32_t xQueueSend(QueueHandle_t xQueue, const void * pvItemToQueue, TickType_t xTicksToWait)
|
|
{
|
|
if (g_queue_send_shall_fail)
|
|
{
|
|
return pdFALSE;
|
|
}
|
|
else
|
|
{
|
|
memcpy(xQueue, pvItemToQueue, g_size);
|
|
return pdPASS;
|
|
}
|
|
}
|
|
|
|
|
|
uint32_t xQueueReceive(QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait)
|
|
{
|
|
return pdFALSE;
|
|
}
|
|
|
|
void GetLastItem(void *pvBuffer)
|
|
{
|
|
memcpy(pvBuffer, g_queue, g_size);
|
|
}
|
|
|
|
void ForceTaskDelete(void)
|
|
{
|
|
g_queue_send_shall_fail = 1;
|
|
}
|