source: rtems/cpukit/rtems/src/scheduleridentbyprocessor.c @ 66cb142

Last change on this file since 66cb142 was 548d65a, checked in by Sebastian Huber <sebastian.huber@…>, on Jul 11, 2017 at 5:24:39 AM

rtems: Add rtems_scheduler_ident_by_processor()

Update #3069.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 * Copyright (c) 2017 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/rtems/tasks.h>
20#include <rtems/score/assert.h>
21#include <rtems/score/schedulerimpl.h>
22
23rtems_status_code rtems_scheduler_ident_by_processor(
24  uint32_t  cpu_index,
25  rtems_id *id
26)
27{
28  const Scheduler_Control *scheduler;
29
30  if ( id == NULL ) {
31    return RTEMS_INVALID_ADDRESS;
32  }
33
34  if ( cpu_index >= _SMP_Get_processor_count() ) {
35    return RTEMS_INVALID_NAME;
36  }
37
38  scheduler = _Scheduler_Get_by_CPU( _Per_CPU_Get_by_index( cpu_index ) );
39#if defined(RTEMS_SMP)
40  if ( scheduler == NULL ) {
41    return RTEMS_INCORRECT_STATE;
42  }
43#else
44  _Assert( scheduler != NULL );
45#endif
46
47  *id = _Scheduler_Build_id( _Scheduler_Get_index( scheduler ) );
48  return RTEMS_SUCCESSFUL;
49}
Note: See TracBrowser for help on using the repository browser.