if (err < 0) { if (err == -EAGAIN &&
bus_reset_handling == SUCCEED_ON_BUS_RESET)
err = 0; return err;
}
if (buffer[0] == old_arg) /* success? */ break;
if (check) {
err = check(c, buffer[0]); if (err < 0) return err;
}
}
c->last_pcr_value = buffer[1];
return 0;
}
/** * cmp_connection_init - initializes a connection manager * @c: the connection manager to initialize * @unit: a unit of the target device * @direction: input or output * @pcr_index: the index of the iPCR/oPCR on the target device
*/ int cmp_connection_init(struct cmp_connection *c, struct fw_unit *unit, enum cmp_direction direction, unsignedint pcr_index)
{
__be32 mpr_be;
u32 mpr; int err;
/** * cmp_connection_check_used - check connection is already esablished or not * @c: the connection manager to be checked * @used: the pointer to store the result of checking the connection
*/ int cmp_connection_check_used(struct cmp_connection *c, bool *used)
{
__be32 pcr; int err;
staticint get_overhead_id(struct cmp_connection *c)
{ int id;
/* * apply "oPCR overhead ID encoding" * the encoding table can convert up to 512. * here the value over 512 is converted as the same way as 512.
*/ for (id = 1; id < 16; id++) { if (c->resources.bandwidth_overhead < (id << 5)) break;
} if (id == 16)
id = 0;
staticint pcr_set_check(struct cmp_connection *c, __be32 pcr)
{ if (pcr & cpu_to_be32(PCR_BCAST_CONN |
PCR_P2P_CONN_MASK)) {
cmp_error(c, "plug is already in use\n"); return -EBUSY;
} if (!(pcr & cpu_to_be32(PCR_ONLINE))) {
cmp_error(c, "plug is not on-line\n"); return -ECONNREFUSED;
}
return 0;
}
/** * cmp_connection_establish - establish a connection to the target * @c: the connection manager * * This function establishes a point-to-point connection from the local * computer to the target by allocating isochronous resources (channel and * bandwidth) and setting the target's input/output plug control register. * When this function succeeds, the caller is responsible for starting * transmitting packets.
*/ int cmp_connection_establish(struct cmp_connection *c)
{ int err;
mutex_lock(&c->mutex);
if (WARN_ON(c->connected)) {
mutex_unlock(&c->mutex); return -EISCONN;
}
/** * cmp_connection_break - break the connection to the target * @c: the connection manager * * This function deactives the connection in the target's input/output plug * control register, and frees the isochronous resources of the connection. * Before calling this function, the caller should cease transmitting packets.
*/ void cmp_connection_break(struct cmp_connection *c)
{ int err;
mutex_lock(&c->mutex);
if (!c->connected) {
mutex_unlock(&c->mutex); return;
}
err = pcr_modify(c, pcr_break_modify, NULL, SUCCEED_ON_BUS_RESET); if (err < 0)
cmp_error(c, "plug is still connected\n");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.