mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
55 lines
1.5 KiB
C
55 lines
1.5 KiB
C
/*
|
|
* @Author: jiejie
|
|
* @Github: https://github.com/jiejieTop
|
|
* @Date: 2019-12-15 18:31:44
|
|
* @LastEditTime: 2020-10-17 14:15:21
|
|
* @Description: the code belongs to jiejie, please keep the author information
|
|
* and source code according to the license.
|
|
*/
|
|
#ifndef _PLATFORM_THREAD_H_
|
|
#define _PLATFORM_THREAD_H_
|
|
|
|
#include "PikaObj.h"
|
|
#ifdef __linux
|
|
#include <pthread.h>
|
|
typedef struct platform_thread {
|
|
pthread_t thread;
|
|
pthread_mutex_t mutex;
|
|
pthread_cond_t cond;
|
|
} platform_thread_t;
|
|
#elif PIKA_FREERTOS_ENABLE
|
|
#include "FreeRTOS.h"
|
|
#include "task.h"
|
|
typedef struct platform_thread {
|
|
TaskHandle_t thread;
|
|
} platform_thread_t;
|
|
#else
|
|
/*
|
|
You need to create the __platform_thread.h for your platform.
|
|
For example:
|
|
You can #include <rtthread.h> in the __platform_thread.h
|
|
*/
|
|
#include "__platform_thread.h"
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
platform_thread_t* platform_thread_init(const char* name,
|
|
void (*entry)(void*),
|
|
void* const param,
|
|
unsigned int stack_size,
|
|
unsigned int priority,
|
|
unsigned int tick);
|
|
void platform_thread_startup(platform_thread_t* thread);
|
|
void platform_thread_stop(platform_thread_t* thread);
|
|
void platform_thread_start(platform_thread_t* thread);
|
|
void platform_thread_destroy(platform_thread_t* thread);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|