Mercurial > repos > blastem
comparison romdb.c @ 781:51c3e571eeb1
Remove debug printf from EEPROM code
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 20 Jul 2015 23:18:29 -0700 |
parents | fa2c03fcbb88 |
children | 724bbec47f86 |
comparison
equal
deleted
inserted
replaced
780:fa2c03fcbb88 | 781:51c3e571eeb1 |
---|---|
126 state->counter = 8; | 126 state->counter = 8; |
127 break; | 127 break; |
128 case I2C_ADDRESS_ACK: | 128 case I2C_ADDRESS_ACK: |
129 state->state = I2C_WRITE; | 129 state->state = I2C_WRITE; |
130 state->address &= state->size-1; | 130 state->address &= state->size-1; |
131 printf("EEPROM address is %X\n", state->address); | |
132 state->counter = 8; | 131 state->counter = 8; |
133 break; | 132 break; |
134 case I2C_READ: | 133 case I2C_READ: |
135 state->counter--; | 134 state->counter--; |
136 if (!state->counter) { | 135 if (!state->counter) { |
319 eeprom_map *map = find_eeprom_map(address, gen); | 318 eeprom_map *map = find_eeprom_map(address, gen); |
320 if (!map) { | 319 if (!map) { |
321 fprintf(stderr, "Could not find EEPROM map for address %X\n", address); | 320 fprintf(stderr, "Could not find EEPROM map for address %X\n", address); |
322 exit(1); | 321 exit(1); |
323 } | 322 } |
324 printf("EEPROM word write: %X - %X\n", address, value); | |
325 if (map->scl_mask) { | 323 if (map->scl_mask) { |
326 set_scl(&gen->eeprom, (value & map->scl_mask) != 0); | 324 set_scl(&gen->eeprom, (value & map->scl_mask) != 0); |
327 printf("scl: %d, state: %s, counter: %d, latch: %X\n", (value & map->scl_mask) != 0, i2c_states[gen->eeprom.state], gen->eeprom.counter, gen->eeprom.latch); | |
328 } | 325 } |
329 if (map->sda_write_mask) { | 326 if (map->sda_write_mask) { |
330 printf("sda: %d\n", (value & map->sda_write_mask) != 0); | |
331 set_host_sda(&gen->eeprom, (value & map->sda_write_mask) != 0); | 327 set_host_sda(&gen->eeprom, (value & map->sda_write_mask) != 0); |
332 } | 328 } |
333 return context; | 329 return context; |
334 } | 330 } |
335 | 331 |
348 mask = 0xFF; | 344 mask = 0xFF; |
349 } else { | 345 } else { |
350 expanded = value << 8; | 346 expanded = value << 8; |
351 mask = 0xFF00; | 347 mask = 0xFF00; |
352 } | 348 } |
353 printf("EEPROM byte write: %X - %X (using mask %X and expanded val %X)\n", address, value, mask, expanded); | |
354 if (map->scl_mask & mask) { | 349 if (map->scl_mask & mask) { |
355 set_scl(&gen->eeprom, (expanded & map->scl_mask) != 0); | 350 set_scl(&gen->eeprom, (expanded & map->scl_mask) != 0); |
356 printf("scl: %d, state: %s, counter: %d, latch: %X\n", (expanded & map->scl_mask) != 0, i2c_states[gen->eeprom.state], gen->eeprom.counter, gen->eeprom.latch); | |
357 } | 351 } |
358 if (map->sda_write_mask & mask) { | 352 if (map->sda_write_mask & mask) { |
359 printf("sda: %d\n", (expanded & map->sda_write_mask) != 0); | |
360 set_host_sda(&gen->eeprom, (expanded & map->sda_write_mask) != 0); | 353 set_host_sda(&gen->eeprom, (expanded & map->sda_write_mask) != 0); |
361 } | 354 } |
362 return context; | 355 return context; |
363 } | 356 } |
364 | 357 |
372 } | 365 } |
373 uint16_t ret = 0; | 366 uint16_t ret = 0; |
374 if (map->sda_read_bit < 16) { | 367 if (map->sda_read_bit < 16) { |
375 ret = get_sda(&gen->eeprom) << map->sda_read_bit; | 368 ret = get_sda(&gen->eeprom) << map->sda_read_bit; |
376 } | 369 } |
377 printf("EEPROM word read: %X - %X\n", address, ret); | |
378 return ret; | 370 return ret; |
379 } | 371 } |
380 | 372 |
381 uint8_t read_eeprom_i2c_b(uint32_t address, void * context) | 373 uint8_t read_eeprom_i2c_b(uint32_t address, void * context) |
382 { | 374 { |
389 uint8_t bit = address & 1 ? map->sda_read_bit : map->sda_read_bit - 8; | 381 uint8_t bit = address & 1 ? map->sda_read_bit : map->sda_read_bit - 8; |
390 uint8_t ret = 0; | 382 uint8_t ret = 0; |
391 if (bit < 8) { | 383 if (bit < 8) { |
392 ret = get_sda(&gen->eeprom) << bit; | 384 ret = get_sda(&gen->eeprom) << bit; |
393 } | 385 } |
394 printf("EEPROM byte read: %X - %X\n", address, ret); | |
395 return ret; | 386 return ret; |
396 } | 387 } |
397 | 388 |
398 tern_node *load_rom_db() | 389 tern_node *load_rom_db() |
399 { | 390 { |