Esempio n. 1
0
int deconnexion_sci_client(client_t *cl) {
  int ret;
  sci_error_t retval; 

  ret = SUCCESS;
  log_message("begining\n");
  if (cl->remote_fin_io_interrupt != NULL) {
    SCIDisconnectInterrupt(cl->remote_fin_io_interrupt, NO_FLAGS, &retval);
    if (retval != SCI_ERR_OK) ret = ERROR;
    cl->remote_fin_io_interrupt = NULL;
  }
  log_message("SCIDisconnectInterrupt(cl->remote_fin_io_interrupt) done\n");
  if (cl->remote_error_io_interrupt != NULL) {
    SCIDisconnectInterrupt(cl->remote_error_io_interrupt, NO_FLAGS, &retval);
    if (retval != SCI_ERR_OK) ret = ERROR;
    cl->remote_error_io_interrupt = NULL;
  }
  log_message("SCIDisconnectInterrupt(cl->remote_error_io_interrupt) done\n");
  if (cl->remote_ready_interrupt != NULL) {
    SCIDisconnectInterrupt(cl->remote_ready_interrupt, NO_FLAGS, &retval);
    if (retval != SCI_ERR_OK) ret = ERROR;
    cl->remote_ready_interrupt = NULL;
  }
  log_message("SCIDisconnectInterrupt(cl->remote_ready_interrupt) done\n");
  //SCIRemoveSequence(cl->seq_data_read_segment, NO_FLAGS, &retval);
  //if (retval != SCI_ERR_OK) ret = ERROR;

  if (cl->map_data_read_segment != NULL) {
    SCIUnmapSegment(cl->map_data_read_segment, NO_FLAGS, &retval);
    if (retval != SCI_ERR_OK) ret = ERROR;
    cl->map_data_read_segment = NULL;
  }
  log_message("SCIUnmapSegment(cl->map_data_read_segment) done\n");
  if (cl->rs_data_read_segment != NULL) {
    SCIDisconnectSegment(cl->rs_data_read_segment,  NO_FLAGS, &retval);
    if (retval != SCI_ERR_OK) ret = ERROR;   
    cl->rs_data_read_segment = NULL;
  }
  log_message("CIDisconnectSegment(cl->rs_data_read_segment) done\n");
  log_message("end: retval = %d",ret);

  return ret;

}
Esempio n. 2
0
sci_error_t SendInterrupt(sci_desc_t   sd,
	      Uint32 localAdapterNo, 
	      Uint32 localSciNodeId, 
	      Uint32 remoteSciNodeId,
	      Uint32 interruptNo){
  
  sci_error_t             error;
  sci_remote_interrupt_t  remoteInterrupt;
  Uint32 timeOut = SCI_INFINITE_TIMEOUT;

    // Now connect to the other sides interrupt flag 
    do {
      SCIConnectInterrupt(sd, &remoteInterrupt, remoteSciNodeId, localAdapterNo,
			  interruptNo, timeOut, NO_FLAGS, &error);
    } while (error != SCI_ERR_OK);
    
    if (error != SCI_ERR_OK) {
      fprintf(stderr, "SCIConnectInterrupt failed - Error code 0x%x\n", error);
      return error;
    } 

  // Trigger interrupt
  printf("\nNode %u sent interrupt (0x%x) to node %d\n",localSciNodeId, interruptNo, remoteSciNodeId);
  SCITriggerInterrupt(remoteInterrupt, NO_FLAGS, &error);
  if (error != SCI_ERR_OK) {
    fprintf(stderr, "SCITriggerInterrupt failed - Error code 0x%x\n", error);
    return error;
  } 
   

    // Disconnect and remove interrupts 
    SCIDisconnectInterrupt(remoteInterrupt, NO_FLAGS, &error);
    if (error != SCI_ERR_OK) {
      fprintf(stderr, "SCIDisconnectInterrupt failed - Error code 0x%x\n", error);
      return error; 
    }    

  return error;
}