コード例 #1
0
ファイル: Instrument.cpp プロジェクト: jsoutherland/CereLink
// A packet has come in...
void Instrument::TestForReply(void * pPacket)
{
    // Give everyone a chance to see if this is an important packet
    for (CachedPacket * pCache = m_aicCache; pCache != ARRAY_END(m_aicCache); ++pCache)
    {
        pCache->CheckForReply(pPacket);
    }
}
コード例 #2
0
ファイル: Instrument.cpp プロジェクト: jsoutherland/CereLink
void Instrument::Reset(int nMaxTickCount, int nMaxRetryCount)
{
    // Call everybody's reset member function
    CachedPacket * pCache;
    for (pCache = m_aicCache; pCache != ARRAY_END(m_aicCache); pCache++)
    {
        pCache->Reset(nMaxTickCount, nMaxRetryCount);
    }
}
コード例 #3
0
ファイル: Instrument.cpp プロジェクト: jsoutherland/CereLink
// What is our current send mode?
Instrument::ModeType Instrument::GetSendMode()
{
    ModeType ret = static_cast<ModeType>(0);
    for (CachedPacket * pCache = m_aicCache; pCache != ARRAY_END(m_aicCache); ++pCache)
    {
        ret = max(ret, pCache->GetMode());
    }
    return ret;
}
コード例 #4
0
ファイル: Instrument.cpp プロジェクト: jsoutherland/CereLink
// Author & Date:   Kirk Korver     05 Jan 2003
// Purpose: Is it OK to send a new packet out?
// Outputs:
//  TRUE if it is OK to send; FALSE if not
bool Instrument::OkToSend()
{
    CachedPacket * pEnd = ARRAY_END(m_aicCache);
    CachedPacket * pFound;
    // Find the first location that is open
    for (pFound = m_aicCache; pFound != pEnd; pFound++)
    {
        if (pFound->OkToSend())
            break;
    }

    return (pFound != pEnd);
}
コード例 #5
0
ファイル: Instrument.cpp プロジェクト: jsoutherland/CereLink
// Called every 10 ms...use for "resending"
// Outputs:
//  TRUE if any instrument error has happened; FALSE otherwise
bool Instrument::Tick()
{
    // What is the end?
    CachedPacket * pEnd = ARRAY_END(m_aicCache);
    CachedPacket * pFound;
    // Find the first case where        {item}.Tick(m_icUDP) == true
    for (pFound = m_aicCache; pFound != pEnd; pFound++)
    {
        if (pFound->Tick(m_icUDP))
            break;
    }

   // If I've reached the end, then none are true
    return pFound != pEnd;
}
コード例 #6
0
ファイル: Instrument.cpp プロジェクト: jsoutherland/CereLink
int Instrument::Send(void *ppkt)
{
    UINT32 quadlettotal = (((cbPKT_GENERIC*)ppkt)->dlen) + cbPKT_HEADER_32SIZE;
    UINT32 cbSize = quadlettotal << 2;      // number of bytes


    CachedPacket * pEnd = ARRAY_END(m_aicCache);
    CachedPacket * pCache;
    // Find the first location that is open
    for (pCache = m_aicCache; pCache != pEnd; pCache++) {
        if (pCache->OkToSend())
            break;
    }
    // pCache = std::find_if(m_aicCache, pEnd, std::mem_fun_ref(&CachedPacket::OkToSend));

    ASSERT(pCache != pEnd);
    pCache->AddPacket(ppkt, cbSize);
    return m_icUDP.Send(ppkt, cbSize);
}
コード例 #7
0
ファイル: dm-message.c プロジェクト: xf739645524/kernel-rhel5
static inline void
print_ret(const char *caller, unsigned long ret)
{
	struct {
		unsigned long err;
		const char *err_str;
	} static err_msg[] = {
		{ dm_msg_ret_ambiguous, "message ambiguous" },
		{ dm_msg_ret_inval, "message invalid" },
		{ dm_msg_ret_undef, "message undefined" },
		{ dm_msg_ret_arg, "message argument" },
		{ dm_msg_ret_argcount, "message argument count" },
		{ dm_msg_ret_option, "option" },
	}, *e = ARRAY_END(err_msg);

	while (e-- > err_msg) {
		if (test_bit(e->err, &ret))
			DMERR("%s %s", caller, e->err_str);
	}
}
コード例 #8
0
ファイル: cbHwlibHi.cpp プロジェクト: jsoutherland/CereLink
// Author & Date:   Kirk Korver     02 Nov 2005
// Purpose: tell which acquisition group this channel is part of
//  See SetAcqGroup
// Inputs:
//  nChan - the 1 based channel of interest
// Outpus:
//  0 means not part of any acquisition group; 1+ means part of that group
// Note: Do not use this function to find the sampling rate,
// use cbGetSmpGroup instead.
UINT32 cbGetAcqGroup(UINT32 nChan, UINT32 nInstance)
{
    UINT32 nFilter = 0;
    UINT32 nSG = 0;
    ::cbGetAinpSampling(nChan, &nFilter, &nSG, nInstance);

    for (const cbAcqSettings * pTest = isAcqData; pTest != ARRAY_END(isAcqData); ++pTest)
    {
        if (pTest->nFilter == nFilter &&
            pTest->nSampleGroup == nSG)
        {
            return UINT32(pTest - &isAcqData[0]);
        }
    }

    // If I got here then then was no match. I had better make it "not sample"
    // and return that.
    cbSetAcqGroup(nChan, 0, nInstance);
    return 0;
}