timerutil.h
1 /* 2 Copyright Frank Bösing, 2017 3 4 This file is part of Teensy64. 5 6 Teensy64 is free software: you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 Teensy64 is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with Teensy64. If not, see <http://www.gnu.org/licenses/>. 18 19 Diese Datei ist Teil von Teensy64. 20 21 Teensy64 ist Freie Software: Sie können es unter den Bedingungen 22 der GNU General Public License, wie von der Free Software Foundation, 23 Version 3 der Lizenz oder (nach Ihrer Wahl) jeder späteren 24 veröffentlichten Version, weiterverbreiten und/oder modifizieren. 25 26 Teensy64 wird in der Hoffnung, dass es nützlich sein wird, aber 27 OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite 28 Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK. 29 Siehe die GNU General Public License für weitere Details. 30 31 Sie sollten eine Kopie der GNU General Public License zusammen mit diesem 32 Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>. 33 34 */ 35 36 #ifndef _UTIL_C64H_ 37 #define _UTIL_C64H_ 38 39 #include "Teensy64.h" 40 41 void disableEventResponder(void); 42 43 void enableCycleCounter(void); 44 inline unsigned fbmillis(void) __attribute__((always_inline)); 45 inline unsigned fbmicros(void) __attribute__((always_inline)); 46 inline unsigned fbnanos(void) __attribute__((always_inline)); 47 48 49 unsigned fbmillis(void) { return (ARM_DWT_CYCCNT * (1000.0/F_CPU)); } 50 unsigned fbmicros(void) { return (ARM_DWT_CYCCNT * (1000000.0/F_CPU)); } 51 unsigned fbnanos(void) { return (ARM_DWT_CYCCNT * (1000000000.0 / F_CPU)); } 52 53 float setAudioSampleFreq(float freq); 54 void setAudioOff(void); 55 void setAudioOn(void); 56 void listInterrupts(); 57 58 59 60 #endif