cmRtSys.c: Comment updates.
This commit is contained in:
parent
6dfbab8037
commit
a1a0a61e74
40
cmRtSys.c
40
cmRtSys.c
@ -250,16 +250,18 @@ cmRtRC_t _cmRtSendStateStatusToHost( _cmRtCfg_t* cp )
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is only called with _cmRtRecd.engMutexH locked
|
// This function is called, within the real-time thread,
|
||||||
|
// with _cmRtRecd.engMutexH locked, to deliver
|
||||||
|
// messages to the real-time DSP processes via cp->ss.cbFunc()
|
||||||
cmRtRC_t _cmRtDeliverMsgsWithLock( _cmRtCfg_t* cp )
|
cmRtRC_t _cmRtDeliverMsgsWithLock( _cmRtCfg_t* cp )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
cmRtRC_t rc = kOkThRC;
|
cmRtRC_t rc = kOkThRC;
|
||||||
|
|
||||||
// as long as their may be a msg wating in the incoming msg queue
|
// as long msg's are in the queue incoming msg queue
|
||||||
for(i=0; rc == kOkThRC; ++i)
|
for(i=0; rc == kOkThRC; ++i)
|
||||||
{
|
{
|
||||||
// if a msg is waiting transmit it via cfg->cbFunc()
|
// if a msg is waiting transmit it via cp->ss.cbFunc()
|
||||||
if((rc = cmTsMp1cDequeueMsg(cp->htdQueueH,NULL,0)) == kOkThRC)
|
if((rc = cmTsMp1cDequeueMsg(cp->htdQueueH,NULL,0)) == kOkThRC)
|
||||||
++cp->status.msgCbCnt;
|
++cp->status.msgCbCnt;
|
||||||
}
|
}
|
||||||
@ -267,6 +269,20 @@ cmRtRC_t _cmRtDeliverMsgsWithLock( _cmRtCfg_t* cp )
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This funciton is _cmRtDspExecCallback()->cmRtNetReceive() in the
|
||||||
|
// real-time thread to deliver msg's to the DSP process.
|
||||||
|
void _cmRtSysNetRecv( void* cbArg, const char* data, unsigned dataByteCnt, const struct sockaddr_in* fromAddr )
|
||||||
|
{
|
||||||
|
_cmRtCfg_t* cp = (_cmRtCfg_t*)cbArg;
|
||||||
|
|
||||||
|
if( cp->cbEnableFl )
|
||||||
|
{
|
||||||
|
cmRtSysH_t h;
|
||||||
|
h.h = cp->p;
|
||||||
|
cmRtSysDeliverMsg(h,data,dataByteCnt,cmInvalidId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// The DSP execution callback happens through this function.
|
// The DSP execution callback happens through this function.
|
||||||
// This function is only called from inside _cmRtThreadCallback()
|
// This function is only called from inside _cmRtThreadCallback()
|
||||||
// with the engine mutex locked.
|
// with the engine mutex locked.
|
||||||
@ -281,7 +297,7 @@ void _cmRtDspExecCallback( _cmRtCfg_t* cp )
|
|||||||
cmApBufGetIO(cp->ss.args.inDevIdx, cp->ctx.iChArray, cp->ctx.iChCnt, cp->ss.args.outDevIdx, cp->ctx.oChArray, cp->ctx.oChCnt );
|
cmApBufGetIO(cp->ss.args.inDevIdx, cp->ctx.iChArray, cp->ctx.iChCnt, cp->ss.args.outDevIdx, cp->ctx.oChArray, cp->ctx.oChCnt );
|
||||||
|
|
||||||
|
|
||||||
// calling this function results in callbacks to _cmRtNetRecv()
|
// calling this function results in callbacks to _cmRtSysNetRecv()
|
||||||
// which in turn calls cmRtSysDeliverMsg() which queues any incoming messages
|
// which in turn calls cmRtSysDeliverMsg() which queues any incoming messages
|
||||||
// which are then transferred to the DSP processes by the the call to
|
// which are then transferred to the DSP processes by the the call to
|
||||||
// _cmRtDeliverMsgWithLock() below.
|
// _cmRtDeliverMsgWithLock() below.
|
||||||
@ -289,10 +305,10 @@ void _cmRtDspExecCallback( _cmRtCfg_t* cp )
|
|||||||
if( cmRtNetReceive(cp->netH) != kOkNetRC )
|
if( cmRtNetReceive(cp->netH) != kOkNetRC )
|
||||||
_cmRtError(cp->p,kNetErrRtRC,"Network receive failed.");
|
_cmRtError(cp->p,kNetErrRtRC,"Network receive failed.");
|
||||||
|
|
||||||
|
// NOTE: BY DEQUEUEING MSGS FIRST AND THEN SERVICING THE NETWORK
|
||||||
|
// WE COULD ELIMINATE QUEUEING NETWORK MESSAGES - THEY COULD BE
|
||||||
|
// SEND DIRECTLY THROUGH TO THE DSP PROCESSES
|
||||||
|
|
||||||
//if( cp->cbEnableFl )
|
|
||||||
// cmUdpGetAvailData(cp->udpH,NULL,NULL,NULL);
|
|
||||||
|
|
||||||
// if there are msgs waiting to be sent to the DSP process send them.
|
// if there are msgs waiting to be sent to the DSP process send them.
|
||||||
if( cp->cbEnableFl )
|
if( cp->cbEnableFl )
|
||||||
if( cmTsMp1cMsgWaiting(cp->htdQueueH) )
|
if( cmTsMp1cMsgWaiting(cp->htdQueueH) )
|
||||||
@ -538,16 +554,6 @@ void _cmRtSysMidiCallback( const cmMidiPacket_t* pktArray, unsigned pktCnt )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This funciton is called from the real-time thread
|
|
||||||
void _cmRtSysNetRecv( void* cbArg, const char* data, unsigned dataByteCnt, const struct sockaddr_in* fromAddr )
|
|
||||||
{
|
|
||||||
_cmRtCfg_t* cp = (_cmRtCfg_t*)cbArg;
|
|
||||||
|
|
||||||
cmRtSysH_t h;
|
|
||||||
h.h = cp->p;
|
|
||||||
cmRtSysDeliverMsg(h,data,dataByteCnt,cmInvalidId);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
cmRtRC_t cmRtSysAllocate( cmRtSysH_t* hp, cmCtx_t* ctx )
|
cmRtRC_t cmRtSysAllocate( cmRtSysH_t* hp, cmCtx_t* ctx )
|
||||||
|
Loading…
Reference in New Issue
Block a user