yb_arm/osp/inc/ospTimer.h
2023-07-12 14:14:31 +08:00

81 lines
1.9 KiB
C

#ifndef __OSPTIMERH__
#define __OSPTIMERH__
#ifdef __cplusplus
extern "C" {
#endif
/* timer pool number define */
#define OSP_TIMER_NUM (8)
typedef enum {
TIMER_RUNNING = 1,
TIMER_SUSPEND,
TIMER_READY,
}TimerState;
typedef struct NODE{
uint32_t TimerOff;
uint32_t NextNodeOff;
}Node;
typedef struct tag_Osp_Timer_Tcb
{
uint32_t Repeat;
uint32_t DstTaskId;
uint32_t Period;
int32_t TimeOut;
uint32_t Delay;
uint64_t RunCnt;
uint32_t State;
int32_t Fd;
uint32_t MaxTimeOut;
uint32_t TimeOutCnt;
uint32_t Valid;
}OSP_timer_Tcb;
#define MSG_TO_PTIMER(msg) ((uint64_t)(msg) + MSG_HEAD_SIZE)
extern OSP_STATUS osp_timer_pool_init(void);
extern void *osp_timer_create_sim(uint32_t DstTaskId, bool isRepeat, uint32_t timeout, uint32_t Delay);
extern void *OSP_timerCreate(uint32_t DstTaskId, uint64_t param1, uint64_t param2, bool isRepeat, uint32_t timeout, OSP_FUNCPTR timerCallback, uint32_t Delay);
extern OSP_STATUS osp_timer_start(void *pTimer);
extern OSP_STATUS OSP_timerDelete(void *pTimer);
extern void osp_timer_del_sim(void *timer);
extern OSP_STATUS osp_timer_callback(uint64_t ospTaskId, uint64_t timer);
extern void osp_show_timer_count(void);
extern int32_t osp_clk_rate_get(void);
extern uint64_t osp_get_osp_ticks(void);
extern void osp_set_ticks(uint64_t ticks);
extern void showRunTimerInfo(void);
extern void showStopTimerInfo(void);
extern uint64_t OSP_getTimerRemainTime(void *pTimer);
extern uint32_t osp_get_systick();
extern void osp_pridel_time(void);
void osp_show_timer_info(void);
int32_t CreatFreSynFd(uint32_t pri, uint32_t offset);
void osp_timer_suspend_sim(void *timer);
void osp_tick_less(void);
uint64_t osp_get_cycel(void);
#ifdef __cplusplus
}
#endif
#endif /* __OSPTIMERH__ */