/[gxemul]/trunk/src/devices/dev_wdc.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/devices/dev_wdc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 22 by dpavlin, Mon Oct 8 16:19:37 2007 UTC revision 24 by dpavlin, Mon Oct 8 16:19:56 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: dev_wdc.c,v 1.63 2006/02/18 13:15:21 debug Exp $   *  $Id: dev_wdc.c,v 1.66 2006/04/20 16:59:05 debug Exp $
29   *   *
30   *  Standard "wdc" IDE controller.   *  Standard "wdc" IDE controller.
31   */   */
# Line 588  DEVICE_ACCESS(wdc) Line 588  DEVICE_ACCESS(wdc)
588                          }                          }
589    
590                          if (d->data_debug) {                          if (d->data_debug) {
591                                  char *s = "0x%04llx ]\n";                                  char *s = "0x%04"PRIx64" ]\n";
592                                  if (len == 1)                                  if (len == 1)
593                                          s = "0x%02llx ]\n";                                          s = "0x%02"PRIx64" ]\n";
594                                  if (len == 4)                                  if (len == 4)
595                                          s = "0x%08llx ]\n";                                          s = "0x%08"PRIx64" ]\n";
596                                  if (len == 8)                                  if (len == 8)
597                                          s = "0x%016llx ]\n";                                          s = "0x%016"PRIx64" ]\n";
598                                  debug("[ wdc: read from DATA: ");                                  debug("[ wdc: read from DATA: ");
599                                  debug(s, (long long)odata);                                  debug(s, (uint64_t) odata);
600                          }                          }
601    
602                          if (d->atapi_cmd_in_progress) {                          if (d->atapi_cmd_in_progress) {
# Line 629  DEVICE_ACCESS(wdc) Line 629  DEVICE_ACCESS(wdc)
629                  } else {                  } else {
630                          int inbuf_len;                          int inbuf_len;
631                          if (d->data_debug) {                          if (d->data_debug) {
632                                  char *s = "0x%04llx ]\n";                                  char *s = "0x%04"PRIx64" ]\n";
633                                  if (len == 1)                                  if (len == 1)
634                                          s = "0x%02llx ]\n";                                          s = "0x%02"PRIx64" ]\n";
635                                  if (len == 4)                                  if (len == 4)
636                                          s = "0x%08llx ]\n";                                          s = "0x%08"PRIx64" ]\n";
637                                  if (len == 8)                                  if (len == 8)
638                                          s = "0x%016llx ]\n";                                          s = "0x%016"PRIx64" ]\n";
639                                  debug("[ wdc: write to DATA: ");                                  debug("[ wdc: write to DATA: ");
640                                  debug(s, (long long)idata);                                  debug(s, (uint64_t) idata);
641                          }                          }
642                          if (!d->write_in_progress &&                          if (!d->write_in_progress &&
643                              !d->atapi_cmd_in_progress) {                              !d->atapi_cmd_in_progress) {
# Line 749  DEVICE_ACCESS(wdc) Line 749  DEVICE_ACCESS(wdc)
749                              inbuf_len % 512 == 0) ) {                              inbuf_len % 512 == 0) ) {
750                                  int count = (d->write_in_progress ==                                  int count = (d->write_in_progress ==
751                                      WDCC_WRITEMULTI)? d->write_count : 1;                                      WDCC_WRITEMULTI)? d->write_count : 1;
752                                  unsigned char buf[512 * count];                                  unsigned char *buf = malloc(512 * count);
753                                  unsigned char *b = buf;                                  unsigned char *b = buf;
754    
755                                    if (buf == NULL) {
756                                            fprintf(stderr, "out of memory\n");
757                                            exit(1);
758                                    }
759    
760                                  if (d->inbuf_tail+512*count <= WDC_INBUF_SIZE) {                                  if (d->inbuf_tail+512*count <= WDC_INBUF_SIZE) {
761                                          b = d->inbuf + d->inbuf_tail;                                          b = d->inbuf + d->inbuf_tail;
762                                          d->inbuf_tail = (d->inbuf_tail + 512                                          d->inbuf_tail = (d->inbuf_tail + 512
# Line 772  DEVICE_ACCESS(wdc) Line 777  DEVICE_ACCESS(wdc)
777    
778                                  if (d->write_count == 0)                                  if (d->write_count == 0)
779                                          d->write_in_progress = 0;                                          d->write_in_progress = 0;
780    
781                                    free(buf);
782                          }                          }
783                  }                  }
784                  break;                  break;
# Line 968  DEVINIT(wdc) Line 975  DEVINIT(wdc)
975                  tick_shift += 1;                  tick_shift += 1;
976    
977          machine_add_tickfunction(devinit->machine, dev_wdc_tick,          machine_add_tickfunction(devinit->machine, dev_wdc_tick,
978              d, tick_shift);              d, tick_shift, 0.0);
979    
980          return 1;          return 1;
981  }  }

Legend:
Removed from v.22  
changed lines
  Added in v.24

  ViewVC Help
Powered by ViewVC 1.1.26