software and system v1
This commit is contained in:
105
1 software design/components/osal/task_wrapper/COMPONENT.md
Normal file
105
1 software design/components/osal/task_wrapper/COMPONENT.md
Normal file
@@ -0,0 +1,105 @@
|
||||
# Task Wrapper Component
|
||||
## OSAL Layer - FreeRTOS Abstraction
|
||||
|
||||
**Component ID:** C-OSAL-TASK
|
||||
**Version:** 1.0
|
||||
**Date:** 2025-02-01
|
||||
**Location:** `osal/task_wrapper/`
|
||||
**ESP-IDF Service:** `freertos/FreeRTOS.h`, `freertos/task.h`
|
||||
|
||||
---
|
||||
|
||||
## 1. Component Overview
|
||||
|
||||
The Task Wrapper provides a platform-independent interface for FreeRTOS task management, abstracting ESP-IDF v5.4 FreeRTOS APIs. This component enables application components to create and manage tasks without direct FreeRTOS dependencies.
|
||||
|
||||
**Primary Purpose:** Abstract FreeRTOS task operations for application components.
|
||||
|
||||
---
|
||||
|
||||
## 2. Responsibilities
|
||||
|
||||
### 2.1 In-Scope
|
||||
|
||||
- Task creation and deletion
|
||||
- Task priority management
|
||||
- Task state queries
|
||||
- Task synchronization
|
||||
- Task watchdog integration
|
||||
- Task resource monitoring
|
||||
|
||||
### 2.2 Out-of-Scope
|
||||
|
||||
- Task scheduling (handled by FreeRTOS)
|
||||
- Task preemption (handled by FreeRTOS)
|
||||
- Interrupt handling (handled by ESP-IDF)
|
||||
|
||||
---
|
||||
|
||||
## 3. Provided Interfaces
|
||||
|
||||
### 3.1 Task Management Interface
|
||||
|
||||
```c
|
||||
/**
|
||||
* @brief Create FreeRTOS task
|
||||
* @param task_name Task name (for debugging)
|
||||
* @param task_func Task function
|
||||
* @param task_args Task function arguments
|
||||
* @param stack_size Stack size in bytes
|
||||
* @param priority Task priority
|
||||
* @param core_id CPU core ID (-1 for any core)
|
||||
* @param task_handle Output task handle
|
||||
* @return OSAL_OK on success
|
||||
*/
|
||||
osal_result_t osal_task_create(const char* task_name, TaskFunction_t task_func, void* task_args,
|
||||
uint32_t stack_size, uint32_t priority, int core_id,
|
||||
osal_task_handle_t* task_handle);
|
||||
|
||||
/**
|
||||
* @brief Delete task
|
||||
* @param task_handle Task handle
|
||||
* @return OSAL_OK on success
|
||||
*/
|
||||
osal_result_t osal_task_delete(osal_task_handle_t task_handle);
|
||||
|
||||
/**
|
||||
* @brief Delay task execution
|
||||
* @param delay_ms Delay in milliseconds
|
||||
*/
|
||||
void osal_task_delay(uint32_t delay_ms);
|
||||
```
|
||||
|
||||
### 3.2 Task Status Interface
|
||||
|
||||
```c
|
||||
/**
|
||||
* @brief Get task status
|
||||
* @param task_handle Task handle
|
||||
* @param status Output status structure
|
||||
* @return OSAL_OK on success
|
||||
*/
|
||||
osal_result_t osal_task_get_status(osal_task_handle_t task_handle, osal_task_status_t* status);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. FreeRTOS Integration
|
||||
|
||||
- Uses `xTaskCreate()` for task creation
|
||||
- Supports dual-core (Core 0, Core 1, or any)
|
||||
- Priority range: 0-25 (configurable)
|
||||
- Stack monitoring and overflow detection
|
||||
|
||||
---
|
||||
|
||||
## 5. Traceability
|
||||
|
||||
- **SWR-DESIGN-002:** Non-blocking operations
|
||||
- **SWR-DIAG-012:** Task watchdog integration
|
||||
- **CFC-TIME-01:** Non-blocking operation support
|
||||
|
||||
---
|
||||
|
||||
**Document Status:** Complete
|
||||
**Next Review:** Before implementation
|
||||
Reference in New Issue
Block a user