sci_error_t ReceiveInterrupt(sci_desc_t sd, Uint32 localAdapterNo, Uint32 localSciNodeId, Uint32 interruptNo, Uint32 timeout) { sci_error_t error; sci_local_interrupt_t localInterrupt; Uint32 timeOut = SCI_INFINITE_TIMEOUT; // Create an interrupt SCICreateInterrupt(sd, &localInterrupt, localAdapterNo, &interruptNo, 0, NULL, SCI_FLAG_FIXED_INTNO, &error); if (error != SCI_ERR_OK) { fprintf(stderr, "SCICreateInterrupt failed - Error code 0x%x\n", error); return error; } // Wait for an interrupt SCIWaitForInterrupt(localInterrupt, timeOut, NO_FLAGS, &error); printf("\nNode %u received interrupt (0x%x)\n", localSciNodeId, interruptNo); // Remove interrupt SCIRemoveInterrupt(localInterrupt, NO_FLAGS, &error); if (error != SCI_ERR_OK) { fprintf(stderr, "SCIRemoveInterrupt failed - Error code 0x%x\n", error); return error; } return error; }
//! init les structures SCI associée au client. renvoie SUCCESS/ERROR. int init_localsci_client(client_t *cl, int no_sci_client) { sci_error_t retval; raz_sci_ptr(cl); if ((open_vd(&cl->vd_finio) != SUCCESS) || (open_vd(&cl->vd_debio) != SUCCESS) || (open_vd(&cl->vd_clready) != SUCCESS) || (open_vd(&cl->vd_errorio) != SUCCESS) || (open_vd(&cl->vd_ready) != SUCCESS) || (open_vd(&cl->vd_dataread) != SUCCESS) || (open_vd(&cl->vd_datareadtemp) != SUCCESS) || (open_vd(&cl->vd_datawrite) != SUCCESS) || (open_vd(&cl->vd_ctl) != SUCCESS)) { log_error("erreur SCIOpen à l'ouverture d'un des VD - %s\n", Sci_error(retval)); goto error; } // création des ressources SCI locales // allocation du segment controle et du segment donnees retval=sci_segment_create_and_export(cl->vd_datawrite, &cl->local_data_write_segment, &cl->local_data_write_map, &cl->local_data_write_address, real_id(no_sci_client,DATA_WRITE_SEG_ID), DATA_SEG_SIZE, cl); if (retval != SCI_ERR_OK) { log_error("can't create & export DATA_WRITE_SEG_ID : "); log_error("%s\n",Sci_error(retval)); goto error; } retval=sci_segment_create_and_export(cl->vd_ctl, &cl->local_ctl_segment, &cl->local_ctl_map, &cl->local_ctl_address, real_id(no_sci_client,CTL_SEG_ID), CTL_SEG_SIZE, cl); if (retval != SCI_ERR_OK) { log_error("can't create & export CTL_SEG_ID : "); log_error("%s\n",Sci_error(retval)); goto error; } retval=sci_segment_create_and_export(cl->vd_datareadtemp, &cl->local_read_temp_segment, &cl->local_read_temp_map, &cl->local_read_temp_address, real_id(no_sci_client,READ_TEMPSEG_ID), DATA_SEG_SIZE, cl); if (retval != SCI_ERR_OK) { log_error("can't create & export READ_TEMPSEG_ID : "); log_error("%s\n",Sci_error(retval)); goto error; } // allocation de l'IT debut d'I/O cl->interrupt_deb_io_no = real_id(no_sci_client,IT_BEG_IO); SCICreateInterrupt(cl->vd_debio, &cl->local_deb_io_interrupt, ADAPTER_NO, &cl->interrupt_deb_io_no, NO_CALLBACK, NO_ARG, SCI_FLAG_FIXED_INTNO, &retval); if (retval != SCI_ERR_OK) { log_error("erreur SCICreateInterrupt local_deb_io_interrupt\n"); log_error("%s\n",Sci_error(retval)); goto error; } log_message("interrupt IT_BEG_IO created\n"); // allocation de l'IT client READY cl->interrupt_clready_no = real_id(no_sci_client,IT_CLREADY); SCICreateInterrupt(cl->vd_clready, &cl->local_clready_interrupt, ADAPTER_NO, &cl->interrupt_clready_no, it_clready_cb, (void *) cl, SCI_FLAG_FIXED_INTNO | SCI_FLAG_USE_CALLBACK, &retval); if (retval != SCI_ERR_OK) { log_error("erreur SCICreateInterrupt local_clready interrupt\n"); log_error("%s\n",Sci_error(retval)); goto error; } log_message("interrupt IT_CLREADY created\n"); log_message("SCI configuré\n"); return SUCCESS; error: cleanupsci_client(cl); return ERROR; }