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

📄 plat_dep.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 msp430/include/plat_dep.h * @brief MSP430 Platform specific functions used in the kernel * */#ifndef __PLAT_DEP_H__#define __PLAT_DEP_H__#include <sys/types.h>#include <signal.h>#include <io.h>#include "mos.h"// 10k of RAM/** @brief Total bytes of memory */#define MEMORY_SIZE 10240#define ARCH_PROGMEM#define SETUP_SOFT_INT() do{     \   P2DIR |=  (1 << 5);           \   P2SEL |=  (1 << 5);           \   P2IES &= ~(1 << 5);           \   P2IE  |=  (1 << 5);           \}while(0)#define DISABLE_SOFT_INT() P2IFG &= ~(1 << 5)#define DO_SOFT_INT()      P2IFG |=  (1 << 5)// not necessary for msp430#define WAIT_FOR_ASYNC_UPDATE()// stack pointer typetypedef uint16_t stackval_t;// size of the SR -- used for mos_(enable|disable)_ints();typedef uint16_t handle_t;// minimum stack size#define PLAT_STACK_MIN 128#define ENABLE_INTS() eint()#define DISABLE_INTS() dint()#define PLAT_INIT()#define PRE_KERNEL_SLEEP()#define POST_KERNEL_SLEEP()// turn off TimerA#define DISABLE_TSLICE_TIMER() TACTL &= ~(MC_3)// start TimerA#define ENABLE_TSLICE_TIMER() TACTL |= MC_1#define TSLICE_TIMER_VALUE (TAR)// make sure the interrupt was triggered// because of a capture#define TSLICE_TIMER_EXPIRED (TAIV & 0x02)#define SET_TSLICE_TIMER_VALUE(value) TAR = value#define SET_TSLICE_OCR_VALUE(value) TACCR0 = TACCR1 = value// turn off TimerB#define DISABLE_SLEEP_TIMER() TBCTL &= ~(MC_3)// start TimerB#define ENABLE_SLEEP_TIMER() TBCTL |= MC_1#define SET_SLEEP_TIMER_VALUE(time) TBR = time#define SET_SLEEP_OCR_VALUE(value) TBCCR0 = TBCCR1 = value// make sure the interrupt was triggered// because of a capture#define SLEEP_TIMER_EXPIRED (TBIV & 0x02)// msp430 doesn't need to do anything special// to enable low power modes#define ENABLE_SLEEP()#define ENABLE_IDLE()// set low power mode bits in the SR to sleep#define SLEEP() _BIS_SR(LPM3_bits)#define IDLE() _BIS_SR(LPM0_bits)#define SOFT_INT_HEADER()   interrupt (PORT2_VECTOR) soft_trig_int()#define SLEEP_INT_HEADER()  interrupt (TIMERB1_VECTOR) sleep_wake_int()#define TSLICE_INT_HEADER() interrupt (TIMERA1_VECTOR) tslice_sig_int()/** @brief Initialize the hardware timer * This timer is used for the kernel time slice. */void kernel_timer_init(void);/** @brief initialize the timer used for sleeping * */void sleep_timer_init(void);/** @brief enables interrupts * */#define mos_enable_ints(int_handle) WRITE_SR(int_handle)/** @brief disables interrupts * */handle_t mos_disable_ints(void);#define GET_SP(sp) {		\      asm volatile(		\	 "mov.w r1, %0\n\t"	\	 :"=r" (sp) : );	\	 }#define srandom(seed) srand(seed)#define TIMESLICE_20_MS 655#endif

⌨️ 快捷键说明

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