/[gxemul]/trunk/src/devices/dev_asc.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_asc.c

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

revision 41 by dpavlin, Mon Oct 8 16:21:17 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: dev_asc.c,v 1.84 2006/12/31 21:35:26 debug Exp $   *  $Id: dev_asc.c,v 1.86 2007/06/15 18:44:19 debug Exp $
29   *   *
30   *  'asc' SCSI controller for some DECstation/DECsystem models and PICA-61.   *  COMMENT: NCR53C9X "ASC" SCSI controller
31     *
32     *  This is the SCSI controller used in some DECstation/DECsystem models and
33     *  the PICA-61 machine.
34   *   *
35   *  Supposed to support SCSI-1 and SCSI-2. I've not yet found any docs   *  Supposed to support SCSI-1 and SCSI-2. I've not yet found any docs
36   *  on NCR53C9X, so I'll try to implement this device from LSI53CF92A docs   *  on NCR53C9X, so I'll try to implement this device from LSI53CF92A docs
# Line 372  if (d->dma_controller != NULL) Line 375  if (d->dma_controller != NULL)
375                                              (int)len, (int)len2);  */                                              (int)len, (int)len2);  */
376    
377                                          d->xferp->data_in_len -= len2;                                          d->xferp->data_in_len -= len2;
378                                          n = malloc(d->xferp->data_in_len);                                          CHECK_ALLOCATION(n =
379                                          if (n == NULL) {                                              malloc(d->xferp->data_in_len));
                                                 fprintf(stderr, "out of memory"  
                                                     " in dev_asc\n");  
                                                 exit(1);  
                                         }  
380                                          memcpy(n, d->xferp->data_in + len2,                                          memcpy(n, d->xferp->data_in + len2,
381                                              d->xferp->data_in_len);                                              d->xferp->data_in_len);
382                                          free(d->xferp->data_in);                                          free(d->xferp->data_in);
# Line 507  fatal("TODO.......asdgasin\n"); Line 506  fatal("TODO.......asdgasin\n");
506                          }                          }
507    
508                          newlen = oldlen + d->n_bytes_in_fifo;                          newlen = oldlen + d->n_bytes_in_fifo;
509                          d->xferp->msg_out = realloc(d->xferp->msg_out, newlen);                          CHECK_ALLOCATION(d->xferp->msg_out =
510                                realloc(d->xferp->msg_out, newlen));
511                          d->xferp->msg_out_len = newlen;                          d->xferp->msg_out_len = newlen;
                         if (d->xferp->msg_out == NULL) {  
                                 fprintf(stderr, "out of memory realloc'ing "  
                                     "msg_out\n");  
                                 exit(1);  
                         }  
512    
513                          i = oldlen;                          i = oldlen;
514                          while (d->fifo_in != d->fifo_out) {                          while (d->fifo_in != d->fifo_out) {
# Line 1237  void dev_asc_init(struct machine *machin Line 1232  void dev_asc_init(struct machine *machin
1232  {  {
1233          struct asc_data *d;          struct asc_data *d;
1234    
1235          d = malloc(sizeof(struct asc_data));          CHECK_ALLOCATION(d = malloc(sizeof(struct asc_data)));
         if (d == NULL) {  
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
1236          memset(d, 0, sizeof(struct asc_data));          memset(d, 0, sizeof(struct asc_data));
1237    
1238          INTERRUPT_CONNECT(irq_path, d->irq);          INTERRUPT_CONNECT(irq_path, d->irq);
# Line 1250  void dev_asc_init(struct machine *machin Line 1241  void dev_asc_init(struct machine *machin
1241    
1242          d->reg_ro[NCR_CFG3] = NCRF9XCFG3_CDB;          d->reg_ro[NCR_CFG3] = NCRF9XCFG3_CDB;
1243    
1244          d->dma_address_reg_memory = malloc(machine->arch_pagesize);          CHECK_ALLOCATION(d->dma_address_reg_memory =
1245          d->dma = malloc(ASC_DMA_SIZE);              malloc(machine->arch_pagesize));
         if (d->dma == NULL || d->dma_address_reg_memory == NULL) {  
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
1246          memset(d->dma_address_reg_memory, 0, machine->arch_pagesize);          memset(d->dma_address_reg_memory, 0, machine->arch_pagesize);
1247    
1248            CHECK_ALLOCATION(d->dma = malloc(ASC_DMA_SIZE));
1249          memset(d->dma, 0, ASC_DMA_SIZE);          memset(d->dma, 0, ASC_DMA_SIZE);
1250    
1251          d->dma_controller      = dma_controller;          d->dma_controller      = dma_controller;
# Line 1276  void dev_asc_init(struct machine *machin Line 1265  void dev_asc_init(struct machine *machin
1265                      DM_DYNTRANS_OK | DM_DYNTRANS_WRITE_OK, d->dma);                      DM_DYNTRANS_OK | DM_DYNTRANS_WRITE_OK, d->dma);
1266          }          }
1267    
1268          machine_add_tickfunction(machine, dev_asc_tick, d, ASC_TICK_SHIFT, 0.0);          machine_add_tickfunction(machine, dev_asc_tick, d, ASC_TICK_SHIFT);
1269  }  }
1270    

Legend:
Removed from v.41  
changed lines
  Added in v.42

  ViewVC Help
Powered by ViewVC 1.1.26