2222// <www.state-machine.com>
23232424//============================================================================
25- //! @date Last updated on: 2024-02-16
26- //! @version Last updated for: @ref qpc_7_3_3
25+ //! @date Last updated on: 2024-06-11
26+ //! @version Last updated for: @ref qpc_7_4_0
2727//!
2828//! @file
2929//! @brief QS/C "port" to QUTest with POSIX
6161#define INVALID_SOCKET -1
6262#define SOCKET_ERROR -1
6363
64- // Q_DEFINE_THIS_MODULE("qutest_port")
64+ Q_DEFINE_THIS_MODULE ("qutest_port" )
6565
6666// local variables ...........................................................
6767static int l_sock = INVALID_SOCKET ;
@@ -112,6 +112,8 @@ uint8_t QS_onStartup(void const *arg) {
112112 if (* src == ':' ) {
113113 serviceName = src + 1 ;
114114 }
115+ //printf("<TARGET> Connecting to QSPY on Host=%s:%s...\n",
116+ // hostName, serviceName);
115117
116118 memset (& hints , 0 , sizeof (hints ));
117119 hints .ai_family = AF_INET ;
@@ -243,19 +245,20 @@ void QS_onFlush(void) {
243245 nBytes = QS_TX_CHUNK ;
244246 }
245247}
248+
246249//............................................................................
247250void QS_onTestLoop () {
248251 fd_set readSet ;
249252 FD_ZERO (& readSet );
250253
251- struct timeval timeout = {
252- (long )0 , (long )(QS_TIMEOUT_MS * 1000 )
253- };
254-
255254 QS_rxPriv_ .inTestLoop = true;
256255 while (QS_rxPriv_ .inTestLoop ) {
257256 FD_SET (l_sock , & readSet );
258257
258+ struct timeval timeout = {
259+ (long )0 , (long )(QS_TIMEOUT_MS * 1000 )
260+ };
261+
259262 // selective, timed blocking on the TCP/IP socket...
260263 timeout .tv_usec = (long )(QS_TIMEOUT_MS * 1000 );
261264 int status = select (l_sock + 1 , & readSet ,
@@ -270,7 +273,7 @@ void QS_onTestLoop() {
270273 (char * )QS_rxPriv_ .buf , (int )QS_rxPriv_ .end , 0 );
271274 if (status > 0 ) { // any data received?
272275 QS_rxPriv_ .tail = 0U ;
273- QS_rxPriv_ .head = status ; // # bytes received
276+ QS_rxPriv_ .head = ( QSCtr ) status ; // # bytes received
274277 QS_rxParse (); // parse all received bytes
275278 }
276279 }
@@ -282,3 +285,17 @@ void QS_onTestLoop() {
282285 QS_rxPriv_ .inTestLoop = true;
283286}
284287
288+ //............................................................................
289+ void QS_onIntDisable (void ) {
290+ if (QS_tstPriv_ .intLock != 0U ) {
291+ Q_onError (& Q_this_module_ [0 ], 998 );
292+ }
293+ ++ QS_tstPriv_ .intLock ;
294+ }
295+ //............................................................................
296+ void QS_onIntEnable (void ) {
297+ -- QS_tstPriv_ .intLock ;
298+ if (QS_tstPriv_ .intLock != 0U ) {
299+ Q_onError (& Q_this_module_ [0 ], 999 );
300+ }
301+ }
0 commit comments