targets/Xenomai/plc_Xenomai_main.c
changeset 617 7c23fac40a2a
parent 616 b9271faec96e
child 695 f378fe028f6c
equal deleted inserted replaced
616:b9271faec96e 617:7c23fac40a2a
   254 #define DEBUG_PENDING_DATA 1
   254 #define DEBUG_PENDING_DATA 1
   255 int WaitDebugData(unsigned long *tick)
   255 int WaitDebugData(unsigned long *tick)
   256 {
   256 {
   257     char cmd;
   257     char cmd;
   258     int res;
   258     int res;
   259     *tick = __debug_tick;
       
   260     /* Wait signal from PLC thread */
   259     /* Wait signal from PLC thread */
   261     res = read(WaitDebug_pipe_fd, &cmd, sizeof(cmd));
   260     res = read(WaitDebug_pipe_fd, &cmd, sizeof(cmd));
   262     if (res == sizeof(cmd) && cmd == DEBUG_PENDING_DATA)
   261     if (res == sizeof(cmd) && cmd == DEBUG_PENDING_DATA){
       
   262         *tick = __debug_tick;
   263         return 0;
   263         return 0;
       
   264     }
   264     return -1;
   265     return -1;
   265 }
   266 }
   266 
   267 
   267 /* Called by PLC thread when debug_publish finished
   268 /* Called by PLC thread when debug_publish finished
   268  * This is supposed to unlock debugger thread in WaitDebugData*/
   269  * This is supposed to unlock debugger thread in WaitDebugData*/
   286        if(read(Debug_pipe_fd, &cmd, sizeof(cmd)) != sizeof(cmd)){
   287        if(read(Debug_pipe_fd, &cmd, sizeof(cmd)) != sizeof(cmd)){
   287            return -1;
   288            return -1;
   288        }
   289        }
   289     }
   290     }
   290     __DEBUG = !disable;
   291     __DEBUG = !disable;
       
   292     if (disable)
       
   293         AtomicCompareExchange( &debug_state, DEBUG_BUSY, DEBUG_FREE);
   291     return 0;
   294     return 0;
   292 }
   295 }
   293 
   296 
   294 void resumeDebug(void)
   297 void resumeDebug(void)
   295 {
   298 {