Changeset b427a92 in rtems


Ignore:
Timestamp:
Apr 9, 2014, 8:09:24 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
1b67535d
Parents:
133d54c5
git-author:
Sebastian Huber <sebastian.huber@…> (04/09/14 08:09:24)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/15/14 07:29:31)
Message:

rtems: Add scheduler identification

Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/Makefile.am

    r133d54c5 rb427a92  
    117117endif
    118118librtems_a_SOURCES += src/taskdata.c
     119librtems_a_SOURCES += src/schedulerident.c
    119120
    120121## RATEMON_C_FILES
  • cpukit/rtems/include/rtems/rtems/tasks.h

    r133d54c5 rb427a92  
    549549rtems_id rtems_task_self(void);
    550550
     551/**
     552 * @brief Identifies a scheduler by its name.
     553 *
     554 * The scheduler name is determined by the scheduler configuration.
     555 *
     556 * @param[in] name The scheduler name.
     557 * @param[out] id The scheduler identifier associated with the name.
     558 *
     559 * @retval RTEMS_SUCCESSFUL Successful operation.
     560 * @retval RTEMS_INVALID_ADDRESS The @a id parameter is @c NULL.
     561 * @retval RTEMS_INVALID_NAME Invalid scheduler name.
     562 */
     563rtems_status_code rtems_scheduler_ident(
     564  rtems_name  name,
     565  rtems_id   *id
     566);
     567
    551568/**@}*/
    552569
  • cpukit/score/include/rtems/score/object.h

    r133d54c5 rb427a92  
    218218  OBJECTS_INTERNAL_API = 1,
    219219  OBJECTS_CLASSIC_API  = 2,
    220   OBJECTS_POSIX_API    = 3
     220  OBJECTS_POSIX_API    = 3,
     221  OBJECTS_FAKE_OBJECTS_API = 7
    221222} Objects_APIs;
    222223
  • cpukit/score/include/rtems/score/objectimpl.h

    r133d54c5 rb427a92  
    100100/** This macro is used to generically specify the last API index. */
    101101#define OBJECTS_POSIX_CLASSES_LAST OBJECTS_POSIX_RWLOCKS
     102
     103/*
     104 * For fake objects, which have an object identifier, but no objects
     105 * information block.
     106 */
     107typedef enum {
     108  OBJECTS_FAKE_OBJECTS_NO_CLASS   = 0,
     109  OBJECTS_FAKE_OBJECTS_SCHEDULERS = 1
     110} Objects_Fake_objects_API;
    102111
    103112/**
  • cpukit/score/include/rtems/score/schedulerimpl.h

    r133d54c5 rb427a92  
    452452}
    453453
     454RTEMS_INLINE_ROUTINE Objects_Id _Scheduler_Build_id( uint32_t scheduler_index )
     455{
     456  return _Objects_Build_id(
     457    OBJECTS_FAKE_OBJECTS_API,
     458    OBJECTS_FAKE_OBJECTS_SCHEDULERS,
     459    _Objects_Local_node,
     460    scheduler_index + 1
     461  );
     462}
     463
    454464/** @} */
    455465
  • testsuites/sptests/spscheduler01/init.c

    r133d54c5 rb427a92  
    2626const char rtems_test_name[] = "SPSCHEDULER 1";
    2727
    28 static rtems_id invalid_id = 1;
     28#define BLUE rtems_build_name('b', 'l', 'u', 'e')
     29
     30#define RED rtems_build_name('r', 'e', 'd', ' ')
     31
     32static const rtems_id invalid_id = 1;
    2933
    3034static void test_task_get_set_affinity(void)
     
    99103}
    100104
     105static void test_scheduler_ident(void)
     106{
     107  rtems_status_code sc;
     108  rtems_id expected_id = rtems_build_id(7, 1, 1, 1);
     109  rtems_id scheduler_id;
     110  rtems_name name = BLUE;
     111  rtems_name invalid_name = RED;
     112
     113  sc = rtems_scheduler_ident(name, NULL);
     114  rtems_test_assert(sc == RTEMS_INVALID_ADDRESS);
     115
     116  sc = rtems_scheduler_ident(invalid_name, &scheduler_id);
     117  rtems_test_assert(sc == RTEMS_INVALID_NAME);
     118
     119  scheduler_id = 0;
     120  sc = rtems_scheduler_ident(name, &scheduler_id);
     121  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     122
     123  rtems_test_assert(scheduler_id == expected_id);
     124}
     125
    101126static void Init(rtems_task_argument arg)
    102127{
     
    108133
    109134  test_task_get_set_affinity();
     135  test_scheduler_ident();
    110136
    111137  rtems_test_assert(rtems_resource_snapshot_check(&snapshot));
     
    126152#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
    127153
     154#define CONFIGURE_SCHEDULER_NAME BLUE
     155
    128156#define CONFIGURE_INIT
    129157
Note: See TracChangeset for help on using the changeset viewer.