delete some code

This commit is contained in:
supowang
2021-08-05 20:10:56 +08:00
parent 90859c8754
commit 1f694e2156
3228 changed files with 79 additions and 1492933 deletions

View File

@@ -1,72 +1,34 @@
#include "cmsis_os.h"
#include "tos_k.h"
#define TASK1_STK_SIZE 1024
void task1(void *arg);
osThreadDef(task1, osPriorityNormal, 1, TASK1_STK_SIZE);
#define TASK1_STK_SIZE 1024
k_task_t task1;
uint8_t task1_stk[TASK1_STK_SIZE];
#define TASK2_STK_SIZE 1024
void task2(void *arg);
osThreadDef(task2, osPriorityNormal, 1, TASK2_STK_SIZE);
#if TOS_CFG_TASK_DYNAMIC_CREATE_EN > 0u
#define TASK3_STK_SIZE 512
void task3(void *arg);
#endif
#define TASK2_STK_SIZE 1024
k_task_t task2;
uint8_t task2_stk[TASK2_STK_SIZE];
void task1(void *arg)
void task1_entry(void *arg)
{
#if TOS_CFG_TASK_DYNAMIC_CREATE_EN > 0u
osThreadId task_dyn_created;
osThreadDynamicDef(task3, osPriorityNormal, 1, TASK3_STK_SIZE);
task_dyn_created = osThreadCreate(osThread(task3), NULL);
int count = 0;
#endif
while (1) {
printf("###I am task1\r\n");
osDelay(2000);
#if TOS_CFG_TASK_DYNAMIC_CREATE_EN > 0u
if (count++ == 3) {
printf("###I am task1, kill the task3(dynamic created)\r\n");
osThreadTerminate(task_dyn_created);
}
#endif
tos_task_delay(2000);
}
}
void task2(void *arg)
void task2_entry(void *arg)
{
while (1) {
#if TOS_CFG_TASK_STACK_DRAUGHT_DEPTH_DETACT_EN > 0u
k_err_t rc;
int depth;
rc = tos_task_stack_draught_depth(K_NULL, &depth);
printf("%d %d\n", rc, depth);
#endif
printf("***I am task2\r\n");
osDelay(1000);
tos_task_delay(1000);
}
}
#if TOS_CFG_TASK_DYNAMIC_CREATE_EN > 0u
void task3(void *arg)
{
while (1) {
printf("$$$I am task3(dynamic created)\r\n");
osDelay(2000);
}
}
#endif
void application_entry(void *arg)
{
printf("***I am task\r\n");
osThreadCreate(osThread(task1), NULL); // Create task1
osThreadCreate(osThread(task2), NULL); // Create task2
tos_task_create(&task1, "task1", task1_entry, NULL, 3, task1_stk, TASK1_STK_SIZE, 0); // Create task1
tos_task_create(&task2, "task2", task2_entry, NULL, 3, task2_stk, TASK2_STK_SIZE, 0);// Create task2
}