Rename Csal_lmo=>Csal_mlo, and introduce a Csal_mho role

* Introduce the hk end of the management role for the senseApiLibs.
* Implement a basic set of operations and callbacks for this role.
This commit is contained in:
2025-01-09 17:18:24 -04:00
parent 53583e5735
commit 9e35748d9a
3 changed files with 45 additions and 28 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ public:
void setSenseApiDesc(const CSenseApiDesc* desc) void setSenseApiDesc(const CSenseApiDesc* desc)
{ {
if (!CSenseApiDesc_sanityCheck(desc) || if (!CSenseApiDesc_sanityCheck(desc) ||
!Csal_libMgmtOps_sanityCheck(desc->sal_libMgmtOps)) !Csal_mgmt_libOps_sanityCheck(desc->sal_mgmt_libOps))
{ {
throw std::runtime_error( throw std::runtime_error(
std::string(__func__) + ": Sanity check failed for sense API " std::string(__func__) + ": Sanity check failed for sense API "
+29 -12
View File
@@ -16,27 +16,44 @@ struct CExportedImplexorApiDesc
const char *name; const char *name;
}; };
typedef int (sal_lmo_initializeIndFn)(void); typedef int (sal_mho_initializeRdyFn)(void);
typedef int (sal_lmo_finalizeIndFn)(void); typedef int (sal_mho_finalizeRdyFn)(void);
typedef int (sal_lmo_attachDeviceReqFn)(void); typedef int (sal_mho_attachDeviceAckFn)(void);
typedef int (sal_lmo_detachDeviceReqFn)(void); typedef int (sal_mho_detachDeviceAckFn)(void);
struct Csal_libMgmtOps struct Csal_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)(Csal_mgmt_hkOps *hkOps);
typedef int (sal_mlo_finalizeIndFn)(void);
typedef int (sal_mlo_attachDeviceReqFn)(void);
typedef int (sal_mlo_detachDeviceReqFn)(void);
struct Csal_mgmt_libOps
{ {
/* When Harikoff loads a sense API lib, it calls this function to initialize /* When Harikoff loads a sense API lib, it calls this function to initialize
* the lib. When this returns, the lib should be ready to attach devices. * the lib. When this returns, the lib should be ready to attach devices.
*/ */
sal_lmo_initializeIndFn *initializeInd; sal_mlo_initializeIndFn *initializeInd;
/* Harikoff calls this to finalize the lib and free its internal /* Harikoff calls this to finalize the lib and free its internal
* resources. When this returns, the lib should be ready to be unloaded. * resources. When this returns, the lib should be ready to be unloaded.
*/ */
sal_lmo_finalizeIndFn *finalizeInd; sal_mlo_finalizeIndFn *finalizeInd;
/* Harikoff calls this to attach a device to the lib. When it returns, the /* Harikoff calls this to attach a device to the lib. When it returns, the
* device should be attached and ready to be implexed. * device should be attached and ready to be implexed.
*/ */
sal_lmo_attachDeviceReqFn *attachDeviceReq; sal_mlo_attachDeviceReqFn *attachDeviceReq;
// When this returns, the device should be detached. // When this returns, the device should be detached.
sal_lmo_detachDeviceReqFn *detachDeviceReq; sal_mlo_detachDeviceReqFn *detachDeviceReq;
}; };
struct CSenseApiDesc struct CSenseApiDesc
@@ -51,13 +68,13 @@ struct CSenseApiDesc
CExportedImplexorApiDesc *exportedImplexorApis; CExportedImplexorApiDesc *exportedImplexorApis;
/* Sub-API for managing the lib. Library role within the API. /* Sub-API for managing the lib. Library role within the API.
*/ */
Csal_libMgmtOps *sal_libMgmtOps; Csal_mgmt_libOps *sal_mgmt_libOps;
}; };
static bool CSenseApiDesc_sanityCheck(const CSenseApiDesc *desc) static bool CSenseApiDesc_sanityCheck(const CSenseApiDesc *desc)
{ {
if (!desc || !desc->name || desc->numExportedImplexorApis < 1 if (!desc || !desc->name || desc->numExportedImplexorApis < 1
||!desc->exportedImplexorApis || !desc->sal_libMgmtOps) ||!desc->exportedImplexorApis || !desc->sal_mgmt_libOps)
{ {
return false; return false;
} }
@@ -76,7 +93,7 @@ static bool CExportedImplexorApiDesc_sanityCheck(
return true; return true;
} }
static bool Csal_libMgmtOps_sanityCheck(const Csal_libMgmtOps *ops) static bool Csal_mgmt_libOps_sanityCheck(const Csal_mgmt_libOps *ops)
{ {
if (!ops || !ops->initializeInd || !ops->finalizeInd if (!ops || !ops->initializeInd || !ops->finalizeInd
|| !ops->attachDeviceReq || !ops->detachDeviceReq) || !ops->attachDeviceReq || !ops->detachDeviceReq)
+15 -15
View File
@@ -11,12 +11,12 @@ static CExportedImplexorApiDesc xcbXorgExportedImplexorApis[] =
} }
}; };
static sal_lmo_initializeIndFn xcbXorg_initializeInd; static sal_mlo_initializeIndFn xcbXorg_initializeInd;
static sal_lmo_finalizeIndFn xcbXorg_finalizeInd; static sal_mlo_finalizeIndFn xcbXorg_finalizeInd;
static sal_lmo_attachDeviceReqFn xcbXorg_attachDeviceReq; static sal_mlo_attachDeviceReqFn xcbXorg_attachDeviceReq;
static sal_lmo_detachDeviceReqFn xcbXorg_detachDeviceReq; static sal_mlo_detachDeviceReqFn xcbXorg_detachDeviceReq;
static Csal_libMgmtOps xcbXorgSalLibMgmtOps = static Csal_mgmt_libOps xcbXorgMgmtLibOps =
{ {
.initializeInd = xcbXorg_initializeInd, .initializeInd = xcbXorg_initializeInd,
.finalizeInd = xcbXorg_finalizeInd, .finalizeInd = xcbXorg_finalizeInd,
@@ -26,11 +26,11 @@ static Csal_libMgmtOps xcbXorgSalLibMgmtOps =
static CSenseApiDesc xcbXorgApiDesc = static CSenseApiDesc xcbXorgApiDesc =
{ {
.name = "XcbXorg", .name = "xcb-xorg",
.numExportedImplexorApis = sizeof(xcbXorgExportedImplexorApis) / .numExportedImplexorApis = sizeof(xcbXorgExportedImplexorApis) /
sizeof(*xcbXorgExportedImplexorApis), sizeof(*xcbXorgExportedImplexorApis),
.exportedImplexorApis = xcbXorgExportedImplexorApis, .exportedImplexorApis = xcbXorgExportedImplexorApis,
.sal_libMgmtOps = &xcbXorgSalLibMgmtOps .sal_mgmt_libOps = &xcbXorgMgmtLibOps
}; };
extern HK_UNMANGLED getSenseApiDescFn HK_GET_SENSE_API_DESC_FN_NAME; extern HK_UNMANGLED getSenseApiDescFn HK_GET_SENSE_API_DESC_FN_NAME;
@@ -40,30 +40,30 @@ const CSenseApiDesc *HK_GET_SENSE_API_DESC_FN_NAME(void)
return &xcbXorgApiDesc; return &xcbXorgApiDesc;
} }
static sal_lmo_initializeIndFn xcbXorg_initializeInd; static sal_mlo_initializeIndFn xcbXorg_initializeInd;
int xcbXorg_initializeInd(void) int xcbXorg_initializeInd(void)
{ {
std::cerr << "XcbXorg::sal_lmo_initializeInd\n"; std::cerr << "XcbXorg::sal_mlo_initializeInd\n";
return 0; return 0;
} }
static sal_lmo_finalizeIndFn xcbXorg_finalizeInd; static sal_mlo_finalizeIndFn xcbXorg_finalizeInd;
int xcbXorg_finalizeInd(void) int xcbXorg_finalizeInd(void)
{ {
std::cerr << "XcbXorg::sal_lmo_finalizeInd\n"; std::cerr << "XcbXorg::sal_mlo_finalizeInd\n";
return 0; return 0;
} }
static sal_lmo_attachDeviceReqFn xcbXorg_attachDeviceReq; static sal_mlo_attachDeviceReqFn xcbXorg_attachDeviceReq;
int xcbXorg_attachDeviceReq(void) int xcbXorg_attachDeviceReq(void)
{ {
std::cerr << "XcbXorg::sal_lmo_attachDeviceReq\n"; std::cerr << "XcbXorg::sal_mlo_attachDeviceReq\n";
return 0; return 0;
} }
static sal_lmo_detachDeviceReqFn xcbXorg_detachDeviceReq; static sal_mlo_detachDeviceReqFn xcbXorg_detachDeviceReq;
int xcbXorg_detachDeviceReq(void) int xcbXorg_detachDeviceReq(void)
{ {
std::cerr << "XcbXorg::sal_lmo_detachDeviceReq\n"; std::cerr << "XcbXorg::sal_mlo_detachDeviceReq\n";
return 0; return 0;
} }