⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 port_os.h

📁 在AVR单片机上使用的一款RTOS
💻 H
字号:
/*
 *  iRTOS
 *  Copyright (C) 2008  Dmitriy Cherepanov
 *
 *  This file is part of iRTOS
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public either
 *  version 2.1 of the License, or (at your option) any later version.
 *  This source is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  Do not be lasy! Look http://irtos.sourceforge.net for the latest version.
 */

#ifndef _OS_PORT_FILE_H_
#define _OS_PORT_FILE_H_ 1
/** \file
 *\if russian_lng
 *	AVR port os functions and macroses
 *\else
 *	AVR port os functions and macroses
 *\endif
 */

#define PORT_DISABLE_INTERRUPTS()	asm volatile ( "cli" )
#define PORT_ENABLE_INTERRUPTS()	asm volatile ( "sei" )
/** 
 *\if russian_lng
 *	AVR port enter/exit critical functions
 *\else
 *	AVR port enter/exit critical functions
 *\endif
 */

// PTHREAD_MUTEX_RECURSIVE
/*this variable is part of thread context must be saved with thread if 
	it do thread_yiel by himself
*/
extern unsigned iarch port_os_critic_nest;
#include "kernel/variables.h" //for thisTCB
#define PORT_ENTER_CRITICAL_SECTION() 				\
		PORT_DISABLE_INTERRUPTS();			\
		port_os_critic_nest--;

#define PORT_EXIT_CRITICAL_SECTION() 				\
 		port_os_critic_nest--;				\
		if (port_os_critic_nest==0)			\
			PORT_DISABLE_INTERRUPTS()

extern unsigned iarch port_os_critic_nest;
/**牮栩梓羼觇

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -