void pulse_init(dispatch_t *dpp, IOFUNC_ATTR_T *pattr) { das_info_typ *pinfo = &pattr->das_info; das_func_t *pfunc = &pattr->func; struct sigevent *pevent; /// attach pulse to be sent by interrupt handler if (pinfo->irq != 0) { pevent = &pattr->ad_pulse_event; if ((pevent->sigev_code = pulse_attach(dpp, MSG_FLAG_ALLOC_PULSE, 0, pfunc->ad_pulse, &pattr->ad_ocb)) == ERROR) { fprintf(stderr, "Unable to attach irq_handler pulse.\n"); exit(EXIT_FAILURE); } if ((pevent->sigev_coid = message_connect(dpp, MSG_FLAG_SIDE_CHANNEL)) == ERROR) { fprintf(stderr, "Unable to attach pulse to channel.\n"); exit(EXIT_FAILURE); } pevent->sigev_notify = SIGEV_PULSE; pevent->sigev_priority = -1; pevent->sigev_value.sival_int = 0; #ifdef DO_TRACE printf("DAS_INIT.C:pulse_init: DMM32 interrupt pulse attached: sigev_code %d sigev_coid %#x\n", pevent->sigev_code, pevent->sigev_coid); #endif } /// attach pulse to be sent by timer interrupt to resource manager if (pfunc->tmr_pulse != NULL) { pevent = &pattr->tmr_pulse_event; if ((pevent->sigev_code = pulse_attach(dpp, MSG_FLAG_ALLOC_PULSE, 0, pfunc->tmr_pulse, &pattr->ad_ocb)) == ERROR) { fprintf(stderr, "Unable to attach timer pulse.\n"); exit(EXIT_FAILURE); } if ((pevent->sigev_coid = message_connect(dpp, MSG_FLAG_SIDE_CHANNEL)) == ERROR) { fprintf(stderr, "Unable to attach pulse to channel.\n"); exit(EXIT_FAILURE); } pevent->sigev_notify = SIGEV_PULSE; pevent->sigev_priority = -1; pevent->sigev_value.sival_int = 0; #ifdef DO_TRACE printf("DAS_INIT.C:pulse_init: Timer interrupt pulse attached: sigev_code %d sigev_coid %#x\n", pevent->sigev_code, pevent->sigev_coid); #endif } }
void bootimage_init(void) { int code; if(imagefs_mount_mounter() == -1) { crash(); } code = pulse_attach(dpp, MSG_FLAG_ALLOC_PULSE, 0, bootimage_start, NULL); if(code == -1) { crash(); } MsgSendPulse(PROCMGR_COID, PROC_INIT_PRIORITY, code, 0); }