mirror of
https://gitee.com/cosyos/cosyos.git
synced 2026-02-05 11:29:44 +08:00
删除文件 System/sv_int_loc.c
This commit is contained in:
@@ -1,188 +0,0 @@
|
||||
/**************************************************************************//**
|
||||
* @item CosyOS-II Kernel
|
||||
* @file sv_int_loc.c
|
||||
* @brief 中断本地服务(仅在用户中断中调用,并在本地执行)
|
||||
* @author 迟凯峰
|
||||
* @version V2.1.1
|
||||
* @date 2024.04.04
|
||||
******************************************************************************/
|
||||
|
||||
#include "os_var.h"
|
||||
#include "os_api.h"
|
||||
|
||||
#if SYSCFG_MCUCORE == 8051
|
||||
#pragma NOAREGS
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 任务调度
|
||||
*/
|
||||
|
||||
void si_task_schedule(void)
|
||||
{
|
||||
s_sign_schedule_all = true;
|
||||
s_sign_schedule = true;
|
||||
mPendSV_Set;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 二值信号量
|
||||
*/
|
||||
#if SYSCFG_BINARY == __ENABLED__
|
||||
/* 获取 */
|
||||
s_bool_t si_take_binary(s_binary_tsp bin)
|
||||
{
|
||||
if(bin->binary){
|
||||
bin->binary = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 飞信
|
||||
*/
|
||||
#if SYSCFG_FETION == __ENABLED__
|
||||
/* 接收飞信 */
|
||||
m_fetion_t si_recv_fetion(s_fetion_tsp fet)
|
||||
{
|
||||
m_fetion_t fetion = fet->fetion;
|
||||
fet->fetion = false;
|
||||
return fetion;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 消息邮箱(接收邮件)
|
||||
*/
|
||||
#if SYSCFG_MAILBOX == __ENABLED__
|
||||
|
||||
#if SYSCFG_MCUCORE == 8051
|
||||
|
||||
s_bool_t si_can_read_gmbox(s_mailbox_tsp gm)
|
||||
{
|
||||
if(s_sign_write_mbox_accessor
|
||||
|| s_mbox_accessor == OS_NULL || s_mbox_accessor->gm != gm){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#if SYSCFG_MAILBOX_ACCESSMECHANISM == 1
|
||||
|
||||
s_bool_t si_can_read_lmbox(void)
|
||||
{
|
||||
if(!s_mbox_accessor->lf) return false;
|
||||
s_mbox_accessor->lf = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void *si_get_lmbox(void)
|
||||
{
|
||||
return s_mbox_accessor->lm;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
s_bool_t si_recv_mail(void *lm, s_mailbox_tsp gm, size_t size) MCUCFG_251_REENTRANT
|
||||
{
|
||||
if(s_mbox_accessor == OS_NULL || s_mbox_accessor->gm != gm){
|
||||
if(gm->gf){
|
||||
gm->gf = false;
|
||||
s_memcpy(lm, &gm->mail0, size);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#if SYSCFG_MAILBOX_ACCESSMECHANISM == 1
|
||||
else if(s_mbox_accessor->lf){
|
||||
s_mbox_accessor->lf = false;
|
||||
s_memcpy(lm, s_mbox_accessor->lm, size);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 消息队列(接收消息)
|
||||
*/
|
||||
#if SYSCFG_MSGQUEUE == __ENABLED__
|
||||
|
||||
#if SYSCFG_MCUCORE == 8051
|
||||
|
||||
s_bool_t si_can_access_queue(s_queue_tsp queue)
|
||||
{
|
||||
if(!queue->mutex) goto __RET_FALSE;
|
||||
queue->mutex = false;
|
||||
if(queue->type == __DYNAMIC__){
|
||||
#if SYSCFG_DEBUGGING == __ENABLED__
|
||||
s_fault.error_recvmsg_int = true;
|
||||
#endif
|
||||
goto __BACK_MUTEX;
|
||||
}
|
||||
if(!queue->counter) goto __BACK_MUTEX;
|
||||
return true;
|
||||
|
||||
__BACK_MUTEX:
|
||||
queue->mutex = true;
|
||||
|
||||
__RET_FALSE:
|
||||
return false;
|
||||
}
|
||||
|
||||
static void *_recv_msg_(s_bool_t _OBJ_MEM_ *mut, void *msg)
|
||||
{
|
||||
*mut = true;
|
||||
return msg;
|
||||
}
|
||||
|
||||
void *si_recv_msg(s_queue_tsp queue)
|
||||
{
|
||||
void *msg;
|
||||
sRecvMsg_Static(msg);
|
||||
return _recv_msg_((s_bool_t *)&queue->mutex, msg);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void *si_recv_msg(s_queue_tsp queue)
|
||||
{
|
||||
void *msg = OS_NULL;
|
||||
if(!queue->mutex) return OS_NULL;
|
||||
queue->mutex = false;
|
||||
if(queue->type == __DYNAMIC__){
|
||||
#if SYSCFG_DEBUGGING == __ENABLED__
|
||||
s_fault.error_recvmsg_int = true;
|
||||
#endif
|
||||
}
|
||||
else if(!queue->counter);
|
||||
else{
|
||||
sRecvMsg_Static(msg);
|
||||
}
|
||||
queue->mutex = true;
|
||||
return msg;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user