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
+29 -12
View File
@@ -16,27 +16,44 @@ struct CExportedImplexorApiDesc
const char *name;
};
typedef int (sal_lmo_initializeIndFn)(void);
typedef int (sal_lmo_finalizeIndFn)(void);
typedef int (sal_lmo_attachDeviceReqFn)(void);
typedef int (sal_lmo_detachDeviceReqFn)(void);
typedef int (sal_mho_initializeRdyFn)(void);
typedef int (sal_mho_finalizeRdyFn)(void);
typedef int (sal_mho_attachDeviceAckFn)(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
* 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
* 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
* 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.
sal_lmo_detachDeviceReqFn *detachDeviceReq;
sal_mlo_detachDeviceReqFn *detachDeviceReq;
};
struct CSenseApiDesc
@@ -51,13 +68,13 @@ struct CSenseApiDesc
CExportedImplexorApiDesc *exportedImplexorApis;
/* 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)
{
if (!desc || !desc->name || desc->numExportedImplexorApis < 1
||!desc->exportedImplexorApis || !desc->sal_libMgmtOps)
||!desc->exportedImplexorApis || !desc->sal_mgmt_libOps)
{
return false;
}
@@ -76,7 +93,7 @@ static bool CExportedImplexorApiDesc_sanityCheck(
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
|| !ops->attachDeviceReq || !ops->detachDeviceReq)