Changeset a0dee7c in rtems


Ignore:
Timestamp:
May 3, 2016, 7:59:50 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
b30ab25
Parents:
49a134d
git-author:
Sebastian Huber <sebastian.huber@…> (05/03/16 07:59:50)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/04/16 05:24:31)
Message:

score: Simplify _Thread_Get_interrupt_disable()

Remove the object location parameter.

Location:
cpukit
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/include/rtems/rtems/eventmp.h

    r49a134d ra0dee7c  
    4242/**@{*/
    4343
    44 /**
    45  *  The following enumerated type defines the list of
    46  *  remote event operations.
    47  */
    48 typedef enum {
    49   EVENT_MP_SEND_REQUEST  =  0,
    50   EVENT_MP_SEND_RESPONSE =  1
    51 }   Event_MP_Remote_operations;
    52 
    53 /**
    54  *  The following data structure defines the packet used to perform
    55  *  remote event operations.
    56  */
    57 typedef struct {
    58   rtems_packet_prefix         Prefix;
    59   Event_MP_Remote_operations  operation;
    60   rtems_event_set             event_in;
    61 }   Event_MP_Packet;
    62 
    6344/*
    6445 *  @brief Event_MP_Send_process_packet
     
    7253
    7354/**
    74  *  @brief Event MP Send Packet Request
    75  *
    76  *  This routine performs a remote procedure call so that a
    77  *  directive operation can be initiated on another node.
     55 * @brief Issues a remote rtems_event_send() request.
    7856 */
    79 rtems_status_code _Event_MP_Send_request_packet (
    80   Event_MP_Remote_operations operation,
    81   Objects_Id                 event_id,
    82   rtems_event_set         event_in
     57rtems_status_code _Event_MP_Send(
     58  rtems_id        id,
     59  rtems_event_set event_in
    8360);
    8461
  • cpukit/rtems/src/eventmp.c

    r49a134d ra0dee7c  
    2020
    2121#include <rtems/rtems/eventimpl.h>
    22 #include <rtems/score/objectimpl.h>
     22#include <rtems/score/threadimpl.h>
    2323#include <rtems/score/statesimpl.h>
     24
     25/**
     26 *  The following enumerated type defines the list of
     27 *  remote event operations.
     28 */
     29typedef enum {
     30  EVENT_MP_SEND_REQUEST  =  0,
     31  EVENT_MP_SEND_RESPONSE =  1
     32}   Event_MP_Remote_operations;
     33
     34/**
     35 *  The following data structure defines the packet used to perform
     36 *  remote event operations.
     37 */
     38typedef struct {
     39  rtems_packet_prefix         Prefix;
     40  Event_MP_Remote_operations  operation;
     41  rtems_event_set             event_in;
     42}   Event_MP_Packet;
    2443
    2544RTEMS_STATIC_ASSERT(
     
    2847);
    2948
    30 static Event_MP_Packet *_Event_MP_Get_packet( void )
     49static Event_MP_Packet *_Event_MP_Get_packet( Objects_Id id )
    3150{
     51  if ( !_Thread_MP_Is_remote( id ) ) {
     52    return NULL;
     53  }
     54
    3255  return (Event_MP_Packet *) _MPCI_Get_packet();
    3356}
    3457
    35 /*
    36  *  _Event_MP_Send_process_packet
    37  *
    38  *  This subprogram is not needed since there are no process
    39  *  packets to be sent by this manager.
    40  *
    41  */
    42 
    43 rtems_status_code _Event_MP_Send_request_packet (
    44   Event_MP_Remote_operations operation,
    45   Objects_Id                 event_id,
    46   rtems_event_set            event_in
     58rtems_status_code _Event_MP_Send(
     59  rtems_id        id,
     60  rtems_event_set event_in
    4761)
    4862{
    4963  Event_MP_Packet *the_packet;
    5064
    51   switch ( operation ) {
     65  the_packet = _Event_MP_Get_packet( id );
     66  if ( the_packet == NULL ) {
     67    return RTEMS_INVALID_ID;
     68  }
    5269
    53     case EVENT_MP_SEND_REQUEST:
     70  the_packet->Prefix.the_class  = MP_PACKET_EVENT;
     71  the_packet->Prefix.length     = sizeof ( *the_packet );
     72  the_packet->Prefix.to_convert = sizeof ( *the_packet );
     73  the_packet->operation         = EVENT_MP_SEND_REQUEST;
     74  the_packet->Prefix.id         = id;
     75  the_packet->event_in          = event_in;
    5476
    55       the_packet                    = _Event_MP_Get_packet();
    56       the_packet->Prefix.the_class  = MP_PACKET_EVENT;
    57       the_packet->Prefix.length     = sizeof ( Event_MP_Packet );
    58       the_packet->Prefix.to_convert = sizeof ( Event_MP_Packet );
    59       the_packet->operation         = operation;
    60       the_packet->Prefix.id         = event_id;
    61       the_packet->event_in          = event_in;
    62 
    63       return (rtems_status_code)
    64         _MPCI_Send_request_packet(
    65           _Objects_Get_node( event_id ),
    66           &the_packet->Prefix,
    67           STATES_READY,
    68           RTEMS_TIMEOUT
    69         );
    70 
    71       break;
    72 
    73     case EVENT_MP_SEND_RESPONSE:
    74       break;
    75 
    76   }
    77   /*
    78    *  The following line is included to satisfy compilers which
    79    *  produce warnings when a function does not end with a return.
    80    */
    81   return RTEMS_SUCCESSFUL;
     77  return (rtems_status_code) _MPCI_Send_request_packet(
     78    _Objects_Get_node( id ),
     79    &the_packet->Prefix,
     80    STATES_READY,
     81    RTEMS_TIMEOUT
     82  );
    8283}
    8384
  • cpukit/rtems/src/eventsend.c

    r49a134d ra0dee7c  
    2828)
    2929{
    30   rtems_status_code  sc;
    31   Thread_Control    *thread;
    32   Objects_Locations  location;
     30  Thread_Control    *the_thread;
    3331  RTEMS_API_Control *api;
    3432  ISR_lock_Context   lock_context;
    3533
    36   thread = _Thread_Get_interrupt_disable( id, &location, &lock_context );
    37   switch ( location ) {
    38     case OBJECTS_LOCAL:
    39       api = thread->API_Extensions[ THREAD_API_RTEMS ];
    40       sc = _Event_Surrender(
    41         thread,
    42         event_in,
    43         &api->Event,
    44         THREAD_WAIT_CLASS_EVENT,
    45         &lock_context
    46       );
    47       break;
    48 #ifdef RTEMS_MULTIPROCESSING
    49     case OBJECTS_REMOTE:
    50       sc = _Event_MP_Send_request_packet(
    51         EVENT_MP_SEND_REQUEST,
    52         id,
    53         event_in
    54       );
    55       break;
     34  the_thread = _Thread_Get_interrupt_disable( id, &lock_context );
     35
     36  if ( the_thread == NULL ) {
     37#if defined(RTEMS_MULTIPROCESSING)
     38    return _Event_MP_Send( id, event_in );
     39#else
     40    return RTEMS_INVALID_ID;
    5641#endif
    57     default:
    58       sc = RTEMS_INVALID_ID;
    59       break;
    6042  }
    6143
    62   return sc;
     44  api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
     45  return _Event_Surrender(
     46    the_thread,
     47    event_in,
     48    &api->Event,
     49    THREAD_WAIT_CLASS_EVENT,
     50    &lock_context
     51  );
    6352}
  • cpukit/rtems/src/systemeventsend.c

    r49a134d ra0dee7c  
    88
    99/*
    10  * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
     10 * Copyright (c) 2012, 2016 embedded brains GmbH.  All rights reserved.
    1111 *
    1212 *  embedded brains GmbH
    13  *  Obere Lagerstr. 30
     13 *  Dornierstr. 4
    1414 *  82178 Puchheim
    1515 *  Germany
     
    3434)
    3535{
    36   rtems_status_code  sc;
    37   Thread_Control    *thread;
    38   Objects_Locations  location;
     36  Thread_Control    *the_thread;
    3937  RTEMS_API_Control *api;
    4038  ISR_lock_Context   lock_context;
    4139
    42   thread = _Thread_Get_interrupt_disable( id, &location, &lock_context );
    43   switch ( location ) {
    44     case OBJECTS_LOCAL:
    45       api = thread->API_Extensions[ THREAD_API_RTEMS ];
    46       sc = _Event_Surrender(
    47         thread,
    48         event_in,
    49         &api->System_event,
    50         THREAD_WAIT_CLASS_SYSTEM_EVENT,
    51         &lock_context
    52       );
    53       break;
    54 #ifdef RTEMS_MULTIPROCESSING
    55     case OBJECTS_REMOTE:
    56       _Thread_Dispatch();
    57       sc = RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
    58       break;
     40  the_thread = _Thread_Get_interrupt_disable( id, &lock_context );
     41
     42  if ( the_thread == NULL ) {
     43#if defined(RTEMS_MULTIPROCESSING)
     44    if ( _Thread_MP_Is_remote( id ) ) {
     45      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
     46    }
    5947#endif
    60     default:
    61       sc = RTEMS_INVALID_ID;
    62       break;
     48
     49    return RTEMS_INVALID_ID;
    6350  }
    6451
    65   return sc;
     52  api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
     53  return _Event_Surrender(
     54    the_thread,
     55    event_in,
     56    &api->System_event,
     57    THREAD_WAIT_CLASS_SYSTEM_EVENT,
     58    &lock_context
     59  );
    6660}
  • cpukit/score/include/rtems/score/threadimpl.h

    r49a134d ra0dee7c  
    533533 * @brief Gets a thread by its identifier.
    534534 *
    535  * @see _Objects_Get_isr_disable().
     535 * @see _Objects_Get_local().
    536536 */
    537537Thread_Control *_Thread_Get_interrupt_disable(
    538538  Objects_Id         id,
    539   Objects_Locations *location,
    540539  ISR_lock_Context  *lock_context
    541540);
  • cpukit/score/src/threadget.c

    r49a134d ra0dee7c  
    4646Thread_Control *_Thread_Get_interrupt_disable(
    4747  Objects_Id         id,
    48   Objects_Locations *location,
    4948  ISR_lock_Context  *lock_context
    5049)
     
    5352
    5453  if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) {
    55     *location = OBJECTS_LOCAL;
    5654    _ISR_lock_ISR_disable( lock_context );
    5755    return _Thread_Executing;
     
    6058  information = _Thread_Get_objects_information( id );
    6159  if ( information == NULL ) {
    62     *location = OBJECTS_ERROR;
    6360    return NULL;
    6461  }
    6562
    6663  return (Thread_Control *)
    67     _Objects_Get_isr_disable( information, id, location, lock_context );
     64    _Objects_Get_local( id, lock_context, information );
    6865}
Note: See TracChangeset for help on using the changeset viewer.