From 42f55bb32452c3572fa790571ea7d47227f932c9 Mon Sep 17 00:00:00 2001 From: Hayodea Hakol Date: Sat, 18 Jan 2025 10:16:02 -0400 Subject: [PATCH] SenseApiDesc: Delete Sal_Mgmt_HkOps & document iface We don't need the Sal_Mgmt_HkOps anymore because we won't be using a callback model anymore. We'll be enqueuing messages. --- include/user/senseApiDesc.h | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/include/user/senseApiDesc.h b/include/user/senseApiDesc.h index 9f825ef..b4d421c 100644 --- a/include/user/senseApiDesc.h +++ b/include/user/senseApiDesc.h @@ -8,26 +8,6 @@ namespace hk { namespace sense_api { -/* Exported by all sense API Libraries to tell Harikoff what API the lib uses - * to connect to providers; and also to state which implexor APIs it exports. - */ -typedef int (sal_mho_initializeRdyFn)(void); -typedef int (sal_mho_finalizeRdyFn)(void); -typedef int (sal_mho_attachDeviceAckFn)(const device::SenseDeviceSpec &desc); -typedef int (sal_mho_detachDeviceAckFn)(const device::SenseDeviceSpec &desc); - -struct Sal_Mgmt_HkOps -{ - // Lib calls this function to notify Harikoff that it's done initializing. - sal_mho_initializeRdyFn *initializeRdy; - // Lib calls this function to notify Harikoff that it's done finalizing. - sal_mho_finalizeRdyFn *finalizeRdy; - // Lib calls this to notify Harikoff that it's done attaching a device. - sal_mho_attachDeviceAckFn *attachDeviceAck; - // Lib calls this to notify Harikoff that it's done detaching a device. - sal_mho_detachDeviceAckFn *detachDeviceAck; -}; - typedef int (sal_mlo_initializeIndFn)(void); typedef int (sal_mlo_finalizeIndFn)(void); typedef int (sal_mlo_attachDeviceReqFn)(const device::SenseDeviceSpec &desc); @@ -62,8 +42,8 @@ struct Sal_Mgmt_LibOps } }; -/* C++ version of the C struct above, which Harikoff uses to manage the - * lib and connect implexors to it. +/* Exported by all sense API Libraries to tell Harikoff what API the lib uses + * to connect to providers; and also to state which implexor APIs it exports. */ class SenseApiDesc { @@ -118,12 +98,21 @@ public: Sal_Mgmt_LibOps sal_mgmt_libOps; }; + #define HK_GET_SENSE_API_DESC_FN_NAME getSenseApiDesc #define HK_GET_SENSE_API_DESC_FN_NAME_STR \ HK_QUOTE(HK_GET_SENSE_API_DESC_FN_NAME) #define HK_GET_SENSE_API_DESC_FN_TYPEDEF \ HK_CONCAT(HK_GET_SENSE_API_DESC_FN_NAME, Fn) +/* Every Sense API library must define a global instance of this + * function. Harikoff will search for it and invoke it via dlsym(). + * + * The function must return a SenseApiDesc struct that Hk will tell + * Hk what implexors can be used with it & what APIs it exports. + * The SenseApiDesc struct also gives Hk pointers to API functions + * to invoke for communication between Hk and the library. + */ typedef const SenseApiDesc &(HK_GET_SENSE_API_DESC_FN_TYPEDEF)(void); } // namespace sense_api