2 * Greybus AP <-> SVC message structure format.
4 * See "Greybus Application Protocol" document (version 0.1) for
5 * details on these values and structures.
7 * Copyright 2014 Google Inc.
8 * Copyright 2014 Linaro Ltd.
10 * Released under the GPLv2 and BSD license.
16 enum svc_function_id {
17 SVC_FUNCTION_HANDSHAKE = 0x00,
18 SVC_FUNCTION_UNIPRO_NETWORK_MANAGEMENT = 0x01,
19 SVC_FUNCTION_HOTPLUG = 0x02,
20 SVC_FUNCTION_POWER = 0x03,
21 SVC_FUNCTION_EPM = 0x04,
22 SVC_FUNCTION_SUSPEND = 0x05,
30 struct svc_msg_header {
31 __u8 function_id; /* enum svc_function_id */
33 __le16 payload_length;
36 enum svc_function_handshake_type {
37 SVC_HANDSHAKE_SVC_HELLO = 0x00,
38 SVC_HANDSHAKE_AP_HELLO = 0x01,
39 SVC_HANDSHAKE_MODULE_HELLO = 0x02,
42 struct svc_function_handshake {
45 __u8 handshake_type; /* enum svc_function_handshake_type */
48 struct svc_function_unipro_set_route {
52 struct svc_function_unipro_link_up {
53 __u8 interface_id; /* Interface id within the Endo */
57 struct svc_function_ap_id {
62 enum svc_function_management_event {
63 SVC_MANAGEMENT_AP_ID = 0x00,
64 SVC_MANAGEMENT_LINK_UP = 0x01,
65 SVC_MANAGEMENT_SET_ROUTE = 0x02,
68 struct svc_function_unipro_management {
69 __u8 management_packet_type; /* enum svc_function_management_event */
71 struct svc_function_ap_id ap_id;
72 struct svc_function_unipro_link_up link_up;
73 struct svc_function_unipro_set_route set_route;
77 enum svc_function_hotplug_event {
78 SVC_HOTPLUG_EVENT = 0x00,
79 SVC_HOTUNPLUG_EVENT = 0x01,
82 struct svc_function_hotplug {
83 __u8 hotplug_event; /* enum svc_function_hotplug_event */
84 __u8 interface_id; /* Interface id within the Endo */
87 enum svc_function_power_type {
88 SVC_POWER_BATTERY_STATUS = 0x00,
89 SVC_POWER_BATTERY_STATUS_REQUEST = 0x01,
92 enum svc_function_battery_status {
93 SVC_BATTERY_UNKNOWN = 0x00,
94 SVC_BATTERY_CHARGING = 0x01,
95 SVC_BATTERY_DISCHARGING = 0x02,
96 SVC_BATTERY_NOT_CHARGING = 0x03,
97 SVC_BATTERY_FULL = 0x04,
100 struct svc_function_power_battery_status {
103 __u8 status; /* enum svc_function_battery_status */
106 struct svc_function_power_battery_status_request {
110 * Each interface carries power, so it's possible these things
111 * are associated with each UniPro device and not just the module.
112 * For now it's safe to assume it's per-module.
114 struct svc_function_power {
115 __u8 power_type; /* enum svc_function_power_type */
118 struct svc_function_power_battery_status status;
119 struct svc_function_power_battery_status_request request;
123 enum svc_function_epm_command_type {
124 SVC_EPM_ENABLE = 0x00,
125 SVC_EPM_DISABLE = 0x01,
128 /* EPM's are associated with the module */
129 struct svc_function_epm {
130 __u8 epm_command_type; /* enum svc_function_epm_command_type */
134 enum svc_function_suspend_command_type {
135 SVC_SUSPEND_FIXME_1 = 0x00, // FIXME
136 SVC_SUSPEND_FIXME_2 = 0x01,
139 /* We'll want independent control for multi-interface modules */
140 struct svc_function_suspend {
141 __u8 suspend_command_type; /* enum function_suspend_command_type */
146 struct svc_msg_header header;
148 struct svc_function_handshake handshake;
149 struct svc_function_unipro_management management;
150 struct svc_function_hotplug hotplug;
151 struct svc_function_power power;
152 struct svc_function_epm epm;
153 struct svc_function_suspend suspend;
157 #endif /* __SVC_MSG_H */