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

📄 msched.h

📁 MANTIS是由科罗拉多大学开发的传感器网络嵌入式操作系统。 这是mantis的0.9.5版本的源码。
💻 H
字号:
//  This file is part of MANTIS OS, Operating System//  See http://mantis.cs.colorado.edu/////  Copyright (C) 2003,2004,2005 University of Colorado, Boulder////  This program is free software; you can redistribute it and/or//  modify it under the terms of the mos license (see file LICENSE)/** @file linux/include/msched.h * @brief Implementation of MOS scheduler function on top of pthreads * @author Jeff Rose * @date 10/24/2002 * This is a scheduler written for the atmega128 mcu, but it is easily * portable to a new platform with a little assembly knowledge. */#ifndef SCHED_H_#define SCHED_H_#include <inttypes.h>#include <pthread.h>#define MAX_THREADS 15#define NUM_PRIORITIES 4 // Total number of possible priorities#define PRIORITY_IDLE (NUM_PRIORITIES - 1)#define PRIORITY_NORMAL (NUM_PRIORITIES - 2)#define PRIORITY_HIGH (NUM_PRIORITIES - 3)#define PRIORITY_KERNEL 0/* Possible thread states. */#define EMPTY      0#define RUNNING    1#define READY      2#define BLOCKED    3/* return codes */#define THREAD_OK       0#define NO_MORE_THREADS 1typedef struct thread_s {   pthread_t pt;   pthread_cond_t blocker; //used to suspend/resume thread   pthread_mutex_t blockerMux; //protects blocker   void (*func)(void);   uint8_t state;   uint8_t priority;   struct thread_s *next;} thread_t;void sched_init(void);void mos_sched_start(void);void mos_sched_time_slice(uint8_t slice);void mos_thread_sleep (uint32_t sleep_time);uint8_t mos_disable_ints(void);void mos_enable_ints(uint8_t int_handle);uint8_t mos_thread_new(void (*function_start)(void),		       uint16_t stack_size,		       uint8_t priority);#define mos_thread_new_havestack(func,size,stack,priority) mos_thread_new(func,size,priority)void mos_thread_suspend(void);void mos_thread_suspend_noints(uint8_t int_handle);void mos_thread_resume(thread_t *thread);void mos_thread_resume_noints(thread_t *thread, uint8_t int_handle);thread_t *mos_thread_current(void);void mos_thread_exit(void);#endif

⌨️ 快捷键说明

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