SenseApiDesc,xcbWindow: port to sscl coro framework
SenseApiDesc's exported API now uses coro pointers instead of CPS fn pointers. * Do not build this version of SMO with the Livox drivers enabled, because SMO has been changed at the smocore level to use coros when calling into stimbuffAPI libs. But the Livox drivers haven't yet been ported from CPS to coros. xcbWindow has been ported to expose coros to SMO in its senseApiDesc exported iface.
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
|
||||
/* Common Libraries */
|
||||
#cmakedefine CONFIG_LIB_XCBXORG_ENABLED
|
||||
#cmakedefine CONFIG_LIB_LIVOXPROTO1_ENABLED
|
||||
#cmakedefine CONFIG_LIB_ALSA_ENABLED
|
||||
|
||||
/* Stim Buff APIs */
|
||||
|
||||
+20
-21
@@ -9,7 +9,7 @@
|
||||
#include <vector>
|
||||
#include <preprocessor.h>
|
||||
#include <user/deviceAttachmentSpec.h>
|
||||
#include <spinscale/cps/callback.h>
|
||||
#include <spinscale/co/invokers.h>
|
||||
#include <spinscale/componentThread.h>
|
||||
#define CL_TARGET_OPENCL_VERSION 120
|
||||
#include <CL/cl.h>
|
||||
@@ -42,25 +42,24 @@ struct SmoThreadingModelDesc
|
||||
*
|
||||
* State management that's tied to a particular attachment spec should be
|
||||
* done on the ComponentThread for the thread that SMO provided in the
|
||||
* attachDeviceReq call.
|
||||
* attachDeviceCReq call.
|
||||
*/
|
||||
std::shared_ptr<sscl::ComponentThread> componentThread;
|
||||
};
|
||||
|
||||
typedef std::function<void(bool, std::shared_ptr<device::DeviceAttachmentSpec>)>
|
||||
sal_mlo_attachDeviceReqCbFn;
|
||||
typedef std::function<void(bool, std::shared_ptr<device::DeviceAttachmentSpec>)>
|
||||
sal_mlo_detachDeviceReqCbFn;
|
||||
struct StimBuffDeviceOpResult
|
||||
{
|
||||
bool success = false;
|
||||
std::shared_ptr<device::DeviceAttachmentSpec> deviceSpec;
|
||||
};
|
||||
|
||||
typedef int (sal_mlo_initializeIndFn)(void);
|
||||
typedef int (sal_mlo_finalizeIndFn)(void);
|
||||
typedef void (sal_mlo_attachDeviceReqFn)(
|
||||
const std::shared_ptr<device::DeviceAttachmentSpec>& desc,
|
||||
const std::shared_ptr<sscl::ComponentThread>& componentThread,
|
||||
sscl::cps::Callback<sal_mlo_attachDeviceReqCbFn> cb);
|
||||
typedef void (sal_mlo_detachDeviceReqFn)(
|
||||
const std::shared_ptr<device::DeviceAttachmentSpec>& desc,
|
||||
sscl::cps::Callback<sal_mlo_detachDeviceReqCbFn> cb);
|
||||
using sal_mlo_initializeCIndFn = sscl::co::ViralNonPostingInvoker<int>(void);
|
||||
using sal_mlo_finalizeCIndFn = sscl::co::ViralNonPostingInvoker<int>(void);
|
||||
using sal_mlo_attachDeviceCReqFn = sscl::co::ViralNonPostingInvoker<StimBuffDeviceOpResult>(
|
||||
const std::shared_ptr<device::DeviceAttachmentSpec>& desc,
|
||||
const std::shared_ptr<sscl::ComponentThread>& componentThread);
|
||||
using sal_mlo_detachDeviceCReqFn = sscl::co::ViralNonPostingInvoker<StimBuffDeviceOpResult>(
|
||||
const std::shared_ptr<device::DeviceAttachmentSpec>& desc);
|
||||
|
||||
/**
|
||||
* @brief Hooks provided by Salmanoff to senseApi libraries.
|
||||
@@ -138,22 +137,22 @@ struct Sal_Mgmt_LibOps
|
||||
/* When Salmanoff loads a stim buff API lib, it calls this function to initialize
|
||||
* the lib. When this returns, the lib should be ready to attach devices.
|
||||
*/
|
||||
sal_mlo_initializeIndFn *initializeInd;
|
||||
sal_mlo_initializeCIndFn *initializeCInd;
|
||||
/* Salmanoff calls this to finalize the lib and free its internal
|
||||
* resources. When this returns, the lib should be ready to be unloaded.
|
||||
*/
|
||||
sal_mlo_finalizeIndFn *finalizeInd;
|
||||
sal_mlo_finalizeCIndFn *finalizeCInd;
|
||||
/* Salmanoff calls this to attach a device to the lib. When it returns, the
|
||||
* device should be attached and ready to present its stimbuff.
|
||||
*/
|
||||
sal_mlo_attachDeviceReqFn *attachDeviceReq;
|
||||
sal_mlo_attachDeviceCReqFn *attachDeviceCReq;
|
||||
// When this returns, the device should be detached.
|
||||
sal_mlo_detachDeviceReqFn *detachDeviceReq;
|
||||
sal_mlo_detachDeviceCReqFn *detachDeviceCReq;
|
||||
|
||||
static bool sanityCheck(const Sal_Mgmt_LibOps &ops)
|
||||
{
|
||||
if (!ops.initializeInd || !ops.finalizeInd
|
||||
|| !ops.attachDeviceReq || !ops.detachDeviceReq)
|
||||
if (!ops.initializeCInd || !ops.finalizeCInd
|
||||
|| !ops.attachDeviceCReq || !ops.detachDeviceCReq)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user