From a2d49d10076d12844db30be949682e954df1d7a7 Mon Sep 17 00:00:00 2001 From: Brian Duddie Date: Fri, 18 Aug 2017 17:57:00 -0700 Subject: [PATCH] contexthub: Pass target API version in new fields Update default implementation to use the new fields defined explicitly for passing in target CHRE API version information, rather than adding this data into the reserved area. Bug: 64852297 Test: run CHQTS on Nanohub, rebuild test app targeting 1.2 and confirm it's interpreted correctly Change-Id: Id11f9b510a2d239d285436e119b7b8dbece4c5df --- contexthub/1.0/default/Contexthub.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/contexthub/1.0/default/Contexthub.cpp b/contexthub/1.0/default/Contexthub.cpp index bf459005..3626a094 100644 --- a/contexthub/1.0/default/Contexthub.cpp +++ b/contexthub/1.0/default/Contexthub.cpp @@ -440,18 +440,15 @@ Return Contexthub::loadNanoApp(uint32_t hubId, // Data from the nanoapp header is passed through HIDL as explicit fields, // but the legacy HAL expects it prepended to the binary, therefore we must // reconstruct it here prior to passing to the legacy HAL. - uint32_t targetChreApiVersion = - (appBinary.targetChreApiMajorVersion << 24) | - (appBinary.targetChreApiMinorVersion << 16); const struct nano_app_binary_t header = { .header_version = htole32(1), - .magic = htole32(NANOAPP_MAGIC), - .app_id.id = htole64(appBinary.appId), - .app_version = htole32(appBinary.appVersion), - .flags = htole32(appBinary.flags), - .hw_hub_type = htole64(0), - .reserved[0] = htole32(targetChreApiVersion), - .reserved[1] = 0, + .magic = htole32(NANOAPP_MAGIC), + .app_id.id = htole64(appBinary.appId), + .app_version = htole32(appBinary.appVersion), + .flags = htole32(appBinary.flags), + .hw_hub_type = htole64(0), + .target_chre_api_major_version = appBinary.targetChreApiMajorVersion, + .target_chre_api_minor_version = appBinary.targetChreApiMinorVersion, }; const uint8_t *headerBytes = reinterpret_cast(&header); -- 2.11.0