X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/4dc78b4651f006bf0404c8ec7db85651bcee7c2e..04ac67cc3cac14cd601daacd0592121ec0b84012:/lincan/src/can_devrtl.c diff --git a/lincan/src/can_devrtl.c b/lincan/src/can_devrtl.c index f497307..585956c 100644 --- a/lincan/src/can_devrtl.c +++ b/lincan/src/can_devrtl.c @@ -60,7 +60,7 @@ unsigned int can_rtl_isr( unsigned int irq_num, struct pt_regs *r ) pthread_t thread=NULL; DEBUGMSG("can_rtl_isr invoked for irq %d\n",irq_num); - + /* I hate next loop, but RT-Linux does not provide context to ISR */ for (board_nr=hardware_p->nr_boards; board_nr--; ) { if((candev=hardware_p->candevice[board_nr])==NULL) @@ -107,10 +107,10 @@ RTL_MARK_READY(pthread_self()) RTL_MARK_SUSPENDED(pthread_self()); return rtl_schedule(); can_enable_irq -can_disable_irq +can_disable_irq rtl_critical( state ) rtl_end_critical( state ) -rtl_request_global_irq( irq, isr ); +rtl_request_global_irq( irq, isr ); rtl_free_global_irq( irq ) */ @@ -121,23 +121,23 @@ void * can_chip_worker_thread(void *arg) int ret, i; int loop_cnt; rtl_irqstate_t flags; - + if(!chip) return 0; - - + + if (!(chip->flags & CHIP_CONFIGURED)){ if (chip->chipspecops->chip_config(chip)) CANMSG("Error configuring chip.\n"); else - chip->flags |= CHIP_CONFIGURED; + chip->flags |= CHIP_CONFIGURED; if((chip->msgobj[0])!=NULL) if (chip->chipspecops->pre_read_config(chip,chip->msgobj[0])<0) CANMSG("Error initializing chip for receiving\n"); - + } /* End of chip configuration */ set_bit(MSGOBJ_IRQ_REQUEST_b,&chip->pend_flags); - + while (1) { DEBUGMSG("Worker thread for chip %d active\n",chip->chip_idx); @@ -180,7 +180,7 @@ void * can_chip_worker_thread(void *arg) * * irq_accept added to the LinCAN driver now, * and above workaround should not be required. - * Enable rtl_hard_enable_irq() at line + * Enable rtl_hard_enable_irq() at line * ca91c042.c:1045 */ #endif /*CAN_ENABLE_VME_SUPPORT*/ @@ -208,10 +208,10 @@ int can_chip_setup_irq(struct canchip_t *chip) struct sched_param sched_param; pthread_attr_t attrib; pthread_attr_t *attrib_p=NULL; - + if(chip==NULL) return -1; - + if(can_rtl_priority>=0){ pthread_attr_init(&attrib); sched_param.sched_priority = can_rtl_priority; @@ -219,7 +219,7 @@ int can_chip_setup_irq(struct canchip_t *chip) /* pthread_attr_setschedpolicy(&attrib, SCHED_FIFO); */ attrib_p=&attrib; } - + if(chip->chipspecops->irq_handler && !(chip->flags & CHIP_IRQ_CUSTOM)){ int (*my_request_irq)(unsigned int vector, unsigned int (*rtl_handler)(unsigned int irq, struct pt_regs *regs)); #ifdef CAN_ENABLE_VME_SUPPORT @@ -238,7 +238,7 @@ int can_chip_setup_irq(struct canchip_t *chip) } ret=pthread_create(&chip->worker_thread, attrib_p, can_chip_worker_thread, chip); if(ret<0) chip->worker_thread=NULL; - + return ret; }