| 223 | } |
| 224 | |
| 225 | static void cmos_write(void *opaque, uint32_t offset, |
| 226 | uint32_t data, int size_log2) |
| 227 | { |
| 228 | CMOSState *s = opaque; |
| 229 | |
| 230 | if (offset == 0) { |
| 231 | s->cmos_index = data & 0x7f; |
| 232 | } else { |
| 233 | #ifdef DEBUG_CMOS |
| 234 | printf("cmos_write: reg=0x%02x val=0x%02x\n", s->cmos_index, data); |
| 235 | #endif |
| 236 | switch(s->cmos_index) { |
| 237 | case RTC_REG_A: |
| 238 | s->cmos_data[RTC_REG_A] = (data & ~REG_A_UIP) | |
| 239 | (s->cmos_data[RTC_REG_A] & REG_A_UIP); |
| 240 | cmos_update_timer(s); |
| 241 | break; |
| 242 | case RTC_REG_B: |
| 243 | s->cmos_data[s->cmos_index] = data; |
| 244 | cmos_update_timer(s); |
| 245 | break; |
| 246 | default: |
| 247 | s->cmos_data[s->cmos_index] = data; |
| 248 | break; |
| 249 | } |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | static uint32_t cmos_read(void *opaque, uint32_t offset, int size_log2) |
| 254 | { |
nothing calls this directly
no test coverage detected