Beispiel #1
0
static void
triton_clock (urj_cable_t *cable, int tms, int tdi, int n)
{
    int i;
    int trst = (PARAM_SIGNALS (cable) & URJ_POD_CS_TRST) ? 1 : 0;
    int sreset = (PARAM_SIGNALS (cable) & URJ_POD_CS_RESET) ? 1 : 0;

    tms = tms ? 1 : 0;
    tdi = tdi ? 1 : 0;

    for (i = 0; i < n; i++)
    {
        urj_tap_parport_set_data (cable->link.port,
                                  (trst << TRST) | (sreset << SRESET)
                                  | (0 << TCK) | (tms << TMS) | (tdi << TDI));
        urj_tap_cable_wait (cable);
        urj_tap_parport_set_data (cable->link.port,
                                  (trst << TRST) | (sreset << SRESET)
                                  | (1 << TCK) | (tms << TMS) | (tdi << TDI));
        urj_tap_cable_wait (cable);
    }

    PARAM_SIGNALS (cable) &= (URJ_POD_CS_TRST | URJ_POD_CS_RESET);
    PARAM_SIGNALS (cable) |= URJ_POD_CS_TCK;
    PARAM_SIGNALS (cable) |= tms ? URJ_POD_CS_TMS : 0;
    PARAM_SIGNALS (cable) |= tdi ? URJ_POD_CS_TDI : 0;
}
Beispiel #2
0
static int
ts7800_gpio_write (urj_cable_t *cable, uint8_t data)
{
    ts7800_params_t *p = cable->params;

    p->gpio_base[GPIO_OUT] = p->lastout = (p->lastout & GPIO_BITMASK) | data;
    urj_tap_cable_wait (cable);

    return 0;
}
Beispiel #3
0
static void
wiggler_clock (urj_cable_t *cable, int tms, int tdi, int n)
{
    int i;

    tms = tms ? 1 : 0;
    tdi = tdi ? 1 : 0;

    for (i = 0; i < n; i++)
    {
        urj_tap_parport_set_data (cable->link.port,
                                  PRM_TRST_LVL (cable)
                                  | PRM_TCK_INACT (cable)
                                  | (tms ? PRM_TMS_ACT (cable)
                                         : PRM_TMS_INACT (cable))
                                  | (tdi ? PRM_TDI_ACT (cable)
                                         : PRM_TDI_INACT (cable))
                                  | PRM_UNUSED_BITS (cable));
        urj_tap_cable_wait (cable);
        urj_tap_parport_set_data (cable->link.port,
                                  PRM_TRST_LVL (cable)
                                  | PRM_TCK_ACT (cable)
                                  | (tms ? PRM_TMS_ACT (cable)
                                         : PRM_TMS_INACT (cable))
                                  | (tdi ? PRM_TDI_ACT (cable)
                                         : PRM_TDI_INACT (cable))
                                  | PRM_UNUSED_BITS (cable));
        urj_tap_cable_wait (cable);
    }

    PRM_SIGNALS (cable) &= ~(URJ_POD_CS_TDI | URJ_POD_CS_TMS);
    if (tms)
        PRM_SIGNALS (cable) |= URJ_POD_CS_TMS;
    if (tdi)
        PRM_SIGNALS (cable) |= URJ_POD_CS_TDI;
}
Beispiel #4
0
static int
wiggler_get_tdo (urj_cable_t *cable)
{
    int status;

    urj_tap_parport_set_data (cable->link.port, PRM_TRST_LVL (cable) |
                              PRM_TCK_INACT (cable) |
                              PRM_UNUSED_BITS (cable));
    urj_tap_cable_wait (cable);

    status = urj_tap_parport_get_status (cable->link.port);
    if (status == -1)
        return -1;

    return (status & (PRM_TDO_ACT (cable) | PRM_TDO_INACT (cable)))
             ^ PRM_TDO_ACT (cable) ? 0 : 1;
}
Beispiel #5
0
static int
triton_get_tdo (urj_cable_t *cable)
{
    int trst = (PARAM_SIGNALS (cable) & URJ_POD_CS_TRST) ? 1 : 0;
    int sreset = (PARAM_SIGNALS (cable) & URJ_POD_CS_RESET) ? 1 : 0;
    int status;

    urj_tap_parport_set_data (cable->link.port,
                              (trst << TRST) | (sreset << SRESET) | (0 << TCK));
    PARAM_SIGNALS (cable) &=
        ~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);

    urj_tap_cable_wait (cable);

    status = urj_tap_parport_get_status (cable->link.port);
    if (status == -1)
        return status;

    return (status >> TDO) & 1;
}