targets/Xenomai/plc_Xenomai_main.c
changeset 345 a3520d75a722
parent 342 80e5876bc53b
child 397 6a7ff66a811d
equal deleted inserted replaced
344:25b7b7f854bc 345:a3520d75a722
   206 extern int __tick;
   206 extern int __tick;
   207 /* from plc_debugger.c */
   207 /* from plc_debugger.c */
   208 int WaitDebugData()
   208 int WaitDebugData()
   209 {
   209 {
   210     char message;
   210     char message;
       
   211     int res;
   211     /* Wait signal from PLC thread */
   212     /* Wait signal from PLC thread */
   212     if (PLC_state & PLC_STATE_DEBUG_FILE_OPENED)
   213     if (PLC_state & PLC_STATE_DEBUG_FILE_OPENED) {
   213         read(WaitDebug_pipe_fd, &message, sizeof(char));
   214         res = read(WaitDebug_pipe_fd, &message, sizeof(char));
   214     return __debug_tick;
   215         if (res == sizeof(char))
       
   216             return __debug_tick;
       
   217     }
       
   218     return -1;
   215 }
   219 }
   216 
   220 
   217 /* Called by PLC thread when debug_publish finished
   221 /* Called by PLC thread when debug_publish finished
   218  * This is supposed to unlock debugger thread in WaitDebugData*/
   222  * This is supposed to unlock debugger thread in WaitDebugData*/
   219 void InitiateDebugTransfer()
   223 void InitiateDebugTransfer()
   250 int WaitPythonCommands(void)
   254 int WaitPythonCommands(void)
   251 {
   255 {
   252     /* Wait signal from PLC thread */
   256     /* Wait signal from PLC thread */
   253     if (PLC_state & PLC_STATE_PYTHON_WAIT_SEM_CREATED) {
   257     if (PLC_state & PLC_STATE_PYTHON_WAIT_SEM_CREATED) {
   254         rt_task_shadow(&WaitPythonCommand_task, "WaitPythonCommand_task", 0, 0);
   258         rt_task_shadow(&WaitPythonCommand_task, "WaitPythonCommand_task", 0, 0);
   255         rt_sem_p(&python_wait_sem, TM_INFINITE);
   259         return rt_sem_p(&python_wait_sem, TM_INFINITE);
   256     }
   260     }
       
   261     return -1;
   257 }
   262 }
   258 
   263 
   259 /* Called by PLC thread on each new python command*/
   264 /* Called by PLC thread on each new python command*/
   260 void UnBlockPythonCommands(void)
   265 void UnBlockPythonCommands(void)
   261 {
   266 {