Changeset 375f7fb in buchla-emu
- Timestamp:
- 07/29/2017 10:24:03 PM (7 years ago)
- Branches:
- master
- Children:
- 0726522
- Parents:
- 3c30832
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
emu/ser.c
r3c30832 r375f7fb 37 37 38 38 typedef struct { 39 bool irq; 39 bool irq_r; 40 bool irq_t; 41 bool rdr_ok; 40 42 uint8_t rdr; 41 43 } state_t; … … 44 46 45 47 static state_t state[] = { 46 { .irq = false, .rdr = 0x00 },47 { .irq = false, .rdr = 0x00 }48 { .irq_r = false, .irq_t = false, .rdr_ok = false, .rdr = 0x00 }, 49 { .irq_r = false, .irq_t = false, .rdr_ok = false, .rdr = 0x00 } 48 50 }; 49 51 … … 60 62 static void out(int32_t un, uint8_t c) 61 63 { 62 state[un].irq = true;63 64 state[un].rdr = c; 65 state[un].rdr_ok = true; 66 state[un].irq_r = true; 64 67 } 65 68 … … 271 274 { 272 275 ver3("ser exec"); 273 return state[0].irq || state[1].irq;276 return state[0].irq_r || state[0].irq_t || state[1].irq_r || state[1].irq_t; 274 277 } 275 278 … … 289 292 switch (rg) { 290 293 case REG_IER_ISR: 291 rv = (uint32_t)(0xc0 | (state[un].irq ? 0x01 : 0x00)); 294 rv = (uint32_t)(0xc0 | (state[un].rdr_ok ? 0x01 : 0x00)); 295 state[un].irq_r = false; 296 state[un].irq_t = false; 292 297 ver2("ISR[%d] 0x%02x", un, rv); 293 298 break; … … 295 300 case REG_TDR_RDR: 296 301 rv = state[un].rdr; 297 state[un]. irq= false;302 state[un].rdr_ok = false; 298 303 ver2("RDR[%d] 0x%02x", un, rv); 299 304 break; … … 322 327 ver2("TDR[%d] 0x%02x", un, val); 323 328 echo((uint8_t)val); 329 state[un].irq_t = true; 324 330 break; 325 331
Note:
See TracChangeset
for help on using the changeset viewer.