Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 1 | /* |
Alex Elder | 908a85d | 2014-09-24 05:16:16 -0500 | [diff] [blame] | 2 | * Greybus module manifest definition |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 3 | * |
Alex Elder | cb705e0 | 2014-09-24 05:16:17 -0500 | [diff] [blame] | 4 | * See "Greybus Application Protocol" document (version 0.1) for |
Alex Elder | 908a85d | 2014-09-24 05:16:16 -0500 | [diff] [blame] | 5 | * details on these values and structures. |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 6 | * |
| 7 | * Copyright 2014 Google Inc. |
Alex Elder | 908a85d | 2014-09-24 05:16:16 -0500 | [diff] [blame] | 8 | * |
| 9 | * Released under the GPLv2 only. |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
Alex Elder | 1dd7f58 | 2014-09-26 20:55:32 -0500 | [diff] [blame^] | 12 | #ifndef __GREYBUS_MANIFEST_H |
| 13 | #define __GREYBUS_MANIFEST_H |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 14 | |
Greg Kroah-Hartman | 48123e0 | 2014-09-02 10:51:56 -0700 | [diff] [blame] | 15 | #pragma pack(push, 1) |
| 16 | |
Alex Elder | 05ad189 | 2014-09-09 13:55:03 -0500 | [diff] [blame] | 17 | struct greybus_manifest_header { |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 18 | __le16 size; |
Greg Kroah-Hartman | 3772f16 | 2014-09-01 09:51:33 -0700 | [diff] [blame] | 19 | __u8 version_major; |
| 20 | __u8 version_minor; |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 21 | }; |
| 22 | |
| 23 | enum greybus_descriptor_type { |
| 24 | GREYBUS_TYPE_INVALID = 0x0000, |
Matt Porter | c41a366 | 2014-09-26 20:49:52 -0500 | [diff] [blame] | 25 | GREYBUS_TYPE_MODULE = 0x0001, |
| 26 | GREYBUS_TYPE_FUNCTION = 0x0002, |
| 27 | GREYBUS_TYPE_CLASS = 0x0003, |
Greg Kroah-Hartman | 526c5c8 | 2014-09-01 16:03:31 -0700 | [diff] [blame] | 28 | GREYBUS_TYPE_STRING = 0x0004, |
Greg Kroah-Hartman | d587780 | 2014-09-01 10:59:08 -0700 | [diff] [blame] | 29 | GREYBUS_TYPE_CPORT = 0x0005, |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 30 | }; |
| 31 | |
| 32 | struct greybus_descriptor_header { |
| 33 | __le16 size; |
| 34 | __le16 type; /* enum greybus_descriptor_type */ |
| 35 | }; |
| 36 | |
Matt Porter | 097724c | 2014-09-26 20:49:50 -0500 | [diff] [blame] | 37 | enum greybus_function_type { |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 38 | GREYBUS_FUNCTION_CONTROL = 0x00, |
| 39 | GREYBUS_FUNCTION_USB = 0x01, |
| 40 | GREYBUS_FUNCTION_GPIO = 0x02, |
| 41 | GREYBUS_FUNCTION_SPI = 0x03, |
| 42 | GREYBUS_FUNCTION_UART = 0x04, |
| 43 | GREYBUS_FUNCTION_PWM = 0x05, |
| 44 | GREYBUS_FUNCTION_I2S = 0x06, |
| 45 | GREYBUS_FUNCTION_I2C = 0x07, |
| 46 | GREYBUS_FUNCTION_SDIO = 0x08, |
| 47 | GREYBUS_FUNCTION_HID = 0x09, |
| 48 | GREYBUS_FUNCTION_DISPLAY = 0x0a, |
| 49 | GREYBUS_FUNCTION_CAMERA = 0x0b, |
| 50 | GREYBUS_FUNCTION_SENSOR = 0x0c, |
| 51 | GREYBUS_FUNCTION_VENDOR = 0xff, |
| 52 | }; |
| 53 | |
| 54 | struct greybus_descriptor_function { |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 55 | __le16 cport; |
Matt Porter | 097724c | 2014-09-26 20:49:50 -0500 | [diff] [blame] | 56 | __u8 function_type; /* enum greybus_function_type */ |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 57 | }; |
| 58 | |
Matt Porter | 6d63ff7 | 2014-09-26 20:49:48 -0500 | [diff] [blame] | 59 | struct greybus_descriptor_module { |
Greg Kroah-Hartman | d587780 | 2014-09-01 10:59:08 -0700 | [diff] [blame] | 60 | __le16 vendor; |
| 61 | __le16 product; |
| 62 | __le16 version; |
Matt Porter | 4fc6454 | 2014-09-26 20:49:49 -0500 | [diff] [blame] | 63 | __le64 serial_number; |
Greg Kroah-Hartman | d587780 | 2014-09-01 10:59:08 -0700 | [diff] [blame] | 64 | __u8 vendor_stringid; |
| 65 | __u8 product_stringid; |
| 66 | }; |
| 67 | |
Greg Kroah-Hartman | d587780 | 2014-09-01 10:59:08 -0700 | [diff] [blame] | 68 | struct greybus_descriptor_string { |
Matt Porter | cbd0fd7 | 2014-09-26 20:49:51 -0500 | [diff] [blame] | 69 | __u8 length; |
Greg Kroah-Hartman | d587780 | 2014-09-01 10:59:08 -0700 | [diff] [blame] | 70 | __u8 id; |
| 71 | __u8 string[0]; |
| 72 | }; |
| 73 | |
| 74 | struct greybus_descriptor_cport { |
Alex Elder | 0db32a6 | 2014-09-24 05:16:14 -0500 | [diff] [blame] | 75 | __le16 id; |
Greg Kroah-Hartman | d587780 | 2014-09-01 10:59:08 -0700 | [diff] [blame] | 76 | __le16 size; |
| 77 | __u8 speed; // FIXME |
| 78 | __u8 reserved; |
| 79 | }; |
| 80 | |
Greg Kroah-Hartman | 6dca7b9 | 2014-09-01 13:42:43 -0700 | [diff] [blame] | 81 | struct greybus_descriptor { |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 82 | struct greybus_descriptor_header header; |
| 83 | union { |
Greg Kroah-Hartman | d587780 | 2014-09-01 10:59:08 -0700 | [diff] [blame] | 84 | struct greybus_descriptor_function function; |
Matt Porter | 6d63ff7 | 2014-09-26 20:49:48 -0500 | [diff] [blame] | 85 | struct greybus_descriptor_module module; |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 86 | struct greybus_descriptor_string string; |
| 87 | struct greybus_descriptor_cport cport; |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 88 | }; |
| 89 | }; |
| 90 | |
Alex Elder | badad68 | 2014-09-09 13:55:04 -0500 | [diff] [blame] | 91 | struct greybus_manifest { |
| 92 | struct greybus_manifest_header header; |
| 93 | struct greybus_descriptor descriptors[0]; |
| 94 | }; |
| 95 | |
Greg Kroah-Hartman | 48123e0 | 2014-09-02 10:51:56 -0700 | [diff] [blame] | 96 | #pragma pack(pop) |
| 97 | |
Alex Elder | 1dd7f58 | 2014-09-26 20:55:32 -0500 | [diff] [blame^] | 98 | #endif /* __GREYBUS_MANIFEST_H */ |