You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
430 B
18 lines
430 B
// thread.h
|
|
#ifndef __THREAD_H
|
|
#define __THREAD_H
|
|
#include <stdint.h>
|
|
|
|
#define STACK_SIZE 512 // 每个任务的栈大小(按需调整)
|
|
|
|
typedef struct tcb
|
|
{
|
|
uint32_t *stack_ptr; // 任务栈指针
|
|
uint32_t task_id; // 任务 ID
|
|
struct tcb * next;
|
|
} tcb_t;
|
|
|
|
void init_task(tcb_t *tcb, void (*task_entry)(void *), uint8_t *start_stack, void *arg);
|
|
void start_first_task(void);
|
|
void tcb_scheduler(void);
|
|
#endif
|