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; }
//! libère les structures sci associées au client. Renvoie SUCCESS/ERROR. int cleanupsci_client(client_t *cl) { sci_error_t retval; int ret; ret = SUCCESS; log_message("cleaning up SCI resources for client SCI '%d'\n", cl->no_sci); // désallocation des segments de mémoire partagée if (cl->local_ctl_segment != NULL) { SCISetSegmentUnavailable(cl->local_ctl_segment, ADAPTER_NO, NO_FLAGS, &retval); if (retval != SCI_ERR_OK) ret = ERROR; } if (cl->local_data_write_segment != NULL) { SCISetSegmentUnavailable(cl->local_data_write_segment, ADAPTER_NO, NO_FLAGS, &retval); if (retval != SCI_ERR_OK) ret = ERROR; } if (cl->local_ctl_segment != NULL) { SCIRemoveSegment(cl->local_ctl_segment, NO_FLAGS, &retval); if (retval != SCI_ERR_OK) ret = ERROR; } if (cl->local_data_write_segment != NULL) { SCIRemoveSegment(cl->local_data_write_segment, NO_FLAGS, &retval); if (retval != SCI_ERR_OK) ret = ERROR; } if (cl->local_read_temp_segment != NULL) { SCIRemoveSegment(cl->local_read_temp_segment, NO_FLAGS, &retval); if (retval != SCI_ERR_OK) ret = ERROR; } // desallocation des IT if (cl->local_deb_io_interrupt != NULL) { SCIRemoveInterrupt(cl->local_deb_io_interrupt, NO_FLAGS, &retval); if (retval != SCI_ERR_OK) ret = ERROR; } if (cl->local_clready_interrupt != NULL) { SCIRemoveInterrupt(cl->local_clready_interrupt, NO_FLAGS, &retval); if (retval != SCI_ERR_OK) ret = ERROR; } retval = deconnexion_sci_client(cl); if (retval == ERROR) { log_error("pb pour se déconnecter des ressources SCI du client " "SCI n°'%d'\n", cl->no_sci); ret = ERROR; } if ((close_vd(&cl->vd_finio) != SUCCESS) || (close_vd(&cl->vd_debio) != SUCCESS) || (close_vd(&cl->vd_clready) != SUCCESS) || (close_vd(&cl->vd_errorio) != SUCCESS) || (close_vd(&cl->vd_ready) != SUCCESS) || (close_vd(&cl->vd_dataread) != SUCCESS) || (close_vd(&cl->vd_datareadtemp) != SUCCESS) || (close_vd(&cl->vd_datawrite) != SUCCESS) || (close_vd(&cl->vd_ctl) != SUCCESS)) ret = ERROR; raz_sci_ptr(cl); return ret; }