Пример #1
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;
}
Пример #2
0
int connexion_sci_client(client_t *cl) {
  int seg_size;
  sci_error_t retval; 
  int ret;
  
  ret = SUCCESS;

  log_message("beginning - no_sci client = %d\n", cl->no_sci);
  log_message("connection to IT END_IO %ld on node %d\n",
	      real_id(smdsv.THIS_NODE_ID,IT_END_IO) , 
	      cl->no_sci);
  SCIConnectInterrupt(cl->vd_finio, 
		      &cl->remote_fin_io_interrupt, 
		      cl->no_sci, ADAPTER_NO,
		      real_id(smdsv.THIS_NODE_ID,IT_END_IO), 
		      SCI_INFINITE_TIMEOUT,
		      NO_FLAGS,&retval);
  if (retval != SCI_ERR_OK) {
    log_error(" SCIConnectInterrupt IT_END_IO failed\n");
    log_error("%s\n",Sci_error(retval));
    ret = ERROR;
  }
  log_message("connection succeeded\n");
  
  log_message("connection to IT ERROR_IO %ld on node %d\n",
	      real_id(smdsv.THIS_NODE_ID,IT_ERROR_IO) , 
	      cl->no_sci);
  SCIConnectInterrupt(cl->vd_errorio, 
		      &cl->remote_error_io_interrupt, 
		      cl->no_sci, ADAPTER_NO,
		      real_id(smdsv.THIS_NODE_ID,IT_ERROR_IO), 
		      SCI_INFINITE_TIMEOUT,
		      NO_FLAGS,&retval);
  if (retval != SCI_ERR_OK) {
    log_error(" SCIConnectInterrupt IT_ERROR_IO failed\n");
    log_error("%s\n",Sci_error(retval));
    ret = ERROR;
  }
  log_message("connection succeeded\n");


  log_message("connection to IT READY %ld on node %d\n",
	      real_id(smdsv.THIS_NODE_ID,IT_READY) , 
	      cl->no_sci);
  SCIConnectInterrupt(cl->vd_ready, 
		      &cl->remote_ready_interrupt, 
		      cl->no_sci, ADAPTER_NO,
		      real_id(smdsv.THIS_NODE_ID,IT_READY), 
		      SCI_INFINITE_TIMEOUT,
		      NO_FLAGS,&retval);
  if (retval != SCI_ERR_OK) {
    log_error(" SCIConnectInterrupt IT_READY failed\n");
    log_error("%s\n",Sci_error(retval));
    ret = ERROR;
  }
  log_message("connection succeeded\n");
 
  log_message("connection to seg DATA_READ_SEG_ID %ld on node %d (cb_arg=%p)\n", 
	      real_id(smdsv.THIS_NODE_ID, DATA_READ_SEG_ID), 
	      cl->no_sci,
	      cl);
  SCIConnectSegment(cl->vd_dataread, 
		    &cl->rs_data_read_segment, 
		    cl->no_sci, 
		    real_id(smdsv.THIS_NODE_ID, DATA_READ_SEG_ID),
		    ADAPTER_NO,
		    remote_segment_cb,
		    (void *)cl,
		    SCI_INFINITE_TIMEOUT,
		    SCI_FLAG_USE_CALLBACK,
		    &retval);
  
  if (retval != SCI_ERR_OK) {
    log_error(" SCIConnectSegment DATA_READ_SEG_ID failed\n");
    log_error("%s\n",Sci_error(retval));
    ret = ERROR;
  }

  seg_size = SCIGetRemoteSegmentSize(cl->rs_data_read_segment);

  log_message("connection succeeded seg %ld size = %d  bytes \n",
	      real_id(smdsv.THIS_NODE_ID, DATA_READ_SEG_ID), 
	      seg_size); 

   cl->addr_data_read_segment =
     (volatile int*)SCIMapRemoteSegment(cl->rs_data_read_segment, 
					&cl->map_data_read_segment,
					0 /* offset */,
					seg_size,
					0 /* address hint */,
					NO_FLAGS, 
					&retval);
  if (retval != SCI_ERR_OK) {
    log_error("SCIMapRemoteSegment DATA_READ_SEG_ID failed\n");
    log_error("%s\n",Sci_error(retval));
    ret = ERROR;
  }
  
  /* SCICreateMapSequence(cl->map_data_read_segment,
		       &cl->seq_data_read_segment,
		       NO_FLAGS,
		       &retval);
  
  if (retval != SCI_ERR_OK) {
    log_message("SCICreateMapSequenceDATA_READ_SEG_ID failed\n");
    log_message("%s\n",Sci_error(retval));
    ret = ERROR;
    }*/
 
  return ret;
}