Skip to content

Commit

Permalink
Remove m_nNspStatus usage when under proto 3.11.
Browse files Browse the repository at this point in the history
  • Loading branch information
cboulay committed Sep 2, 2023
1 parent 5a9a6e5 commit 453c640
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
3 changes: 3 additions & 0 deletions cbhwlib/cbHwlibHi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1180,19 +1180,22 @@ uint32_t cbGetNumActiveInstruments()
return nNumActiveInstruments;
}


NSP_STATUS cbGetNspStatus(uint32_t nInstrument)
{
if (nInstrument > cbMAXPROCS)
return NSP_INVALID;
return cb_pc_status_buffer_ptr[0]->cbGetNspStatus(nInstrument - 1);
}

#ifndef CBPROTO_311
void cbSetNspStatus(uint32_t nInstrument, NSP_STATUS nStatus)
{
ASSERT(nInstrument - 1 < cbMAXPROCS);
if (nInstrument - 1 < cbMAXPROCS)
cb_pc_status_buffer_ptr[0]->cbSetNspStatus(nInstrument - 1, nStatus);
}
#endif

uint32_t cbGetExpandedChannelNumber(uint32_t nInstrument, uint32_t nChannel)
{
Expand Down
2 changes: 2 additions & 0 deletions cbhwlib/cbHwlibHi.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ uint32_t GetDigoutChanNumber(uint32_t nOrdinal, uint32_t nInstance = 0);

uint32_t cbGetNumActiveInstruments();
NSP_STATUS cbGetNspStatus(uint32_t nInstrument);
#ifndef CBPROTO_311
void cbSetNspStatus(uint32_t nInstrument, NSP_STATUS nStatus);
#endif
uint32_t cbGetExpandedChannelNumber(uint32_t nInstrument, uint32_t nChannel);
uint32_t cbGetChanInstrument(uint32_t nChannel, uint32_t nInstance = 0);
uint32_t cbGetInstrumentLocalChannelNumber(uint32_t nChan);
Expand Down
1 change: 1 addition & 0 deletions cbhwlib/cbhwlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,7 @@ cbRESULT cbSetComment(uint8_t charset, uint32_t rgba, PROCTIME time, const char*
#ifndef CBPROTO_311
pktComment.rgba = rgba;
pktComment.timeStarted = time;
// else pktComment.info.flags, pktComment.data
#endif
uint32_t nLen = 0;
if (comment)
Expand Down
14 changes: 11 additions & 3 deletions cbhwlib/cbhwlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -863,9 +863,9 @@ class cbPcStatus
uint32_t m_nNumSerialChans;
uint32_t m_nNumDigoutChans;
uint32_t m_nNumTotalChans;
#ifndef CBPROTO_311
NSP_STATUS m_nNspStatus[cbMAXPROCS]; // true if the nsp has received a sysinfo from each NSP
uint32_t m_nNumNTrodesPerInstrument[cbMAXPROCS];
#ifndef CBPROTO_311
uint32_t m_nGeminiSystem; // Used as boolean true if connected to a gemini system
#endif

Expand All @@ -887,7 +887,9 @@ class cbPcStatus
for (uint32_t nProc = 0; nProc < cbMAXPROCS; ++nProc)
{
isSelection[nProc].lastchan = 1;
#ifndef CBPROTO_311
m_nNspStatus[nProc] = NSP_INIT;
#endif
}
}
bool IsRecordingBlocked() { return m_iBlockRecording != 0; }
Expand All @@ -902,8 +904,16 @@ class cbPcStatus
uint32_t cbGetNumSerialChans() { return m_nNumSerialChans; }
uint32_t cbGetNumDigoutChans() { return m_nNumDigoutChans; }
uint32_t cbGetNumTotalChans() { return m_nNumTotalChans; }

#ifndef CBPROTO_311
NSP_STATUS cbGetNspStatus(uint32_t nProc) { return m_nNspStatus[nProc]; }
uint32_t cbGetNumNTrodesPerInstrument(uint32_t nProc) { return m_nNumNTrodesPerInstrument[nProc - 1]; }
void cbSetNspStatus(uint32_t nInstrument, NSP_STATUS nStatus) { m_nNspStatus[nInstrument] = nStatus; }
void cbSetNumNTrodesPerInstrument(uint32_t nInstrument, uint32_t nNumNTrodesPerInstrument) { m_nNumNTrodesPerInstrument[nInstrument - 1] = nNumNTrodesPerInstrument; }
#else
// m_NspStatus not avail in 3.11 so set to always found to pass logic checks.
NSP_STATUS cbGetNspStatus(uint32_t nProc) { return NSP_FOUND; }
#endif
void SetBlockRecording(bool bBlockRecording) { m_iBlockRecording += bBlockRecording ? 1 : -1; }
void cbSetPCStatusFlags(uint32_t nPCStatusFlags) { m_nPCStatusFlags = nPCStatusFlags; }
void cbSetNumFEChans(uint32_t nNumFEChans) { m_nNumFEChans = nNumFEChans; }
Expand All @@ -916,8 +926,6 @@ class cbPcStatus
void cbSetNumSerialChans(uint32_t nNumSerialChans) { m_nNumSerialChans = nNumSerialChans; }
void cbSetNumDigoutChans(uint32_t nNumDigoutChans) { m_nNumDigoutChans = nNumDigoutChans; }
void cbSetNumTotalChans(uint32_t nNumTotalChans) { m_nNumTotalChans = nNumTotalChans; }
void cbSetNspStatus(uint32_t nInstrument, NSP_STATUS nStatus) { m_nNspStatus[nInstrument] = nStatus; }
void cbSetNumNTrodesPerInstrument(uint32_t nInstrument, uint32_t nNumNTrodesPerInstrument) { m_nNumNTrodesPerInstrument[nInstrument - 1] = nNumNTrodesPerInstrument; }
};

typedef struct {
Expand Down
7 changes: 3 additions & 4 deletions cbsdk/cbsdk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,20 @@ void SdkApp::OnPktGroup(const cbPKT_GROUP * const pkt)
#ifndef CBPROTO_311
if (pkt->cbpkt_header.instrument >= cbMAXPROCS)
nInstrument = 0;
#endif

for (uint32_t nProc = 0; nProc < cbMAXPROCS; ++nProc)
{
if (NSP_FOUND == cbGetNspStatus(nProc + 1))
{
if (cbRESULT_OK == ::cbGetProcInfo(nProc + 1, &isProcInfo))
nChanProcMax += isProcInfo.chancount;
#ifndef CBPROTO_311

if (pkt->cbpkt_header.instrument == nProc)
break;
#endif

nChanProcStart = nChanProcMax;
}
}
#endif

// Get information about this group...
uint32_t period;
Expand Down

0 comments on commit 453c640

Please sign in to comment.