RTEMS
scheduleridentbyprocessor.c
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 #ifdef HAVE_CONFIG_H
16 #include "config.h"
17 #endif
18 
19 #include <rtems/rtems/tasks.h>
20 #include <rtems/score/assert.h>
22 
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_maximum() ) {
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 }
static __inline__ const Scheduler_Control * _Scheduler_Get_by_CPU(const Per_CPU_Control *cpu)
Gets the scheduler for the cpu.
Definition: schedulerimpl.h:99
Inlined Routines Associated with the Manipulation of the Scheduler.
rtems_status_code rtems_scheduler_ident_by_processor(uint32_t cpu_index, rtems_id *id)
Identifies a scheduler instance by a processor index.
Information for the Assert Handler.
This status code indicates successful completion.
Definition: status.h:86
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
This status code indicates that an object was in wrong state for the requested operation.
Definition: status.h:160
This header file defines the main parts of the Tasks Manager API.
This status code indicates that a specified address was invalid.
Definition: status.h:133
static __inline__ Objects_Id _Scheduler_Build_id(uint32_t scheduler_index)
Builds an object build id.
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
Scheduler control.
Definition: scheduler.h:264
This status code indicates that an object name was invalid.
Definition: status.h:101
static __inline__ uint32_t _Scheduler_Get_index(const Scheduler_Control *scheduler)
Gets the index of the scheduler.
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG.
Definition: assert.h:100