void urj_tap_chain_free (urj_chain_t *chain) { if (!chain) return; urj_tap_chain_disconnect (chain); urj_part_parts_free (chain->parts); free (chain); }
static int urj_tap_cable_start (urj_chain_t *chain, urj_cable_t *cable) { chain->cable = cable; if (urj_tap_cable_init (chain->cable) != URJ_STATUS_OK) { urj_tap_chain_disconnect (chain); return URJ_STATUS_FAIL; } urj_tap_trst_reset (chain); return URJ_STATUS_OK; }
static urj_cable_t * urj_tap_cable_create (urj_chain_t *chain, const urj_cable_driver_t *driver) { urj_cable_t *cable; if (urj_bus) urj_bus_buses_delete (urj_bus); urj_tap_chain_disconnect (chain); cable = calloc (1, sizeof (urj_cable_t)); if (!cable) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", (size_t) 1, sizeof (urj_cable_t)); return NULL; } cable->driver = driver; return cable; }
static void ts7800_disconnect (urj_cable_t *cable) { ts7800_gpio_close (cable); urj_tap_chain_disconnect (cable->chain); }