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

📄 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
 *	Glib
 *\else
 *	Glib
 *\endif
 */
#include "glib/gthread.h"
/** 
 *\if russian_lng
 *	Glib port enter/exit critical functions
 *\else
 *	Glib port enter/exit critical functions
 *\endif
 */
GStaticRecMutex kernel_recursive_mutex;



#define PORT_ENTER_CRITICAL_SECTION() 				\
		g_static_rec_mutex_lock(&kernel_recursive_mutex)

#define PORT_EXIT_CRITICAL_SECTION() 				\
		g_static_rec_mutex_unlock(&kernel_recursive_mutex)

/** 
 *\if russian_lng
 *	This 
 *\else
 *	it is a pity but we have to do use this functions then do
 *	context switching (in cooperative glib is only yeld function).
 *	In MCU and other arches it makes automaticly
 *\endif
 */
 
#define PORT_SAVE_CRITICAL_SECTION_DEPTH(depth_variable)	\
		depth_variable=g_static_rec_mutex_unlock_full(&kernel_recursive_mutex)

#define PORT_RESTORE_CRITICAL_SECTION_DEPTH(depth_variable)	\
		g_static_rec_mutex_lock_full(&kernel_recursive_mutex, depth_variable);




#endif	/* _OS_PORT_FILE_H_  */

⌨️ 快捷键说明

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