|
@@ -250,16 +250,18 @@ cmRtRC_t _cmRtSendStateStatusToHost( _cmRtCfg_t* cp )
|
250
|
250
|
return rc;
|
251
|
251
|
}
|
252
|
252
|
|
253
|
|
-// This is only called with _cmRtRecd.engMutexH locked
|
|
253
|
+// This function is called, within the real-time thread,
|
|
254
|
+// with _cmRtRecd.engMutexH locked, to deliver
|
|
255
|
+// messages to the real-time DSP processes via cp->ss.cbFunc()
|
254
|
256
|
cmRtRC_t _cmRtDeliverMsgsWithLock( _cmRtCfg_t* cp )
|
255
|
257
|
{
|
256
|
258
|
int i;
|
257
|
259
|
cmRtRC_t rc = kOkThRC;
|
258
|
260
|
|
259
|
|
- // as long as their may be a msg wating in the incoming msg queue
|
|
261
|
+ // as long msg's are in the queue incoming msg queue
|
260
|
262
|
for(i=0; rc == kOkThRC; ++i)
|
261
|
263
|
{
|
262
|
|
- // if a msg is waiting transmit it via cfg->cbFunc()
|
|
264
|
+ // if a msg is waiting transmit it via cp->ss.cbFunc()
|
263
|
265
|
if((rc = cmTsMp1cDequeueMsg(cp->htdQueueH,NULL,0)) == kOkThRC)
|
264
|
266
|
++cp->status.msgCbCnt;
|
265
|
267
|
}
|
|
@@ -267,6 +269,20 @@ cmRtRC_t _cmRtDeliverMsgsWithLock( _cmRtCfg_t* cp )
|
267
|
269
|
return rc;
|
268
|
270
|
}
|
269
|
271
|
|
|
272
|
+// This funciton is _cmRtDspExecCallback()->cmRtNetReceive() in the
|
|
273
|
+// real-time thread to deliver msg's to the DSP process.
|
|
274
|
+void _cmRtSysNetRecv( void* cbArg, const char* data, unsigned dataByteCnt, const struct sockaddr_in* fromAddr )
|
|
275
|
+{
|
|
276
|
+ _cmRtCfg_t* cp = (_cmRtCfg_t*)cbArg;
|
|
277
|
+
|
|
278
|
+ if( cp->cbEnableFl )
|
|
279
|
+ {
|
|
280
|
+ cmRtSysH_t h;
|
|
281
|
+ h.h = cp->p;
|
|
282
|
+ cmRtSysDeliverMsg(h,data,dataByteCnt,cmInvalidId);
|
|
283
|
+ }
|
|
284
|
+}
|
|
285
|
+
|
270
|
286
|
// The DSP execution callback happens through this function.
|
271
|
287
|
// This function is only called from inside _cmRtThreadCallback()
|
272
|
288
|
// with the engine mutex locked.
|
|
@@ -281,7 +297,7 @@ void _cmRtDspExecCallback( _cmRtCfg_t* cp )
|
281
|
297
|
cmApBufGetIO(cp->ss.args.inDevIdx, cp->ctx.iChArray, cp->ctx.iChCnt, cp->ss.args.outDevIdx, cp->ctx.oChArray, cp->ctx.oChCnt );
|
282
|
298
|
|
283
|
299
|
|
284
|
|
- // calling this function results in callbacks to _cmRtNetRecv()
|
|
300
|
+ // calling this function results in callbacks to _cmRtSysNetRecv()
|
285
|
301
|
// which in turn calls cmRtSysDeliverMsg() which queues any incoming messages
|
286
|
302
|
// which are then transferred to the DSP processes by the the call to
|
287
|
303
|
// _cmRtDeliverMsgWithLock() below.
|
|
@@ -289,10 +305,10 @@ void _cmRtDspExecCallback( _cmRtCfg_t* cp )
|
289
|
305
|
if( cmRtNetReceive(cp->netH) != kOkNetRC )
|
290
|
306
|
_cmRtError(cp->p,kNetErrRtRC,"Network receive failed.");
|
291
|
307
|
|
|
308
|
+ // NOTE: BY DEQUEUEING MSGS FIRST AND THEN SERVICING THE NETWORK
|
|
309
|
+ // WE COULD ELIMINATE QUEUEING NETWORK MESSAGES - THEY COULD BE
|
|
310
|
+ // SEND DIRECTLY THROUGH TO THE DSP PROCESSES
|
292
|
311
|
|
293
|
|
- //if( cp->cbEnableFl )
|
294
|
|
- // cmUdpGetAvailData(cp->udpH,NULL,NULL,NULL);
|
295
|
|
-
|
296
|
312
|
// if there are msgs waiting to be sent to the DSP process send them.
|
297
|
313
|
if( cp->cbEnableFl )
|
298
|
314
|
if( cmTsMp1cMsgWaiting(cp->htdQueueH) )
|
|
@@ -538,16 +554,6 @@ void _cmRtSysMidiCallback( const cmMidiPacket_t* pktArray, unsigned pktCnt )
|
538
|
554
|
|
539
|
555
|
}
|
540
|
556
|
|
541
|
|
-// This funciton is called from the real-time thread
|
542
|
|
-void _cmRtSysNetRecv( void* cbArg, const char* data, unsigned dataByteCnt, const struct sockaddr_in* fromAddr )
|
543
|
|
-{
|
544
|
|
- _cmRtCfg_t* cp = (_cmRtCfg_t*)cbArg;
|
545
|
|
-
|
546
|
|
- cmRtSysH_t h;
|
547
|
|
- h.h = cp->p;
|
548
|
|
- cmRtSysDeliverMsg(h,data,dataByteCnt,cmInvalidId);
|
549
|
|
-
|
550
|
|
-}
|
551
|
557
|
|
552
|
558
|
|
553
|
559
|
cmRtRC_t cmRtSysAllocate( cmRtSysH_t* hp, cmCtx_t* ctx )
|