drivers/timers_unix/timers_unix.c
changeset 508 08adb8d4b098
parent 507 c613e6cd34fa
child 540 6857b6ffb7a7
equal deleted inserted replaced
507:c613e6cd34fa 508:08adb8d4b098
    75 
    75 
    76 void canReceiveLoop_signal(int sig)
    76 void canReceiveLoop_signal(int sig)
    77 {
    77 {
    78 }
    78 }
    79 /* We assume that ReceiveLoop_task_proc is always the same */
    79 /* We assume that ReceiveLoop_task_proc is always the same */
    80 static void (*rtai_ReceiveLoop_task_proc)(CAN_PORT) = NULL;
    80 static void (*unixtimer_ReceiveLoop_task_proc)(CAN_PORT) = NULL;
    81 
    81 
    82 /**
    82 /**
    83  * Enter in realtime and start the CAN receiver loop
    83  * Enter in realtime and start the CAN receiver loop
    84  * @param port
    84  * @param port
    85  */
    85  */
    86 void unixtimer_canReceiveLoop(CAN_PORT port)
    86 void unixtimer_canReceiveLoop(CAN_PORT port)
    87 {
    87 {
    88        
    88        
    89     /*get signal*/
    89     /*get signal*/
    90     signal(SIGTERM, canReceiveLoop_signal);
    90     signal(SIGTERM, canReceiveLoop_signal);
    91     rtai_ReceiveLoop_task_proc(port);
    91     unixtimer_ReceiveLoop_task_proc(port);
    92 }
    92 }
    93 
    93 
    94 void CreateReceiveTask(CAN_PORT port, TASK_HANDLE* Thread, void* ReceiveLoopPtr)
    94 void CreateReceiveTask(CAN_PORT port, TASK_HANDLE* Thread, void* ReceiveLoopPtr)
    95 {
    95 {
    96 	pthread_create(Thread, NULL, ReceiveLoopPtr, (void*)port);
    96     unixtimer_ReceiveLoop_task_proc = ReceiveLoopPtr;
       
    97 	pthread_create(Thread, NULL, unixtimer_canReceiveLoop, (void*)port);
    97 }
    98 }
    98 
    99 
    99 void WaitReceiveTaskEnd(TASK_HANDLE *Thread)
   100 void WaitReceiveTaskEnd(TASK_HANDLE *Thread)
   100 {
   101 {
   101 	pthread_kill(*Thread, SIGTERM);
   102 	pthread_kill(*Thread, SIGTERM);