Contiki-Inga 3.x
xmega_clock.h
1 #ifndef __XMEGA_CLOCK_H__
2 #define __XMEGA_CLOCK_H__
3 
4 #include <avr/io.h>
5 #include <stdint.h>
6 
7 // we might even allow higher CPU frequencies here - NOT TESTED
8 
9 #if F_CPU == 32000000UL
10  #define XMEGA_CLOCK_CONF_PLL_FACTOR 16
11 #elif F_CPU == 30000000UL
12  #define XMEGA_CLOCK_CONF_PLL_FACTOR 15
13 #elif F_CPU == 28000000UL
14  #define XMEGA_CLOCK_CONF_PLL_FACTOR 14
15 #elif F_CPU == 26000000UL
16  #define XMEGA_CLOCK_CONF_PLL_FACTOR 13
17 #elif F_CPU == 24000000UL
18  #define XMEGA_CLOCK_CONF_PLL_FACTOR 12
19 #elif F_CPU == 22000000UL
20  #define XMEGA_CLOCK_CONF_PLL_FACTOR 11
21 #elif F_CPU == 20000000UL
22  #define XMEGA_CLOCK_CONF_PLL_FACTOR 10
23 #elif F_CPU == 18000000UL
24  #define XMEGA_CLOCK_CONF_PLL_FACTOR 9
25 #elif F_CPU == 16000000UL
26  #define XMEGA_CLOCK_CONF_PLL_FACTOR 8
27 #elif F_CPU == 14000000UL
28  #define XMEGA_CLOCK_CONF_PLL_FACTOR 7
29 #elif F_CPU == 12000000UL
30  #define XMEGA_CLOCK_CONF_PLL_FACTOR 6
31 #elif F_CPU == 10000000UL
32  #define XMEGA_CLOCK_CONF_PLL_FACTOR 5
33 #elif F_CPU == 8000000UL
34  #define XMEGA_CLOCK_CONF_PLL_FACTOR 4
35 #elif F_CPU == 6000000UL
36  #define XMEGA_CLOCK_CONF_PLL_FACTOR 3
37 #elif F_CPU == 4000000UL
38  #define XMEGA_CLOCK_CONF_PLL_FACTOR 2
39 #elif F_CPU == 2000000UL
40  #define XMEGA_CLOCK_CONF_PLL_FACTOR 1
41 #else
42  #error CPU Frequence Unknown
43 #endif
44 
45 void xmega_clock_output(void);
46 void xmega_clock_init(void);
47 
48 
49 #endif // #ifndef __XMEGA_CLOCK_H__