]> git.pld-linux.org Git - packages/crossavr-libc.git/blame - 501-avr-libc-bug12584.patch
- rel 4
[packages/crossavr-libc.git] / 501-avr-libc-bug12584.patch
CommitLineData
9fe267c2 1diff -Naurp include/avr/power.h include/avr/power.h
69ed15f0
JR
2--- include/avr/power.h 2013-03-15 12:19:39.000000000 +0530
3+++ include/avr/power.h 2013-03-15 12:20:10.000000000 +0530
4@@ -2976,12 +2976,16 @@ do{ \
9fe267c2
PZ
5 || defined(__AVR_ATmega165P__) \
6 || defined(__AVR_ATmega165PA__) \
7 || defined(__AVR_ATmega168__) \
8+|| defined(__AVR_ATmega168A__) \
9 || defined(__AVR_ATmega168P__) \
10 || defined(__AVR_ATmega168PA__) \
11 || defined(__AVR_ATmega169__) \
12 || defined(__AVR_ATmega169A__) \
13 || defined(__AVR_ATmega169P__) \
14 || defined(__AVR_ATmega169PA__) \
15+|| defined(__AVR_ATmega16M1__) \
16+|| defined(__AVR_ATmega16U2__) \
17+|| defined(__AVR_ATmega324PA__) \
18 || defined(__AVR_ATmega16U4__) \
19 || defined(__AVR_ATmega2560__) \
20 || defined(__AVR_ATmega2561__) \
69ed15f0 21@@ -3003,6 +3007,7 @@ do{ \
9fe267c2
PZ
22 || defined(__AVR_ATmega329PA__) \
23 || defined(__AVR_ATmega3290__) \
24 || defined(__AVR_ATmega3290A__) \
25+|| defined(__AVR_ATmega3290P__) \
26 || defined(__AVR_ATmega3290PA__) \
27 || defined(__AVR_ATmega32C1__) \
28 || defined(__AVR_ATmega32M1__) \
69ed15f0 29@@ -3027,6 +3032,10 @@ do{ \
9fe267c2
PZ
30 || defined(__AVR_ATmega6450P__) \
31 || defined(__AVR_ATmega649__) \
32 || defined(__AVR_ATmega649A__) \
33+|| defined(__AVR_ATmega64M1__) \
34+|| defined(__AVR_ATmega64C1__) \
35+|| defined(__AVR_ATmega88A__) \
36+|| defined(__AVR_ATmega88PA__) \
37 || defined(__AVR_ATmega6490__) \
38 || defined(__AVR_ATmega6490A__) \
39 || defined(__AVR_ATmega6490P__) \
69ed15f0 40@@ -3038,6 +3047,8 @@ do{ \
9fe267c2
PZ
41 || defined(__AVR_ATmega16U2__) \
42 || defined(__AVR_ATmega32U2__) \
43 || defined(__AVR_ATtiny48__) \
44+|| defined(__AVR_ATtiny88__) \
45+|| defined(__AVR_ATtiny87__) \
46 || defined(__AVR_ATtiny167__) \
47 || defined(__DOXYGEN__)
48
69ed15f0 49@@ -3384,10 +3395,47 @@ void clock_prescale_set(clock_div_t __x)
9fe267c2
PZ
50
51 #define clock_prescale_get() (clock_div_t)(CLKPR & (uint8_t)((1<<CLKPS0)|(1<<CLKPS1)|(1<<CLKPS2)|(1<<CLKPS3)))
52
53+#elif defined(__AVR_ATtiny4__) \
54+|| defined(__AVR_ATtiny5__) \
55+|| defined(__AVR_ATtiny9__) \
56+|| defined(__AVR_ATtiny10__) \
57+|| defined(__AVR_ATtiny20__) \
58+|| defined(__AVR_ATtiny40__) \
59+
60+typedef enum
61+{
62+ clock_div_1 = 0,
63+ clock_div_2 = 1,
64+ clock_div_4 = 2,
65+ clock_div_8 = 3,
66+ clock_div_16 = 4,
67+ clock_div_32 = 5,
68+ clock_div_64 = 6,
69+ clock_div_128 = 7,
70+ clock_div_256 = 8
71+} clock_div_t;
72
73-#endif
74+static __inline__ void clock_prescale_set(clock_div_t) __attribute__((__always_inline__));
75
76+void clock_prescale_set(clock_div_t __x)
77+{
78+ uint8_t __tmp = 0xD8;
79+ __asm__ __volatile__ (
80+ "in __tmp_reg__,__SREG__" "\n\t"
81+ "cli" "\n\t"
82+ "out %1, %0" "\n\t"
83+ "out %2, %3" "\n\t"
84+ "out __SREG__, __tmp_reg__"
85+ : /* no outputs */
86+ : "d" (__tmp),
87+ "I" (_SFR_IO_ADDR(CCP)),
88+ "I" (_SFR_IO_ADDR(CLKPSR)),
89+ "d" (__x)
90+ : "r16");
91+}
92
93+#define clock_prescale_get() (clock_div_t)(CLKPSR & (uint8_t)((1<<CLKPS0)|(1<<CLKPS1)|(1<<CLKPS2)|(1<<CLKPS3)))
94
95+#endif
96
97 #endif /* _AVR_POWER_H_ */
This page took 0.118304 seconds and 4 git commands to generate.