예제 #1
0
파일: taskmp.c 프로젝트: ray-x/rtems
rtems_status_code _RTEMS_tasks_MP_Send_request_packet (
  RTEMS_tasks_MP_Remote_operations operation,
  Objects_Id                       task_id,
  rtems_task_priority              new_priority,
  uint32_t                         notepad,
  uint32_t                         note
)
{
  RTEMS_tasks_MP_Packet *the_packet;

  switch ( operation ) {

    case RTEMS_TASKS_MP_SUSPEND_REQUEST:
    case RTEMS_TASKS_MP_RESUME_REQUEST:
    case RTEMS_TASKS_MP_SET_PRIORITY_REQUEST:
    case RTEMS_TASKS_MP_GET_NOTE_REQUEST:
    case RTEMS_TASKS_MP_SET_NOTE_REQUEST:

      the_packet                    = _RTEMS_tasks_MP_Get_packet();
      the_packet->Prefix.the_class  = MP_PACKET_TASKS;
      the_packet->Prefix.length     = sizeof ( RTEMS_tasks_MP_Packet );
      the_packet->Prefix.to_convert = sizeof ( RTEMS_tasks_MP_Packet );
      the_packet->operation         = operation;
      the_packet->Prefix.id         = task_id;
      the_packet->the_priority      = new_priority;
      the_packet->notepad           = notepad;
      the_packet->note              = note;

      return _MPCI_Send_request_packet(
        _Objects_Get_node( task_id ),
        &the_packet->Prefix,
        STATES_READY,    /* Not used */
        RTEMS_TIMEOUT
      );
      break;

    case RTEMS_TASKS_MP_ANNOUNCE_CREATE:
    case RTEMS_TASKS_MP_ANNOUNCE_DELETE:
    case RTEMS_TASKS_MP_SUSPEND_RESPONSE:
    case RTEMS_TASKS_MP_RESUME_RESPONSE:
    case RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE:
    case RTEMS_TASKS_MP_GET_NOTE_RESPONSE:
    case RTEMS_TASKS_MP_SET_NOTE_RESPONSE:
      break;

  }
  /*
   *  The following line is included to satisfy compilers which
   *  produce warnings when a function does not end with a return.
   */
  return RTEMS_SUCCESSFUL;
}
예제 #2
0
rtems_status_code _Partition_MP_Send_request_packet (
  Partition_MP_Remote_operations  operation,
  Objects_Id                      partition_id,
  void                           *buffer
)
{
  Partition_MP_Packet *the_packet;

  switch ( operation ) {

    case PARTITION_MP_GET_BUFFER_REQUEST:
    case PARTITION_MP_RETURN_BUFFER_REQUEST:

      the_packet                    = _Partition_MP_Get_packet();
      the_packet->Prefix.the_class  = MP_PACKET_PARTITION;
      the_packet->Prefix.length     = sizeof ( Partition_MP_Packet );
      the_packet->Prefix.to_convert = sizeof ( Partition_MP_Packet );
      the_packet->operation         = operation;
      the_packet->Prefix.id         = partition_id;
      the_packet->buffer            = buffer;

      return
        _MPCI_Send_request_packet(
          _Objects_Get_node( partition_id ),
          &the_packet->Prefix,
          STATES_READY      /* Not used */
        );

      break;

    case PARTITION_MP_ANNOUNCE_CREATE:
    case PARTITION_MP_ANNOUNCE_DELETE:
    case PARTITION_MP_EXTRACT_PROXY:
    case PARTITION_MP_GET_BUFFER_RESPONSE:
    case PARTITION_MP_RETURN_BUFFER_RESPONSE:
      break;

  }
  /*
   *  The following line is included to satisfy compilers which
   *  produce warnings when a function does not end with a return.
   */
  return RTEMS_SUCCESSFUL;
}
예제 #3
0
static rtems_status_code _Partition_MP_Send_request_packet (
    Objects_Id                      partition_id,
    void                           *buffer,
    Partition_MP_Remote_operations  operation
)
{
    Partition_MP_Packet *the_packet;
    Status_Control       status;

    if ( !_Partition_MP_Is_remote( partition_id ) ) {
        return RTEMS_INVALID_ID;
    }

    switch ( operation ) {

    case PARTITION_MP_GET_BUFFER_REQUEST:
    case PARTITION_MP_RETURN_BUFFER_REQUEST:

        the_packet = _Partition_MP_Get_packet();
        _Partition_MP_Initialize_packet( the_packet, partition_id, operation );
        the_packet->buffer = buffer;

        status = _MPCI_Send_request_packet(
                     _Objects_Get_node( partition_id ),
                     &the_packet->Prefix,
                     STATES_READY /* Not used */
                 );
        return _Status_Get( status );

    case PARTITION_MP_ANNOUNCE_CREATE:
    case PARTITION_MP_ANNOUNCE_DELETE:
    case PARTITION_MP_EXTRACT_PROXY:
    case PARTITION_MP_GET_BUFFER_RESPONSE:
    case PARTITION_MP_RETURN_BUFFER_RESPONSE:
        break;

    }
    /*
     *  The following line is included to satisfy compilers which
     *  produce warnings when a function does not end with a return.
     */
    return RTEMS_SUCCESSFUL;
}
rtems_status_code _Event_MP_Send_request_packet (
  Event_MP_Remote_operations operation,
  Objects_Id                 event_id,
  rtems_event_set            event_in
)
{
  Event_MP_Packet *the_packet;

  switch ( operation ) {

    case EVENT_MP_SEND_REQUEST:

      the_packet                    = _Event_MP_Get_packet();
      the_packet->Prefix.the_class  = MP_PACKET_EVENT;
      the_packet->Prefix.length     = sizeof ( Event_MP_Packet );
      the_packet->Prefix.to_convert = sizeof ( Event_MP_Packet );
      the_packet->operation         = operation;
      the_packet->Prefix.id         = event_id;
      the_packet->event_in          = event_in;

      return (rtems_status_code)
        _MPCI_Send_request_packet(
          _Objects_Get_node( event_id ),
          &the_packet->Prefix,
          STATES_READY
        );

      break;

    case EVENT_MP_SEND_RESPONSE:
      break;

  }
  /*
   *  The following line is included to satisfy compilers which
   *  produce warnings when a function does not end with a return.
   */
  return RTEMS_SUCCESSFUL;
}
예제 #5
0
rtems_status_code _Signal_MP_Send_request_packet (
  Signal_MP_Remote_operations operation,
  Objects_Id                  task_id,
  rtems_signal_set            signal_in
)
{
  Signal_MP_Packet *the_packet;

  switch ( operation ) {

    case SIGNAL_MP_SEND_REQUEST:

      the_packet                    = _Signal_MP_Get_packet();
      the_packet->Prefix.the_class  = MP_PACKET_SIGNAL;
      the_packet->Prefix.length     = sizeof ( Signal_MP_Packet );
      the_packet->Prefix.to_convert = sizeof ( Signal_MP_Packet );
      the_packet->operation         = operation;
      the_packet->Prefix.id         = task_id;
      the_packet->signal_in         = signal_in;

      return _MPCI_Send_request_packet(
        _Objects_Get_node( task_id ),
        &the_packet->Prefix,
        STATES_READY   /* Not used */
      );
      break;

    case SIGNAL_MP_SEND_RESPONSE:
      break;

  }
  /*
   *  The following line is included to satisfy compilers which
   *  produce warnings when a function does not end with a return.
   */
  return RTEMS_INTERNAL_ERROR;
}
예제 #6
0
파일: msgmp.c 프로젝트: Avanznow/rtems
rtems_status_code _Message_queue_MP_Send_request_packet (
  Message_queue_MP_Remote_operations  operation,
  Objects_Id                          message_queue_id,
  const void                         *buffer,
  size_t                             *size_p,
  rtems_option                        option_set,
  rtems_interval                      timeout
)
{
  Message_queue_MP_Packet *the_packet;

  switch ( operation ) {

    case MESSAGE_QUEUE_MP_SEND_REQUEST:
    case MESSAGE_QUEUE_MP_URGENT_REQUEST:
    case MESSAGE_QUEUE_MP_BROADCAST_REQUEST:
    case MESSAGE_QUEUE_MP_FLUSH_REQUEST:
    case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST:

      the_packet                    = _Message_queue_MP_Get_packet();
      the_packet->Prefix.the_class  = MP_PACKET_MESSAGE_QUEUE;
      the_packet->Prefix.length     = MESSAGE_QUEUE_MP_PACKET_SIZE;
      if ( size_p )
        the_packet->Prefix.length     += *size_p;
      the_packet->Prefix.to_convert = MESSAGE_QUEUE_MP_PACKET_SIZE;

      /*
       * make sure message is not too big for our MPCI driver
       * We have to check it here instead of waiting for MPCI because
       * we are about to slam in the payload
       */

      if (the_packet->Prefix.length > _MPCI_table->maximum_packet_size) {
          return RTEMS_INVALID_SIZE;
      }

      if (! _Options_Is_no_wait(option_set))
          the_packet->Prefix.timeout = timeout;

      the_packet->operation  = operation;
      the_packet->Prefix.id  = message_queue_id;
      the_packet->option_set = option_set;

      /*
       * Copy the data into place if needed
       */

      if (buffer) {
          the_packet->Buffer.size = *size_p;
          _CORE_message_queue_Copy_buffer(
            buffer,
            the_packet->Buffer.buffer,
            *size_p
          );
      }

      return (rtems_status_code) _MPCI_Send_request_packet(
        _Objects_Get_node(message_queue_id),
        &the_packet->Prefix,
        STATES_WAITING_FOR_MESSAGE,
        RTEMS_TIMEOUT
      );
      break;

    case MESSAGE_QUEUE_MP_RECEIVE_REQUEST:

      the_packet                    = _Message_queue_MP_Get_packet();
      the_packet->Prefix.the_class  = MP_PACKET_MESSAGE_QUEUE;
      the_packet->Prefix.length     = MESSAGE_QUEUE_MP_PACKET_SIZE;
      the_packet->Prefix.to_convert = MESSAGE_QUEUE_MP_PACKET_SIZE;

      if (! _Options_Is_no_wait(option_set))
          the_packet->Prefix.timeout = timeout;

      the_packet->operation  = MESSAGE_QUEUE_MP_RECEIVE_REQUEST;
      the_packet->Prefix.id  = message_queue_id;
      the_packet->option_set = option_set;
      the_packet->size       = 0;        /* just in case of an error */

      _Thread_Executing->Wait.return_argument_second.immutable_object = buffer;
      _Thread_Executing->Wait.return_argument = size_p;

      return (rtems_status_code) _MPCI_Send_request_packet(
        _Objects_Get_node(message_queue_id),
        &the_packet->Prefix,
        STATES_WAITING_FOR_MESSAGE,
        RTEMS_TIMEOUT
      );
      break;

    case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE:
    case MESSAGE_QUEUE_MP_ANNOUNCE_DELETE:
    case MESSAGE_QUEUE_MP_EXTRACT_PROXY:
    case MESSAGE_QUEUE_MP_RECEIVE_RESPONSE:
    case MESSAGE_QUEUE_MP_SEND_RESPONSE:
    case MESSAGE_QUEUE_MP_URGENT_RESPONSE:
    case MESSAGE_QUEUE_MP_BROADCAST_RESPONSE:
    case MESSAGE_QUEUE_MP_FLUSH_RESPONSE:
    case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_RESPONSE:
      break;
  }

  return RTEMS_SUCCESSFUL;
}