-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathclocksource.h
45 lines (33 loc) · 1.55 KB
/
clocksource.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
Copyright 2017 fishpepper <AT> gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http:// www.gnu.org/licenses/>.
author: fishpepper <AT> gmail.com
*/
#ifndef _CLOCKSOURCE_H_
#define _CLOCKSOURCE_H_
void clocksource_init(void);
// bit mask used to check the stability of XOSC
#define CLOCKSOURCE_XOSC_STABLE_BIT 0x40
// bit mak used to check the stability of the High-frequency RC oscillator
#define CLOCKSOURCE_HFRC_STB_BIT 0x20
// bit maks used to power down system clock oscillators
#define CLOCKSOURCE_OSC_PD_BIT 0x04
// bit mask used to control the system clock oscillator
#define CLOCKSOURCE_MAIN_OSC_BITS 0x7F
// bit mask used to select/check the system clock oscillator
#define CLOCKSOURCE_OSC_BIT 0x40
// macros to check for stable oscs:
#define CLOCKSOURCE_HFRC_OSC_STABLE() (SLEEP & (CLOCKSOURCE_HFRC_STB_BIT))
#define CLOCKSOURCE_XOSC_STABLE() (SLEEP & (CLOCKSOURCE_XOSC_STABLE_BIT))
#define CLOCKSOURCE_XOSC 0
#define CLOCKSOURCE_HFRC 1
#endif