📄 plat_dep.c
字号:
// 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)#include "plat_dep.h"#include "plat_clock.h"// last_sleep_time declared in msched.cextern uint16_t last_sleep_time;handle_t mos_disable_ints(void) { handle_t sreg; sreg = SREG; cli(); return sreg;}void kernel_timer_init(void){ //set to CTC mode TSLICE_CNTRLA &= ~((1 << WGM11) | (1 << WGM10)); TSLICE_CNTRLB &= ~((1 << WGM13)); TSLICE_CNTRLB |= (1 << WGM12); //set the prescaler TSLICE_CNTRLB |= (1 << CS12) | (1 << CS10); TSLICE_CNTRLB &= ~(1 << CS11); //set ocr to 20 ms TSLICE_OCR = TIMESLICE_20_MS; //clear interrupt flag mask TIFR |= (1 << TSLICE_FLAG); TIMSK |= (1 << TSLICE_INT); }void sleep_timer_init(void){ SLEEP_CNTRL &= ~(0 << SLEEP_INT); ASSR = 1 << AS0; //set prescaler and CTC mode SLEEP_CNTRL = (1 << CS02) | (1 << CS01) | (1 << CS00) | (1 << WGM01); SLEEP_CNTRL &= ~(1 << WGM00); SLEEP_CNT = 0; //set OCR to ??? ms SLEEP_OCR = 1; TIMSK &= ~(1 << SLEEP_INT); TIFR |= (1 << SLEEP_FLAG); last_sleep_time = 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -