From 7069aa8fa86f385d0277db7f08b6f49f3a7c9328 Mon Sep 17 00:00:00 2001 From: Brian Duddie Date: Fri, 18 Aug 2017 17:48:16 -0700 Subject: [PATCH] context_hub: Define target version bytes Define that the first two previously-reserved bytes in the nanoapp header are used to indicate the target CHRE API version. Bug: 64852297 Test: run CHQTS on Nanohub, rebuild test app targeting 1.2 and confirm it's interpreted correctly Change-Id: I0582f718bb641cc9c4e1f013578dc2dd50e6d3ec --- include/hardware/context_hub.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/include/hardware/context_hub.h b/include/hardware/context_hub.h index aaa4274b..137cb3e5 100644 --- a/include/hardware/context_hub.h +++ b/include/hardware/context_hub.h @@ -47,12 +47,13 @@ __BEGIN_DECLS /*****************************************************************************/ #define CONTEXT_HUB_HEADER_MAJOR_VERSION 1 -#define CONTEXT_HUB_HEADER_MINOR_VERSION 0 +#define CONTEXT_HUB_HEADER_MINOR_VERSION 1 #define CONTEXT_HUB_DEVICE_API_VERSION \ HARDWARE_DEVICE_API_VERSION(CONTEXT_HUB_HEADER_MAJOR_VERSION, \ CONTEXT_HUB_HEADER_MINOR_VERSION) #define CONTEXT_HUB_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0) +#define CONTEXT_HUB_DEVICE_API_VERSION_1_1 HARDWARE_DEVICE_API_VERSION(1, 1) /** * The id of this module @@ -131,9 +132,17 @@ struct nano_app_binary_t { uint32_t app_version; // Version of the app uint32_t flags; // Signed, encrypted uint64_t hw_hub_type; // which hub type is this compiled for - uint32_t reserved[2]; // Should be all zeroes - uint8_t custom_binary[0]; // start of custom binary data -}; + + // The version of the CHRE API that this nanoapp was compiled against. + // If these values are both set to 0, then they must be interpreted the same + // as if major version were set to 1, and minor 0 (the first valid CHRE API + // version). + uint8_t target_chre_api_major_version; + uint8_t target_chre_api_minor_version; + + uint8_t reserved[6]; // Should be all zeroes + uint8_t custom_binary[0]; // start of custom binary data +} __attribute__((packed)); struct hub_app_info { struct hub_app_name_t app_name;