5
Last change
on this file since 2afb22b was
9fad437,
checked in by Sebastian Huber <sebastian.huber@…>, on 01/13/17 at 10:33:28
|
configure: Remove HAVE_STRUCTTHREAD_QUEUE_QUEUE
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /* |
---|
2 | * Copyright (c) 2015 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 <sys/lock.h> |
---|
20 | |
---|
21 | #include <rtems/score/schedulerimpl.h> |
---|
22 | |
---|
23 | int _Sched_Count( void ) |
---|
24 | { |
---|
25 | return (int) _Scheduler_Count; |
---|
26 | } |
---|
27 | |
---|
28 | int _Sched_Index( void ) |
---|
29 | { |
---|
30 | Thread_Control *executing = _Thread_Get_executing(); |
---|
31 | |
---|
32 | return (int) _Scheduler_Get_index( _Thread_Scheduler_get_home( executing ) ); |
---|
33 | } |
---|
34 | |
---|
35 | int _Sched_Name_to_index( const char *name, size_t len ) |
---|
36 | { |
---|
37 | uint32_t name_32 = 0; |
---|
38 | size_t i = 0; |
---|
39 | |
---|
40 | while ( i < 4 && i < len ) { |
---|
41 | name_32 |= ( (uint32_t) ( (uint8_t) *name ) ) << ( ( 3 - i ) * 8 ); |
---|
42 | ++name; |
---|
43 | ++i; |
---|
44 | } |
---|
45 | |
---|
46 | for ( i = 0 ; i < _Scheduler_Count ; ++i ) { |
---|
47 | const Scheduler_Control *scheduler = &_Scheduler_Table[ i ]; |
---|
48 | |
---|
49 | if ( scheduler->name == name_32 ) { |
---|
50 | return (int) i; |
---|
51 | } |
---|
52 | } |
---|
53 | |
---|
54 | return -1; |
---|
55 | } |
---|
56 | |
---|
57 | int _Sched_Processor_count( int index ) |
---|
58 | { |
---|
59 | size_t i = (size_t) index; |
---|
60 | |
---|
61 | if ( i < _Scheduler_Count ) { |
---|
62 | return _Scheduler_Get_processor_count( &_Scheduler_Table[ i ] ); |
---|
63 | } else { |
---|
64 | return 0; |
---|
65 | } |
---|
66 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.