* CONTROL and SVC protocols for communication between AP and SVC.
*/
#define GB_SVC_BUNDLE_ID 0
-#define GB_SVC_CPORT_ID 2
+#define GB_SVC_CPORT_ID 0
#define GB_CONTROL_BUNDLE_ID 0
-#define GB_CONTROL_CPORT_ID 2
+#define GB_CONTROL_CPORT_ID 0
- /* Control Protocol */
+ /*
+ * All operation messages (both requests and responses) begin with
+ * a header that encodes the size of the message (header included).
+ * This header also contains a unique identifier, that associates a
+ * response message with its operation. The header contains an
+ * operation type field, whose interpretation is dependent on what
+ * type of protocol is used over the connection. The high bit
+ * (0x80) of the operation type field is used to indicate whether
+ * the message is a request (clear) or a response (set).
+ *
+ * Response messages include an additional result byte, which
+ * communicates the result of the corresponding request. A zero
+ * result value means the operation completed successfully. Any
+ * other value indicates an error; in this case, the payload of the
+ * response message (if any) is ignored. The result byte must be
+ * zero in the header for a request message.
+ *
+ * The wire format for all numeric fields in the header is little
+ * endian. Any operation-specific data begins immediately after the
+ * header.
+ */
+ struct gb_operation_msg_hdr {
+ __le16 size; /* Size in bytes of header + payload */
+ __le16 operation_id; /* Operation unique id */
+ __u8 type; /* E.g GB_I2C_TYPE_* or GB_GPIO_TYPE_* */
+ __u8 result; /* Result of request (in responses only) */
+ __u8 pad[2]; /* must be zero (ignore when read) */
+ };
+
+ /* Control Protocol */
/* version request has no payload */
struct gb_protocol_version_response {
__u16 cport1_id;
__u8 intf2_id;
__u16 cport2_id;
- };
+ __u8 tc;
+ __u8 flags;
+ } __packed;
/* connection create response has no payload */
struct gb_svc_conn_destroy_request {
__u16 cport1_id;
__u8 intf2_id;
__u16 cport2_id;
- };
+ } __packed;
/* connection destroy response has no payload */
+struct gb_svc_route_create_request {
+ __u8 intf1_id;
+ __u8 dev1_id;
+ __u8 intf2_id;
+ __u8 dev2_id;
+};
+
/* UART */
/* Version of the Greybus UART protocol we support */