static void do_busid_cmd(ESPState *s, uint8_t *buf, uint8_t busid)

{

    int32_t datalen;

    int lun;



    DPRINTF("do_busid_cmd: busid 0x%x\n", busid);

    lun = busid & 7;

    s->current_req = scsi_req_new(s->current_dev, 0, lun, NULL);

    datalen = scsi_req_enqueue(s->current_req, buf);

    s->ti_size = datalen;

    if (datalen != 0) {

        s->rregs[ESP_RSTAT] = STAT_TC;

        s->dma_left = 0;

        s->dma_counter = 0;

        if (datalen > 0) {

            s->rregs[ESP_RSTAT] |= STAT_DI;

        } else {

            s->rregs[ESP_RSTAT] |= STAT_DO;

        }

        scsi_req_continue(s->current_req);

    }

    s->rregs[ESP_RINTR] = INTR_BS | INTR_FC;

    s->rregs[ESP_RSEQ] = SEQ_CD;

    esp_raise_irq(s);

}

static void do_busid_cmd(ESPState *s, uint8_t *buf, uint8_t busid)

{

    int32_t datalen;

    int lun;



    DPRINTF("do_busid_cmd: busid 0x%x\n", busid);

    lun = busid & 7;

    s->current_req = scsi_req_new(s->current_dev, 0, lun, NULL);

    datalen = scsi_req_enqueue(s->current_req, buf);

    s->ti_size = datalen;

    if (datalen != 0) {

        s->rregs[ESP_RSTAT] = STAT_TC;

        s->dma_left = 0;

        s->dma_counter = 0;

        if (datalen > 0) {

            s->rregs[ESP_RSTAT] |= STAT_DI;

        } else {

            s->rregs[ESP_RSTAT] |= STAT_DO;

        }

        scsi_req_continue(s->current_req);

    }

    s->rregs[ESP_RINTR] = INTR_BS | INTR_FC;

    s->rregs[ESP_RSEQ] = SEQ_CD;

    esp_raise_irq(s);

}

static void FUNC_0(ESPState *VAR_0, uint8_t *VAR_1, uint8_t VAR_2)

{

    int32_t datalen;

    int VAR_3;



    DPRINTF("FUNC_0: VAR_2 0x%x\n", VAR_2);

    VAR_3 = VAR_2 & 7;

    VAR_0->current_req = scsi_req_new(VAR_0->current_dev, 0, VAR_3, NULL);

    datalen = scsi_req_enqueue(VAR_0->current_req, VAR_1);

    VAR_0->ti_size = datalen;

    if (datalen != 0) {

        VAR_0->rregs[ESP_RSTAT] = STAT_TC;

        VAR_0->dma_left = 0;

        VAR_0->dma_counter = 0;

        if (datalen > 0) {

            VAR_0->rregs[ESP_RSTAT] |= STAT_DI;

        } else {

            VAR_0->rregs[ESP_RSTAT] |= STAT_DO;

        }

        scsi_req_continue(VAR_0->current_req);

    }

    VAR_0->rregs[ESP_RINTR] = INTR_BS | INTR_FC;

    VAR_0->rregs[ESP_RSEQ] = SEQ_CD;

    esp_raise_irq(VAR_0);

}

static void FUNC_0(ESPState *VAR_0, uint8_t *VAR_1, uint8_t VAR_2)
{ int32_t datalen; int VAR_3; DPRINTF("FUNC_0: VAR_2 0x%x\n", VAR_2); VAR_3 = VAR_2 & 7; VAR_0->current_req = scsi_req_new(VAR_0->current_dev, 0, VAR_3, NULL); datalen = scsi_req_enqueue(VAR_0->current_req, VAR_1); VAR_0->ti_size = datalen; if (datalen != 0) { VAR_0->rregs[ESP_RSTAT] = STAT_TC; VAR_0->dma_left = 0; VAR_0->dma_counter = 0; if (datalen > 0) { VAR_0->rregs[ESP_RSTAT] |= STAT_DI; } else { VAR_0->rregs[ESP_RSTAT] |= STAT_DO; } scsi_req_continue(VAR_0->current_req); } VAR_0->rregs[ESP_RINTR] = INTR_BS | INTR_FC; VAR_0->rregs[ESP_RSEQ] = SEQ_CD; esp_raise_irq(VAR_0); }