5
Last change
on this file since 469dc47 was
a1b4af4b,
checked in by Sebastian Huber <sebastian.huber@…>, on 07/20/15 at 07:05:30
|
score: Add scheduler <sys/lock.h> support
|
-
Property mode set to
100644
|
File size:
1.4 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 | #if HAVE_STRUCT__THREAD_QUEUE_QUEUE |
---|
24 | |
---|
25 | int _Sched_Count( void ) |
---|
26 | { |
---|
27 | return (int) _Scheduler_Count; |
---|
28 | } |
---|
29 | |
---|
30 | int _Sched_Index( void ) |
---|
31 | { |
---|
32 | Thread_Control *executing = _Thread_Get_executing(); |
---|
33 | |
---|
34 | return (int) _Scheduler_Get_index( _Scheduler_Get( executing ) ); |
---|
35 | } |
---|
36 | |
---|
37 | int _Sched_Name_to_index( const char *name, size_t len ) |
---|
38 | { |
---|
39 | uint32_t name_32 = 0; |
---|
40 | size_t i = 0; |
---|
41 | |
---|
42 | while ( i < 4 && i < len ) { |
---|
43 | name_32 |= ( (uint32_t) ( (uint8_t) *name ) ) << ( ( 3 - i ) * 8 ); |
---|
44 | ++name; |
---|
45 | ++i; |
---|
46 | } |
---|
47 | |
---|
48 | for ( i = 0 ; i < _Scheduler_Count ; ++i ) { |
---|
49 | const Scheduler_Control *scheduler = &_Scheduler_Table[ i ]; |
---|
50 | |
---|
51 | if ( scheduler->name == name_32 ) { |
---|
52 | return (int) i; |
---|
53 | } |
---|
54 | } |
---|
55 | |
---|
56 | return -1; |
---|
57 | } |
---|
58 | |
---|
59 | int _Sched_Processor_count( int index ) |
---|
60 | { |
---|
61 | size_t i = (size_t) index; |
---|
62 | |
---|
63 | if ( i < _Scheduler_Count ) { |
---|
64 | return _Scheduler_Get_processor_count( &_Scheduler_Table[ i ] ); |
---|
65 | } else { |
---|
66 | return 0; |
---|
67 | } |
---|
68 | } |
---|
69 | |
---|
70 | #endif /* HAVE_STRUCT__THREAD_QUEUE_QUEUE */ |
---|
Note: See
TracBrowser
for help on using the repository browser.