source: rtems/cpukit/rtems/src/scheduleridentbyprocessorset.c @ 6b5f22dc

Last change on this file since 6b5f22dc was 6b5f22dc, checked in by Sebastian Huber <sebastian.huber@…>, on 11/26/20 at 10:45:47

rtems: Canonicalize Doxygen @file comments

Use common phrases for the file brief descriptions.

Update #3706.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup RTEMSImplClassic
5 *
6 * @brief This source file contains the implementation of
7 *   rtems_scheduler_ident_by_processor_set().
8 */
9
10/*
11 * Copyright (c) 2017 embedded brains GmbH.  All rights reserved.
12 *
13 *  embedded brains GmbH
14 *  Dornierstr. 4
15 *  82178 Puchheim
16 *  Germany
17 *  <rtems@embedded-brains.de>
18 *
19 * The license and distribution terms for this file may be
20 * found in the file LICENSE in this distribution or at
21 * http://www.rtems.org/license/LICENSE.
22 */
23
24#ifdef HAVE_CONFIG_H
25#include "config.h"
26#endif
27
28#include <rtems/rtems/tasks.h>
29#include <rtems/score/assert.h>
30#include <rtems/score/schedulerimpl.h>
31
32rtems_status_code rtems_scheduler_ident_by_processor_set(
33  size_t           cpusetsize,
34  const cpu_set_t *cpuset,
35  rtems_id        *id
36)
37{
38  Processor_mask              set;
39  Processor_mask_Copy_status  status;
40  uint32_t                    cpu_index;
41  const Scheduler_Control    *scheduler;
42
43  if ( id == NULL ) {
44    return RTEMS_INVALID_ADDRESS;
45  }
46
47  status = _Processor_mask_From_cpu_set_t( &set, cpusetsize, cpuset );
48  if ( status == PROCESSOR_MASK_COPY_INVALID_SIZE ) {
49    return RTEMS_INVALID_SIZE;
50  }
51
52  _Processor_mask_And( &set, &set, _SMP_Get_online_processors() );
53  cpu_index = _Processor_mask_Find_last_set( &set );
54  if ( cpu_index == 0 ) {
55    return RTEMS_INVALID_NAME;
56  }
57
58  scheduler = _Scheduler_Get_by_CPU( _Per_CPU_Get_by_index( cpu_index - 1) );
59#if defined(RTEMS_SMP)
60  if ( scheduler == NULL ) {
61    return RTEMS_INCORRECT_STATE;
62  }
63#else
64  _Assert( scheduler != NULL );
65#endif
66
67  *id = _Scheduler_Build_id( _Scheduler_Get_index( scheduler ) );
68  return RTEMS_SUCCESSFUL;
69}
Note: See TracBrowser for help on using the repository browser.