Browse Source

cmRtSys.c: Comment updates.

master
kevin 11 years ago
parent
commit
a1a0a61e74
1 changed files with 23 additions and 17 deletions
  1. 23
    17
      cmRtSys.c

+ 23
- 17
cmRtSys.c View File

250
   return rc;
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
 cmRtRC_t _cmRtDeliverMsgsWithLock( _cmRtCfg_t* cp  )
256
 cmRtRC_t _cmRtDeliverMsgsWithLock( _cmRtCfg_t* cp  )
255
 {
257
 {
256
   int      i;
258
   int      i;
257
   cmRtRC_t rc = kOkThRC;
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
   for(i=0; rc == kOkThRC; ++i)
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
     if((rc = cmTsMp1cDequeueMsg(cp->htdQueueH,NULL,0)) == kOkThRC)
265
     if((rc = cmTsMp1cDequeueMsg(cp->htdQueueH,NULL,0)) == kOkThRC)
264
       ++cp->status.msgCbCnt;
266
       ++cp->status.msgCbCnt;
265
   }
267
   }
267
   return rc;
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
 // The DSP execution callback happens through this function.
286
 // The DSP execution callback happens through this function.
271
 // This function is only called from inside _cmRtThreadCallback() 
287
 // This function is only called from inside _cmRtThreadCallback() 
272
 // with the engine mutex locked.
288
 // with the engine mutex locked.
281
   cmApBufGetIO(cp->ss.args.inDevIdx, cp->ctx.iChArray, cp->ctx.iChCnt, cp->ss.args.outDevIdx, cp->ctx.oChArray, cp->ctx.oChCnt  );
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
   // which in turn calls cmRtSysDeliverMsg() which queues any incoming messages
301
   // which in turn calls cmRtSysDeliverMsg() which queues any incoming messages
286
   // which are then transferred to the DSP processes by the the call to 
302
   // which are then transferred to the DSP processes by the the call to 
287
   // _cmRtDeliverMsgWithLock() below.
303
   // _cmRtDeliverMsgWithLock() below.
289
     if( cmRtNetReceive(cp->netH) != kOkNetRC )
305
     if( cmRtNetReceive(cp->netH) != kOkNetRC )
290
       _cmRtError(cp->p,kNetErrRtRC,"Network receive failed.");
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
   // if there are msgs waiting to be sent to the DSP process send them. 
312
   // if there are msgs waiting to be sent to the DSP process send them. 
297
   if( cp->cbEnableFl )
313
   if( cp->cbEnableFl )
298
     if( cmTsMp1cMsgWaiting(cp->htdQueueH) )
314
     if( cmTsMp1cMsgWaiting(cp->htdQueueH) )
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
 cmRtRC_t cmRtSysAllocate( cmRtSysH_t* hp, cmCtx_t* ctx )
559
 cmRtRC_t cmRtSysAllocate( cmRtSysH_t* hp, cmCtx_t* ctx )

Loading…
Cancel
Save