feat(os): 添加 uC/OS-II 实时操作系统支持

- 在项目中集成 uC/OS-II 源代码和配置文件
- 修改 CMakeLists.txt 以包含 uC/OS-II 相关路径和源文件
- 更新 main.c 以使用 uC/OS-II 创建任务和管理调度
- 移除原有的裸机程序结构,为使用操作系统做准备
This commit is contained in:
ZZY
2025-06-30 10:57:53 +08:00
parent d939449267
commit 301e094671
15 changed files with 1193 additions and 258 deletions

View File

@ -5,6 +5,7 @@ cmake_minimum_required(VERSION 3.22)
add_library(SEGGER_RTT STATIC
RTT/SEGGER_RTT.c
RTT/SEGGER_RTT_printf.c
# RTT/SEGGER_RTT_ASM_ARMv7M.S
# 添加其他需要的源文件
)

View File

@ -185,7 +185,7 @@ static inline void lcd_set_region(int pos_x, int pos_y, int size_x, int size_y)
LCD_WRITE_INDEX(0x2c);
}
static int lcd_draw_point(ge_render_t* ctx, const ge_render_pos2_t* pos, uint16_t color) {
static int lcd_draw_point(ge_render_t* ctx, const ge_render_pos2_t* pos, ge_render_color_t color) {
(void)ctx;
Assert(pos != NULL);
lcd_set_region(pos->x, pos->y, 1, 1);
@ -200,7 +200,8 @@ static int lcd_draw_point(ge_render_t* ctx, const ge_render_pos2_t* pos, uint16_
return 0;
}
static int lcd_draw_rect(ge_render_t* ctx, const ge_render_rect_t* rect, uint16_t color) {
__unused
static int lcd_draw_rect(ge_render_t* ctx, const ge_render_rect_t* rect, ge_render_color_t color) {
(void)ctx;
const int pos_x = rect ? rect->pos.x : 0;
const int pos_y = rect ? rect->pos.y : 0;
@ -230,97 +231,103 @@ static int lcd_draw_rect(ge_render_t* ctx, const ge_render_rect_t* rect, uint16_
#define SCREEN_HEIGHT 128
#define SCREEN_WIDTH 128
#define HEAD_CANARY 0xDEAD
#define TAIL_CANARY 0xBEEF
typedef enum {
GE_RENDER_EVEN_LINES, // 渲染偶数数行
GE_RENDER_ODD_LINES, // 渲染奇数数行
} ge_render_field_t;
static struct ge_content {
typedef struct ge_context {
ge_render_field_t current_field;
uint16_t head_canary;
uint16_t screen_buffer[SCREEN_HEIGHT / 2][SCREEN_WIDTH];
uint16_t tail_canary;
} ge_content;
static ge_render_field_t current_field = GE_RENDER_EVEN_LINES;
} ge_context_t;
#define CTX_BUF(ctx) (((struct ge_content*)ctx->context)->screen_buffer)
#define CTX_BUF_PTR(ctx, x, y) ((uint16_t*)CTX_BUF(ctx) + SCREEN_WIDTH * (y) + (x))
#define HEAD_CANARY 0xDEAD
#define TAIL_CANARY 0xBEEF
static int init(ge_render_t* ctx, const ge_render_pos2_t* init_screen_size) {
static int init(ge_render_t* render, const ge_render_pos2_t* init_screen_size) {
(void)init_screen_size;
init_lcd();
/**
* set canary
*/
((struct ge_content*)ctx->context)->head_canary = HEAD_CANARY;
((struct ge_content*)ctx->context)->tail_canary = TAIL_CANARY;
ge_context_t* ctx = (ge_context_t*) render->context;
ctx->head_canary = HEAD_CANARY;
ctx->tail_canary = TAIL_CANARY;
return 0;
}
static int flush(ge_render_t* ctx) {
AssertFmt(((struct ge_content*)ctx->context)->head_canary == HEAD_CANARY, "Invalid head canary");
AssertFmt(((struct ge_content*)ctx->context)->tail_canary == TAIL_CANARY, "Invalid tail canary");
uint16_t* buffer = ((struct ge_content*)ctx->context)->screen_buffer;
static int flush(ge_render_t* render) {
ge_context_t* ctx = (ge_context_t*) render->context;
AssertFmt(ctx->head_canary == HEAD_CANARY, "Invalid head canary");
AssertFmt(ctx->tail_canary == TAIL_CANARY, "Invalid tail canary");
const ge_render_field_t current_field = ctx->current_field;
const int start_y = (current_field == GE_RENDER_EVEN_LINES) ? 0 : 1;
for (int buffer_y = 0; buffer_y < ctx->screen_size.y / 2; buffer_y++) {
for (int buffer_y = 0; buffer_y < render->screen_size.y / 2; buffer_y++) {
const int screen_y = start_y + buffer_y * 2;
// 设置当前行区域 (1行高)
lcd_set_region(0, screen_y, ctx->screen_size.y, 1);
lcd_set_region(0, screen_y, render->screen_size.y, 1);
GE_FAST_SET_OFF(LCD_CS);
GE_FAST_SET_ON(LCD_DC);
// 传输整行数据
uint16_t* line_ptr = buffer + buffer_y * ctx->screen_size.x;
for (int x = 0; x < ctx->screen_size.x; x++) {
lcd_write_byte(*line_ptr >> 8); // 高字节
lcd_write_byte(*line_ptr & 0xFF); // 低字节
line_ptr++;
for (int x = 0; x < render->screen_size.x; x++) {
const uint16_t data = ctx->screen_buffer[buffer_y][x];
lcd_write_byte(data >> 8); // 高字节
lcd_write_byte(data & 0xFF); // 低字节
}
GE_FAST_SET_ON(LCD_CS);
}
// 切换模式
current_field = (current_field == GE_RENDER_EVEN_LINES) ?
ctx->current_field = (current_field == GE_RENDER_EVEN_LINES) ?
GE_RENDER_ODD_LINES : GE_RENDER_EVEN_LINES;
return 0;
}
static inline int check_need_flush(ge_render_t* ctx, const ge_render_pos2_t* pos) {
static inline int check_need_flush(ge_render_t* render, const ge_render_pos2_t* pos) {
const int isOdd = pos->y % 2;
const int isNeedOdd = (current_field == GE_RENDER_ODD_LINES) ? 1 : 0;
const int isNeedOdd =
(((ge_context_t*) render->context)->current_field == GE_RENDER_ODD_LINES) ? 1 : 0;
return isOdd == isNeedOdd;
}
static inline int should_render_line(int y) {
return (y % 2) == (current_field == GE_RENDER_ODD_LINES);
static inline int should_render_line(ge_render_t* render, int y) {
return (y % 2) == (((ge_context_t*) render->context)->current_field == GE_RENDER_ODD_LINES);
}
static int buf_draw_rect(ge_render_t* ctx, const ge_render_rect_t* rect, uint16_t color) {
Assert(ctx != NULL && rect != NULL);
static int buf_draw_rect(ge_render_t* render, const ge_render_rect_t* rect, ge_render_color_t color) {
Assert(render != NULL && rect != NULL);
// 只更新属于当前场的行
for (int y = rect->pos.y; y < rect->pos.y + rect->size.y; y++) {
if (!should_render_line(y)) {
if (!should_render_line(render, y)) {
continue;
}
for (int x = rect->pos.x; x < rect->pos.x + rect->size.x; x++) {
*CTX_BUF_PTR(ctx, x, y / 2) = color;
((ge_context_t*)render->context)->screen_buffer[y/2][x] = color;
}
}
return 0;
}
static ge_context_t ge_context = {
.current_field = GE_RENDER_EVEN_LINES,
.head_canary = HEAD_CANARY,
.tail_canary = TAIL_CANARY,
};
ge_render_t ge_render = {
.context = &ge_content,
.context = &ge_context,
.screen_size = {
.x = 128,
.y = 128,
.x = SCREEN_WIDTH,
.y = SCREEN_HEIGHT,
},
.init_func = init,

View File

@ -4,7 +4,7 @@
#include "ge_resource.h"
typedef int ge_render_unit_t;
typedef int ge_render_color_t;
typedef uint16_t ge_render_color_t;
typedef struct ge_render_pos2 {
ge_render_unit_t x;

View File

@ -1,115 +0,0 @@
// #include "stm32f10x.h"
// #include "led.h"
// #include "usart.h"
// #include "delay.h"
// #include "button4_4.h"
#define __GE_INPUT_IMPLIMEMT__
#include "ge_mem_input.h"
struct IO_PORT
{
GPIO_TypeDef *GPIO_x;
unsigned short GPIO_pin;
};
static struct IO_PORT KEY_OUT[4] = {
{KEY_H1_GPIO_Port, KEY_H1_Pin},
{KEY_H2_GPIO_Port, KEY_H2_Pin},
{KEY_H3_GPIO_Port, KEY_H3_Pin},
{KEY_H4_GPIO_Port, KEY_H4_Pin}
};
static struct IO_PORT KEY_IN[4] = {
{KEY_L1_GPIO_Port, KEY_L1_Pin},
{KEY_L2_GPIO_Port, KEY_L2_Pin},
{KEY_L3_GPIO_Port, KEY_L3_Pin},
{KEY_L4_GPIO_Port, KEY_L4_Pin}
};
int key[4][4];
/*
void Button4_4_Init(void) {
GPIO_InitTypeDef GPIO_InitStructure;
unsigned char i;
RCC_APB2PeriphClockCmd(KEY_GPIO_CLK, ENABLE);
for(i = 0; i < 4; i++) {
GPIO_InitStructure.GPIO_Pin = KEY_OUT[i].GPIO_pin;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(KEY_OUT[i].GPIO_x, &GPIO_InitStructure);
}
for(i = 0; i < 4; i++) {
GPIO_InitStructure.GPIO_Pin = KEY_IN[i].GPIO_pin;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(KEY_IN[i].GPIO_x, &GPIO_InitStructure);
}
for(i = 0; i < 4; i++) {
GPIO_SetBits(KEY_OUT[i].GPIO_x, KEY_OUT[i].GPIO_pin);
}
for(i = 0; i < 4; i++) {
key[i][0] = 0;
key[i][1] = 0;
key[i][2] = 0;
key[i][3] = 0;
}
}
*/
//uint16_t key;
int Button4_4_Scan(void) {
unsigned char i, j;
for(i = 0; i < 4; i++) {
delay_ms(10);
GPIO_ResetBits(KEY_OUT[i].GPIO_x, KEY_OUT[i].GPIO_pin);
for(j = 0; j < 4; j++) {
delay_ms(10);
if(GPIO_ReadInputDataBit(KEY_IN[j].GPIO_x, KEY_IN[j].GPIO_pin) == 0){
key[i][j] = 1;
} else {
key[i][j] = 0;
}
}
GPIO_SetBits(KEY_OUT[i].GPIO_x, KEY_OUT[i].GPIO_pin);
}
if(key[0][0] == 1) return 16;
if(key[0][1] == 1) return 15;
if(key[0][2] == 1) return 14;
if(key[0][3] == 1) return 13;
if(key[1][0] == 1) return 12;
if(key[1][1] == 1) return 11;
if(key[1][2] == 1) return 10;
if(key[1][3] == 1) return 9;
if(key[2][0] == 1) return 8;
if(key[2][1] == 1) return 7;
if(key[2][2] == 1) return 6;
if(key[2][3] == 1) return 5;
if(key[3][0] == 1) return 4;
if(key[3][1] == 1) return 3;
if(key[3][2] == 1) return 2;
if(key[3][3] == 1) return 1;
return 0;
}

View File

@ -1,30 +0,0 @@
#ifndef __BUTTON4_4_H
#define __BUTTON4_4_H
#define KEY_GPIO_CLK RCC_APB2Periph_GPIOC
#define KEY_L1_Pin GPIO_Pin_0
#define KEY_L1_GPIO_Port GPIOC
#define KEY_L2_Pin GPIO_Pin_1
#define KEY_L2_GPIO_Port GPIOC
#define KEY_L3_Pin GPIO_Pin_2
#define KEY_L3_GPIO_Port GPIOC
#define KEY_L4_Pin GPIO_Pin_3
#define KEY_L4_GPIO_Port GPIOC
#define KEY_H1_Pin GPIO_Pin_4
#define KEY_H1_GPIO_Port GPIOC
#define KEY_H2_Pin GPIO_Pin_5
#define KEY_H2_GPIO_Port GPIOC
#define KEY_H3_Pin GPIO_Pin_6
#define KEY_H3_GPIO_Port GPIOC
#define KEY_H4_Pin GPIO_Pin_7
#define KEY_H4_GPIO_Port GPIOC
//#define BTN_GET_BIT(num, pos) ( (num) & ( 1 << (pos) ) )
//#define BTN_SET_TRUE(num, pos) ( (num) |= ( 1 << (pos) ) )
//#define BTN_SET_FALSE(num, pos) ( (num) &= ( ~( 1 << (pos) ) ) )
void Button4_4_Init(void);
int Button4_4_Scan(void);
#endif

View File

@ -1,25 +0,0 @@
#ifndef __GE_MEM_INPUT_H__
#define __GE_MEM_INPUT_H__
#include <main.h>
#include <gpio.h>
#include <stdint.h>
#include "../ge_interface.h"
int Button4_4_Scan(void);
#define delay_ms HAL_Delay
#define GPIO_ReadInputDataBit HAL_GPIO_ReadPin
#define GPIO_SetBits(port, pin) HAL_GPIO_WritePin(port, pin, 1)
#define GPIO_ResetBits(port, pin) HAL_GPIO_WritePin(port, pin, 0)
#ifdef __GE_INPUT_IMPLIMEMT__
void mem_input_btn_func(ge_input_t* ctx) {
uint16_t code = Button4_4_Scan();
ge_input_event_t event;
event.num = GE_ITYPE_KEY_L1H1 + code;
ctx->func_send(ctx, event);
}
#endif
#endif

View File

@ -0,0 +1,40 @@
# uC/OS-II RTOS integration for CMake
# 设置uC/OS-II的源代码路径
set(UCOS2_DIR ${CMAKE_SOURCE_DIR}/uC-OS2)
set(UCOS2_PORT_DIR ${UCOS2_DIR}/Ports/ARM-Cortex-M/ARMv6-M) # 根据您的MCU选择端口c
# 添加uC/OS-II的包含目录
include_directories(
${UCOS2_DIR}/Source
${UCOS2_PORT_DIR}/GNU
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_SOURCE_DIR}/Core/Inc
)
# 定义uC/OS-II的源文件
set(UCOS2_SOURCES
# ${UCOS2_DIR}/Source/os_core.c
# ${UCOS2_DIR}/Source/os_dbg_r.c
# ${UCOS2_DIR}/Source/os_flag.c
# ${UCOS2_DIR}/Source/os_mbox.c
# ${UCOS2_DIR}/Source/os_mem.c
# ${UCOS2_DIR}/Source/os_mutex.c
# ${UCOS2_DIR}/Source/os_q.c
# ${UCOS2_DIR}/Source/os_sem.c
# ${UCOS2_DIR}/Source/os_task.c
# ${UCOS2_DIR}/Source/os_time.c
# ${UCOS2_DIR}/Source/os_tmr.c
${UCOS2_DIR}/Source/ucos_ii.c
${UCOS2_PORT_DIR}/os_cpu_c.c
${UCOS2_PORT_DIR}/GNU/os_cpu_a.S
${UCOS2_PORT_DIR}/GNU/os_dbg.c
app_hooks.c
)
add_library(uCOS2 STATIC ${UCOS2_SOURCES})
target_include_directories(uCOS2 PUBLIC
${UCOS2_DIR}/Source
${UCOS2_PORT_DIR}/GNU
${CMAKE_CURRENT_LIST_DIR}
)

102
libs/uC-OS2/app_cfg.h Normal file
View File

@ -0,0 +1,102 @@
/*
*********************************************************************************************************
* EXAMPLE CODE
*
* This file is provided as an example on how to use Micrium products.
*
* Please feel free to use any application code labeled as 'EXAMPLE CODE' in
* your application products. Example code may be used as is, in whole or in
* part, or may be used as a reference only. This file can be modified as
* required to meet the end-product requirements.
*
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*
* APPLICATION CONFIGURATION
*
* EXAMPLE CODE
*
* Filename : app_cfg.h
*********************************************************************************************************
*/
#ifndef _APP_CFG_H_
#define _APP_CFG_H_
/*
*********************************************************************************************************
* INCLUDE FILES
*********************************************************************************************************
*/
#include <stdarg.h>
#include <stdio.h>
/*
*********************************************************************************************************
* MODULE ENABLE / DISABLE
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* TASK PRIORITIES
*********************************************************************************************************
*/
#define APP_CFG_STARTUP_TASK_PRIO 3u
#define OS_TASK_TMR_PRIO (OS_LOWEST_PRIO - 2u)
/*
*********************************************************************************************************
* TASK STACK SIZES
* Size of the task stacks (# of OS_STK entries)
*********************************************************************************************************
*/
#define APP_CFG_STARTUP_TASK_STK_SIZE 128u
/*
*********************************************************************************************************
* TRACE / DEBUG CONFIGURATION
*********************************************************************************************************
*/
#ifndef TRACE_LEVEL_OFF
#define TRACE_LEVEL_OFF 0u
#endif
#ifndef TRACE_LEVEL_INFO
#define TRACE_LEVEL_INFO 1u
#endif
#ifndef TRACE_LEVEL_DBG
#define TRACE_LEVEL_DBG 2u
#endif
/* ===== 中断优先级配置 ===== */
#define CPU_CFG_KA_IPL_BOUNDARY 0x0Fu /* 内核感知中断优先级阈值 */
#define CPU_CFG_NVIC_PRIO_BITS 4u /* NVIC优先级位数 */
#define APP_TRACE_LEVEL TRACE_LEVEL_OFF
#define APP_TRACE printf
#define APP_TRACE_INFO(x) ((APP_TRACE_LEVEL >= TRACE_LEVEL_INFO) ? (void)(APP_TRACE x) : (void)0)
#define APP_TRACE_DBG(x) ((APP_TRACE_LEVEL >= TRACE_LEVEL_DBG) ? (void)(APP_TRACE x) : (void)0)
/*
*********************************************************************************************************
* MODULE END
*********************************************************************************************************
*/
#endif /* End of module include. */

256
libs/uC-OS2/app_hooks.c Normal file
View File

@ -0,0 +1,256 @@
/*
*********************************************************************************************************
* EXAMPLE CODE
*
* This file is provided as an example on how to use Micrium products.
*
* Please feel free to use any application code labeled as 'EXAMPLE CODE' in
* your application products. Example code may be used as is, in whole or in
* part, or may be used as a reference only. This file can be modified as
* required to meet the end-product requirements.
*
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*
* uC/OS-II
* Application Hooks
*
* Filename : app_hooks.c
* Version : V2.93.01
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* INCLUDE FILES
*********************************************************************************************************
*/
#include <os.h>
#include "stm32f1xx_it.h"
/*
*********************************************************************************************************
* EXTERN GLOBAL VARIABLES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL CONSTANTS
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL DATA TYPES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL TABLES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL GLOBAL VARIABLES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL FUNCTION PROTOTYPES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*********************************************************************************************************
** GLOBAL FUNCTIONS
*********************************************************************************************************
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*********************************************************************************************************
** uC/OS-II APP HOOKS
*********************************************************************************************************
*********************************************************************************************************
*/
#if (OS_APP_HOOKS_EN > 0)
/*
*********************************************************************************************************
* TASK CREATION HOOK (APPLICATION)
*
* Description : This function is called when a task is created.
*
* Argument(s) : ptcb is a pointer to the task control block of the task being created.
*
* Note(s) : (1) Interrupts are disabled during this call.
*********************************************************************************************************
*/
void App_TaskCreateHook (OS_TCB *ptcb)
{
(void)ptcb;
}
/*
*********************************************************************************************************
* TASK DELETION HOOK (APPLICATION)
*
* Description : This function is called when a task is deleted.
*
* Argument(s) : ptcb is a pointer to the task control block of the task being deleted.
*
* Note(s) : (1) Interrupts are disabled during this call.
*********************************************************************************************************
*/
void App_TaskDelHook (OS_TCB *ptcb)
{
(void)ptcb;
}
/*
*********************************************************************************************************
* IDLE TASK HOOK (APPLICATION)
*
* Description : This function is called by OSTaskIdleHook(), which is called by the idle task. This hook
* has been added to allow you to do such things as STOP the CPU to conserve power.
*
* Argument(s) : none.
*
* Note(s) : (1) Interrupts are enabled during this call.
*********************************************************************************************************
*/
#if OS_VERSION >= 251
void App_TaskIdleHook (void)
{
}
#endif
/*
*********************************************************************************************************
* STATISTIC TASK HOOK (APPLICATION)
*
* Description : This function is called by OSTaskStatHook(), which is called every second by uC/OS-II's
* statistics task. This allows your application to add functionality to the statistics task.
*
* Argument(s) : none.
*********************************************************************************************************
*/
void App_TaskStatHook (void)
{
}
/*
*********************************************************************************************************
* TASK RETURN HOOK (APPLICATION)
*
* Description: This function is called if a task accidentally returns. In other words, a task should
* either be an infinite loop or delete itself when done.
*
* Arguments : ptcb is a pointer to the task control block of the task that is returning.
*
* Note(s) : none
*********************************************************************************************************
*/
#if OS_VERSION >= 289
void App_TaskReturnHook (OS_TCB *ptcb)
{
(void)ptcb;
}
#endif
/*
*********************************************************************************************************
* TASK SWITCH HOOK (APPLICATION)
*
* Description : This function is called when a task switch is performed. This allows you to perform other
* operations during a context switch.
*
* Argument(s) : none.
*
* Note(s) : (1) Interrupts are disabled during this call.
*
* (2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
* will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the
* task being switched out (i.e. the preempted task).
*********************************************************************************************************
*/
#if OS_TASK_SW_HOOK_EN > 0
void App_TaskSwHook (void)
{
PendSV_Handler();
}
#endif
/*
*********************************************************************************************************
* OS_TCBInit() HOOK (APPLICATION)
*
* Description : This function is called by OSTCBInitHook(), which is called by OS_TCBInit() after setting
* up most of the TCB.
*
* Argument(s) : ptcb is a pointer to the TCB of the task being created.
*
* Note(s) : (1) Interrupts may or may not be ENABLED during this call.
*********************************************************************************************************
*/
#if OS_VERSION >= 204
void App_TCBInitHook (OS_TCB *ptcb)
{
(void)ptcb;
if (ptcb->OSTCBExtPtr != 0) {
ptcb->OSTCBTaskName = (unsigned char*)ptcb->OSTCBExtPtr;
}
}
#endif
/*
*********************************************************************************************************
* TICK HOOK (APPLICATION)
*
* Description : This function is called every tick.
*
* Argument(s) : none.
*
* Note(s) : (1) Interrupts may or may not be ENABLED during this call.
*********************************************************************************************************
*/
#if OS_TIME_TICK_HOOK_EN > 0
void App_TimeTickHook (void)
{
SysTick_Handler();
}
#endif
#endif

154
libs/uC-OS2/os_cfg.h Normal file
View File

@ -0,0 +1,154 @@
/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
*
* Copyright 1992-2021 Silicon Laboratories Inc. www.silabs.com
*
* SPDX-License-Identifier: APACHE-2.0
*
* This software is subject to an open source license and is distributed by
* Silicon Laboratories Inc. pursuant to the terms of the Apache License,
* Version 2.0 available at www.apache.org/licenses/LICENSE-2.0.
*
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*
* uC/OS-II Configuration File for V2.9x
*
* Filename : os_cfg.h
* Version : V2.93.01
*********************************************************************************************************
*/
#ifndef OS_CFG_H
#define OS_CFG_H
/* ---------------------- MISCELLANEOUS ----------------------- */
#define OS_APP_HOOKS_EN 1u /* Application-defined hooks are called from the uC/OS-II hooks */
#define OS_ARG_CHK_EN 1u /* Enable (1) or Disable (0) argument checking */
#define OS_CPU_HOOKS_EN 1u /* uC/OS-II hooks are found in the processor port files */
#define OS_DEBUG_EN 1u /* Enable(1) debug variables */
#define OS_EVENT_MULTI_EN 1u /* Include code for OSEventPendMulti() */
#define OS_EVENT_NAME_EN 1u /* Enable names for Sem, Mutex, Mbox and Q */
#define OS_LOWEST_PRIO 63u /* Defines the lowest priority that can be assigned ... */
/* ... MUST NEVER be higher than 254! */
#define OS_MAX_EVENTS 10u /* Max. number of event control blocks in your application */
#define OS_MAX_FLAGS 5u /* Max. number of Event Flag Groups in your application */
#define OS_MAX_MEM_PART 5u /* Max. number of memory partitions */
#define OS_MAX_QS 4u /* Max. number of queue control blocks in your application */
#define OS_MAX_TASKS 20u /* Max. number of tasks in your application, MUST be >= 2 */
#define OS_SCHED_LOCK_EN 1u /* Include code for OSSchedLock() and OSSchedUnlock() */
#define OS_TICK_STEP_EN 1u /* Enable tick stepping feature for uC/OS-View */
#define OS_TICKS_PER_SEC 1000u /* Set the number of ticks in one second */
#define OS_TLS_TBL_SIZE 0u /* Size of Thread-Local Storage Table */
/* --------------------- TASK STACK SIZE ---------------------- */
#define OS_TASK_TMR_STK_SIZE 128u /* Timer task stack size (# of OS_STK wide entries) */
#define OS_TASK_STAT_STK_SIZE 128u /* Statistics task stack size (# of OS_STK wide entries) */
#define OS_TASK_IDLE_STK_SIZE 128u /* Idle task stack size (# of OS_STK wide entries) */
/* --------------------- TASK MANAGEMENT ---------------------- */
#define OS_TASK_CHANGE_PRIO_EN 1u /* Include code for OSTaskChangePrio() */
#define OS_TASK_CREATE_EN 1u /* Include code for OSTaskCreate() */
#define OS_TASK_CREATE_EXT_EN 1u /* Include code for OSTaskCreateExt() */
#define OS_TASK_DEL_EN 1u /* Include code for OSTaskDel() */
#define OS_TASK_NAME_EN 1u /* Enable task names */
#define OS_TASK_PROFILE_EN 1u /* Include variables in OS_TCB for profiling */
#define OS_TASK_QUERY_EN 1u /* Include code for OSTaskQuery() */
#define OS_TASK_REG_TBL_SIZE 1u /* Size of task variables array (#of INT32U entries) */
#define OS_TASK_STAT_EN 1u /* Enable (1) or Disable(0) the statistics task */
#define OS_TASK_STAT_STK_CHK_EN 1u /* Check task stacks from statistic task */
#define OS_TASK_SUSPEND_EN 1u /* Include code for OSTaskSuspend() and OSTaskResume() */
#define OS_TASK_SW_HOOK_EN 1u /* Include code for OSTaskSwHook() */
/* ----------------------- EVENT FLAGS ------------------------ */
#define OS_FLAG_EN 0u /* Enable (1) or Disable (0) code generation for EVENT FLAGS */
#define OS_FLAG_ACCEPT_EN 1u /* Include code for OSFlagAccept() */
#define OS_FLAG_DEL_EN 1u /* Include code for OSFlagDel() */
#define OS_FLAG_NAME_EN 1u /* Enable names for event flag group */
#define OS_FLAG_QUERY_EN 1u /* Include code for OSFlagQuery() */
#define OS_FLAG_WAIT_CLR_EN 1u /* Include code for Wait on Clear EVENT FLAGS */
#define OS_FLAGS_NBITS 16u /* Size in #bits of OS_FLAGS data type (8, 16 or 32) */
/* -------------------- MESSAGE MAILBOXES --------------------- */
#define OS_MBOX_EN 0u /* Enable (1) or Disable (0) code generation for MAILBOXES */
#define OS_MBOX_ACCEPT_EN 1u /* Include code for OSMboxAccept() */
#define OS_MBOX_DEL_EN 1u /* Include code for OSMboxDel() */
#define OS_MBOX_PEND_ABORT_EN 1u /* Include code for OSMboxPendAbort() */
#define OS_MBOX_POST_EN 1u /* Include code for OSMboxPost() */
#define OS_MBOX_POST_OPT_EN 1u /* Include code for OSMboxPostOpt() */
#define OS_MBOX_QUERY_EN 1u /* Include code for OSMboxQuery() */
/* --------------------- MEMORY MANAGEMENT -------------------- */
#define OS_MEM_EN 0u /* Enable (1) or Disable (0) code generation for MEMORY MANAGER */
#define OS_MEM_NAME_EN 1u /* Enable memory partition names */
#define OS_MEM_QUERY_EN 1u /* Include code for OSMemQuery() */
/* ---------------- MUTUAL EXCLUSION SEMAPHORES --------------- */
#define OS_MUTEX_EN 0u /* Enable (1) or Disable (0) code generation for MUTEX */
#define OS_MUTEX_ACCEPT_EN 1u /* Include code for OSMutexAccept() */
#define OS_MUTEX_DEL_EN 1u /* Include code for OSMutexDel() */
#define OS_MUTEX_QUERY_EN 1u /* Include code for OSMutexQuery() */
/* ---------------------- MESSAGE QUEUES ---------------------- */
#define OS_Q_EN 0u /* Enable (1) or Disable (0) code generation for QUEUES */
#define OS_Q_ACCEPT_EN 1u /* Include code for OSQAccept() */
#define OS_Q_DEL_EN 1u /* Include code for OSQDel() */
#define OS_Q_FLUSH_EN 1u /* Include code for OSQFlush() */
#define OS_Q_PEND_ABORT_EN 1u /* Include code for OSQPendAbort() */
#define OS_Q_POST_EN 1u /* Include code for OSQPost() */
#define OS_Q_POST_FRONT_EN 1u /* Include code for OSQPostFront() */
#define OS_Q_POST_OPT_EN 1u /* Include code for OSQPostOpt() */
#define OS_Q_QUERY_EN 1u /* Include code for OSQQuery() */
/* ------------------------ SEMAPHORES ------------------------ */
#define OS_SEM_EN 1u /* Enable (1) or Disable (0) code generation for SEMAPHORES */
#define OS_SEM_ACCEPT_EN 1u /* Include code for OSSemAccept() */
#define OS_SEM_DEL_EN 1u /* Include code for OSSemDel() */
#define OS_SEM_PEND_ABORT_EN 1u /* Include code for OSSemPendAbort() */
#define OS_SEM_QUERY_EN 1u /* Include code for OSSemQuery() */
#define OS_SEM_SET_EN 1u /* Include code for OSSemSet() */
/* --------------------- TIME MANAGEMENT ---------------------- */
#define OS_TIME_DLY_HMSM_EN 1u /* Include code for OSTimeDlyHMSM() */
#define OS_TIME_DLY_RESUME_EN 1u /* Include code for OSTimeDlyResume() */
#define OS_TIME_GET_SET_EN 1u /* Include code for OSTimeGet() and OSTimeSet() */
#define OS_TIME_TICK_HOOK_EN 1u /* Include code for OSTimeTickHook() */
/* --------------------- TIMER MANAGEMENT --------------------- */
#define OS_TMR_EN 1u /* Enable (1) or Disable (0) code generation for TIMERS */
#define OS_TMR_CFG_MAX 16u /* Maximum number of timers */
#define OS_TMR_CFG_NAME_EN 1u /* Determine timer names */
#define OS_TMR_CFG_WHEEL_SIZE 7u /* Size of timer wheel (#Spokes) */
#define OS_TMR_CFG_TICKS_PER_SEC 10u /* Rate at which timer management task runs (Hz) */
/* ---------------------- TRACE RECORDER ---------------------- */
#define OS_TRACE_EN 0u /* Enable (1) or Disable (0) uC/OS-II Trace instrumentation */
#define OS_TRACE_API_ENTER_EN 0u /* Enable (1) or Disable (0) uC/OS-II Trace API enter instrum. */
#define OS_TRACE_API_EXIT_EN 0u /* Enable (1) or Disable (0) uC/OS-II Trace API exit instrum. */
#endif