KT24-1110_65E-HA-651B/include_lib/system/os/os_api.h

447 lines
12 KiB
C
Raw Permalink Normal View History

2024-11-10 10:44:17 +00:00
#ifndef OS_API_H
#define OS_API_H
#ifdef __cplusplus
extern "C"
{
#endif
#include "generic/typedef.h"
//#include "generic/list.h"
#include "os/os_cpu.h"
#include "os/os_error.h"
#include "os/os_type.h"
#define Q_MSG 0x100000
#define Q_EVENT 0x200000
#define Q_CALLBACK 0x300000
#define Q_USER 0x400000
#define OS_DEL_NO_PEND 0u
#define OS_DEL_ALWAYS 1u
#define OS_TASK_DEL_REQ 0x01u
#define OS_TASK_DEL_RES 0x02u
#define OS_TASK_DEL_OK 0x03u
#define OS_TASK_SELF (char *)0x1
#define OS_TASK_FATHER (char *)0x2
#define OS_MSG_KEY 1
#define OS_MSG_TOUCH 2
#define OS_MSG_EVENT 3
#define OS_MSG_CALLBACK 4
#define OS_MSG_DEL_REQ 5
#define OS_MSG_MSG 6
/*struct os_msg {
int type;
int msg;
int err;
u8 deleted;
char ref;
OS_SEM sem;
OS_MUTEX mutex;
struct list_head entry;
u32 data[0];
};*/
/*struct os_msg_callback {
struct os_msg msg;
u8 argc;
u8 sync;
u8 arg_exp;
int argv[8];
void *function;
};*/
#ifdef CONFIG_CPU_BR25
void *os_init();
#else
void os_init();
#endif
void os_start(void);
void os_init_tick(int);
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Param task :
* @Param p_arg :
* @Param prio :
* @Param stksize :, (u32)
* @Param qsize :queue大小(byte)
* @Param name :
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_task_create(void (*task)(void *p_arg),
void *p_arg,
u8 prio,
u32 stksize,
int qsize,
const char *name);
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
const char *os_current_task();
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Param name :
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_task_del_req(const char *name);
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Param name: OS_TASK_SELF
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_task_del_res(const char *name);
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Param name :
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_task_del(const char *name);
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Param time_tick :
*/
/* ----------------------------------------------------------------------------*/
void os_time_dly(int time_tick);
/* --------------------------------------------------------------------------*/
/**
* @brief :Q_USER类型taskq
*
* @Param name :
* @Param argc :8int类型
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_taskq_post(const char *name, int argc, ...);
/* --------------------------------------------------------------------------*/
/**
* @brief :taskq
*
* @Param argc :queue长度(int)
* @Param argv :queue的buf
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_taskq_accept(int argc, int *argv);
/* --------------------------------------------------------------------------*/
/**
* @brief :taskq
*
* @Param fmt :NULL
* @Param argv :queue的buf
* @Param argc :queue长度(int)
* @Param tick :0
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_taskq_pend(const char *fmt, int *argv, int argc);
int os_task_pend(const char *fmt, int *argv, int argc);
int __os_taskq_pend(int *argv, int argc, int tick);
/* --------------------------------------------------------------------------*/
/**
* @brief :taskq
*
* @Param name :
* @Param type :queue类型
* @Param argc :
* @Param argv
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_taskq_post_type(const char *name, int type, int argc, int *argv);
/* --------------------------------------------------------------------------*/
/**
* @brief :Q_MSG类型的taskq
*
* @Param name :
* @Param argc :
* @Param ...
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_taskq_post_msg(const char *name, int argc, ...);
/* --------------------------------------------------------------------------*/
/**
* @brief :Q_EVENT类型的taskq
*
* @Param name :
* @Param argc :
* @Param ...
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_taskq_post_event(const char *name, int argc, ...);
/* --------------------------------------------------------------------------*/
/**
* @brief :taskq
*
* @Param name :
* @Param type :taskq的类型
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_taskq_del_type(const char *name, int type);
int os_taskq_del(const char *name, int type);
/* --------------------------------------------------------------------------*/
/**
* @brief :taskq
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_taskq_flush();
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Param sem:
* @Param int:
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_sem_create(OS_SEM *, int);
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Param sem :
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_sem_accept(OS_SEM *);
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Param sem:
* @Param timeout:0
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_sem_pend(OS_SEM *, int timeout);
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Param sem:
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_sem_post(OS_SEM *);
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Param sem:
* @Param block:
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_sem_del(OS_SEM *, int block);
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Param sem:
* @Param cnt:
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_sem_set(OS_SEM *, u16 cnt);
/* --------------------------------------------------------------------------*/
/**
* @brief :queueQUEUE_TYPE_COUNTING_SEMAPHORE
*
* @Param : true:, fail:
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_sem_valid(OS_SEM *);
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Param sem:
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_sem_query(OS_SEM *);
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Param mutex:
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_mutex_create(OS_MUTEX *);
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Param mutex:
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_mutex_accept(OS_MUTEX *);
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Param mutex:
* @Param timeout:0
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_mutex_pend(OS_MUTEX *, int timeout);
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Param mutex:
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_mutex_post(OS_MUTEX *);
/* --------------------------------------------------------------------------*/
/**
* @brief :
*
* @Param mutex:
* @Param block:
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_mutex_del(OS_MUTEX *, int block);
/* --------------------------------------------------------------------------*/
/**
* @brief :queueQUEUE_TYPE_MUTEX
*
* @Param : true:, fail:
*
* @Returns :
*/
/* ----------------------------------------------------------------------------*/
int os_mutex_valid(OS_MUTEX *);
/*struct os_msg *os_message_create(int size);
int os_message_receive(struct os_msg **msg, int block_time);
int os_message_send(const char *task_name, struct os_msg *msg, int msgflg);
int os_message_delete(struct os_msg *msg);*/
int os_q_create(OS_QUEUE *pevent, /*void **start, */QS size);
int os_q_del(OS_QUEUE *pevent, u8 opt);
int os_q_flush(OS_QUEUE *pevent);
int os_q_pend(OS_QUEUE *pevent, int timeout, void *msg);
int os_q_post(OS_QUEUE *pevent, void *msg);
int os_q_query(OS_QUEUE *pevent);
int os_q_valid(OS_QUEUE *pevent);
int task_queue_post_event(const char *name, void *data, int len);
#ifdef __cplusplus
}
#endif
#endif