Exemplo n.º 1
0
t_stat ts_wr (int32 data, int32 PA, int32 access)
{
int32 i, t;

switch ((PA >> 1) & 01) {                               /* decode PA<1> */

    case 0:                                             /* TSDB */
        if ((tssr & TSSR_SSR) == 0) {                   /* ready? */
            tssr = tssr | TSSR_RMR;                     /* no, refuse */
            break;
            }
        tsba = ((tsdbx & TSDBX_M_XA) << 18) |           /* form pkt addr */
            ((data & 03) << 16) | (data & 0177774);
        tsdbx = 0;                                      /* clr tsdbx */
        tssr = ts_updtssr (tssr & TSSR_NBA);            /* clr ssr, err */
        msgxs0 = ts_updxs0 (msgxs0 & ~XS0_ALLCLR);      /* clr, upd xs0 */
        msgrfc = msgxs1 = msgxs2 = msgxs3 = msgxs4 = 0; /* clr status */
        CLR_INT (TS);                                   /* clr int req */
        t = Map_ReadW (tsba, CMD_PLNT << 1, cpy_buf);   /* read cmd pkt */
        tsba = tsba + ((CMD_PLNT << 1) - t);            /* incr tsba */
        if (t) {                                        /* nxm? */
            ts_endcmd (TSSR_NXM + TC5, 0, MSG_ACK|MSG_MNEF|MSG_CFAIL);
            return SCPE_OK;
            }
        for (i = 0; i < CMD_PLNT; i++)                  /* copy packet */
            tscmdp[i] = cpy_buf[i];
        ts_ownc = ts_ownm = 1;                          /* tape owns all */
        sim_activate (&ts_unit, ts_time);               /* activate */
        break;

    case 1:                                             /* TSSR */
        if (PA & 1) {                                   /* TSDBX */
            if (UNIBUS)                                 /* not in TS11 */
                return SCPE_OK;
            if (tssr & TSSR_SSR) {                      /* ready? */
                tsdbx = data;                           /* save */
                if (data & TSDBX_BOOT) {
                    ts_bcmd = 1;
                    sim_activate (&ts_unit, ts_time);
                    }
                }
            else tssr = tssr | TSSR_RMR;                /* no, err */
            }
        else if (access == WRITE)                       /* reset */
            ts_reset (&ts_dev);
        break;
        }

return SCPE_OK;
}
Exemplo n.º 2
0
int i3_do_poldek_ts_install(struct poldek_ts *ts)
{
    int i, nerr = 0, n, is_particle;
    struct i3ctx ictx;
    tn_array *pkgs = NULL;
    
    n_assert(ts->type == POLDEK_TS_INSTALL);
    
    if ((n = i3_pre_ts_install(ts, &pkgs)) <= 0) {
        n_assert(pkgs == NULL);
        return n == 0 ? 1 : 0;    /* report success(1) if 'nothing to do' */
    }
    n_assert(pkgs);
    n_assert(n_array_size(pkgs) > 0);

    is_particle = ts->getop(ts, POLDEK_OP_PARTICLE); /* preserve option value */

    if (n_array_size(pkgs) == 1)
        ts->setop(ts, POLDEK_OP_PARTICLE, 0);

    /* tests make sense on whole set only  */
    else if (ts->getop_v(ts, POLDEK_OP_TEST, POLDEK_OP_RPMTEST, 0))
        ts->setop(ts, POLDEK_OP_PARTICLE, 0);
    
    /* so JUSTPRINTs */
    else if (ts->getop_v(ts, POLDEK_OP_JUSTPRINT, POLDEK_OP_JUSTPRINT_N, 0))
        ts->setop(ts, POLDEK_OP_PARTICLE, 0);

    if (poldek__is_in_testing_mode())
        ts->setop(ts, POLDEK_OP_PARTICLE, 1);
    
    i3ctx_init(&ictx, ts);
    
    for (i = 0; i < n_array_size(pkgs); i++) {
        struct pkg *pkg = n_array_nth(pkgs, i);

        if (!pkg_is_marked_i(ts->pms, pkg)) 
            continue;
        
        if (sigint_reached())
            goto l_end;
        
        if (ts->getop(ts, POLDEK_OP_PARTICLE)) {
            if (n > 1) {
                if (poldek_VERBOSE > 0) {
                    poldek_term_printf_c(PRCOLOR_YELLOW,
                                         "Installing set #%d\n", n);
                    fflush(stdout);
                }
                msgn_f(0, "** Installing set #%d\n", n);
            }
            
            n++;
            pkgdb_reopen(ts->db, 0);
        }
        DBGF("mark %s\n", pkg_id(pkg));
        
        i3_mark_package(&ictx, pkg, PKGMARK_MARK);
        
        if (ts->getop(ts, POLDEK_OP_PARTICLE)) {
            i3_mark_namegroup(&ictx, pkg, ts->ctx->ps->pkgs);
            
            if (!do_install(&ictx))
                nerr++;

            ts_reset(ictx.ts);
            i3ctx_reset(&ictx);
        }
    }

    if (!ts->getop(ts, POLDEK_OP_PARTICLE))
        nerr = !do_install(&ictx);

 l_end:
    
    i3ctx_destroy(&ictx);
    MEMINF("END");
    if (is_particle)
        ts->setop(ts, POLDEK_OP_PARTICLE, 1);
    
    return nerr == 0;
}