flipperzero-firmware/firmware/targets/local/Inc/cmsis_os.h
あく 3c2711102c
Target refactoring and cube update (#161)
* Lib: move cube to libs. Firmware: prepare for code base refactoring, detach from cube, port to cmsis_os2.

* Firmware, target f2: regenerate project with latest cube package, tim17 for os ticks.

* Firmware: unified codebase.

* Core: do not include semaphore on old targets. Firmware: dfu uplaod target.

* CI: submodules, add firmware build.

* CI: proper submodule config.

* refactor build system

* CI: update chain to use new targets. Documentation: update to match current structure.

* CI: clean before rebuild.

* Add local test

docker-compose exec dev make -C firmware TARGET=local TEST=1 run

* Makefile: target specific build directory. CI: updated artifacts path.

* Makefile: init git submodules if they don't exists.

* Makefile: debug rule now doesn't reset MCU, prevent SIGINT propagation to st-util.

* Makefile: proper rebuild sequence in zz and zzz

* Makefile: timestamp tracking for flash and upload commands.

* Apps: modular build. Input: fix flipper hal inline.

* Wiki: proper bootloader link.

* Applications: fix broken build for local targets.

* add st-flash to docker

* fix build

* force rebuild app

* move app force to firmware part

* fix build deps

* qrcode build ok

* fix example display

* add testing routine

* update build instruction

Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
Co-authored-by: aanper <mail@s3f.ru>
2020-10-07 12:37:43 +03:00

69 lines
2.3 KiB
C

#pragma once
#include "main.h"
#include <stdbool.h>
#include <pthread.h>
void osDelay(uint32_t ms);
// some FreeRTOS types
typedef void (*TaskFunction_t)(void*);
typedef size_t UBaseType_t;
typedef uint32_t StackType_t;
typedef uint32_t StaticTask_t;
typedef pthread_t* TaskHandle_t;
typedef enum {
SemaphoreTypeMutex,
SemaphoreTypeCounting,
} SemaphoreType;
typedef struct {
SemaphoreType type;
pthread_mutex_t mutex;
uint8_t take_counter;
uint8_t give_counter;
} StaticSemaphore_t;
typedef StaticSemaphore_t* SemaphoreHandle_t;
typedef uint32_t StaticQueue_t;
typedef StaticQueue_t* QueueHandle_t;
#define portMAX_DELAY -1
typedef enum { pdTRUE = 1, pdFALSE = 0 } BaseType_t;
typedef int32_t TickType_t;
#define tskIDLE_PRIORITY 0
TaskHandle_t xTaskCreateStatic(TaskFunction_t pxTaskCode,
const char* const pcName,
const uint32_t ulStackDepth,
void* const pvParameters,
UBaseType_t uxPriority,
StackType_t* const puxStackBuffer,
StaticTask_t* const pxTaskBuffer);
void vTaskDelete(TaskHandle_t xTask);
TaskHandle_t xTaskGetCurrentTaskHandle(void);
SemaphoreHandle_t xSemaphoreCreateMutexStatic(StaticSemaphore_t* pxMutexBuffer);
bool task_equal(TaskHandle_t a, TaskHandle_t b);
QueueHandle_t xQueueCreateStatic(UBaseType_t uxQueueLength,
UBaseType_t uxItemSize,
uint8_t* pucQueueStorageBuffer,
StaticQueue_t* pxQueueBuffer);
SemaphoreHandle_t xSemaphoreCreateCountingStatic(UBaseType_t uxMaxCount,
UBaseType_t uxInitialCount,
StaticSemaphore_t* pxSemaphoreBuffer);
BaseType_t xSemaphoreTake(SemaphoreHandle_t xSemaphore, TickType_t xTicksToWait);
BaseType_t xSemaphoreGive(SemaphoreHandle_t xSemaphore);
BaseType_t xQueueSend(QueueHandle_t xQueue, const void* pvItemToQueue, TickType_t xTicksToWait);
BaseType_t xQueueReceive(QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait);
void* pvTaskGetThreadLocalStoragePointer(TaskHandle_t xTaskToQuery, BaseType_t xIndex);
void vTaskSetThreadLocalStoragePointer(TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue);