/* The default amount of time a request is given to complete */ #define GB_OPERATION_TIMEOUT_DEFAULT 1000 /* milliseconds */
/* * The top bit of the type in an operation message header indicates * whether the message is a request (bit clear) or response (bit set)
*/ #define GB_MESSAGE_TYPE_RESPONSE ((u8)0x80)
/* * Protocol code should only examine the payload and payload_size fields, and * host-controller drivers may use the hcpriv field. All other fields are * intended to be private to the operations core code.
*/ struct gb_message { struct gb_operation *operation; struct gb_operation_msg_hdr *header;
/* * A Greybus operation is a remote procedure call performed over a * connection between two UniPro interfaces. * * Every operation consists of a request message sent to the other * end of the connection coupled with a reply message returned to * the sender. Every operation has a type, whose interpretation is * dependent on the protocol associated with the connection. * * Only four things in an operation structure are intended to be * directly usable by protocol handlers: the operation's connection * pointer; the operation type; the request message payload (and * size); and the response message payload (and size). Note that a * message with a 0-byte payload has a null message payload pointer. * * In addition, every operation has a result, which is an errno * value. Protocol handlers access the operation result using * gb_operation_result().
*/ typedefvoid (*gb_operation_callback)(struct gb_operation *); struct gb_operation { struct gb_connection *connection; struct gb_message *request; struct gb_message *response;
unsignedlong flags;
u8 type;
u16 id; int errno; /* Operation result */
void gb_operation_cancel(struct gb_operation *operation, int errno); void gb_operation_cancel_incoming(struct gb_operation *operation, int errno);
void greybus_message_sent(struct gb_host_device *hd, struct gb_message *message, int status);
int gb_operation_sync_timeout(struct gb_connection *connection, int type, void *request, int request_size, void *response, int response_size, unsignedint timeout); int gb_operation_unidirectional_timeout(struct gb_connection *connection, int type, void *request, int request_size, unsignedint timeout);
staticinlineint gb_operation_sync(struct gb_connection *connection, int type, void *request, int request_size, void *response, int response_size)
{ return gb_operation_sync_timeout(connection, type,
request, request_size, response, response_size,
GB_OPERATION_TIMEOUT_DEFAULT);
}
staticinlineint gb_operation_unidirectional(struct gb_connection *connection, int type, void *request, int request_size)
{ return gb_operation_unidirectional_timeout(connection, type,
request, request_size, GB_OPERATION_TIMEOUT_DEFAULT);
}
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.