mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-11-16 04:24:45 +00:00
Compare commits
14 Commits
contrib/cp
...
6.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a46769ba4 | ||
|
|
f7de6d5425 | ||
|
|
34ba74f4f4 | ||
|
|
d61a739e41 | ||
|
|
a357119bd6 | ||
|
|
e79dc64c8e | ||
|
|
7f00921b07 | ||
|
|
63c5d062c3 | ||
|
|
65e480312c | ||
|
|
78e5e76572 | ||
|
|
5eb938283d | ||
|
|
e565dbba65 | ||
|
|
106d00537e | ||
|
|
c529694656 |
@@ -315,12 +315,6 @@ rtems_aio_request *init_read_req( struct aiocb* aiocbp );
|
||||
*/
|
||||
void rtems_aio_completed_list_op( listcb *listcbp );
|
||||
|
||||
/**
|
||||
* @brief generates event at list completion to end wait in lio_listio().
|
||||
*
|
||||
*/
|
||||
void lio_notify_end_wait( union sigval attr );
|
||||
|
||||
#ifdef RTEMS_DEBUG
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
@@ -435,6 +435,15 @@ extern "C" {
|
||||
*/
|
||||
typedef uint32_t rtems_event_set;
|
||||
|
||||
/* Generated from spec:/rtems/event/if/system-lio-list-completed */
|
||||
|
||||
/**
|
||||
* @brief This event set constant represents the reserved system event
|
||||
* internally used to notify list completion when lio_listio is called using
|
||||
* LIO_WAIT.
|
||||
*/
|
||||
#define RTEMS_EVENT_SYSTEM_LIO_LIST_COMPLETED RTEMS_EVENT_28
|
||||
|
||||
/* Generated from spec:/rtems/event/if/system-network-close */
|
||||
|
||||
/**
|
||||
@@ -536,12 +545,6 @@ rtems_status_code rtems_event_system_send(
|
||||
*/
|
||||
#define RTEMS_EVENT_SYSTEM_SERVER RTEMS_EVENT_30
|
||||
|
||||
/**
|
||||
* @brief This event set constant represents the reserved system event for
|
||||
* aio list completion, used when lio_listio is called using LIO_WAIT.
|
||||
*/
|
||||
#define RTEMS_EVENT_SYSTEM_AIO_LIST RTEMS_EVENT_28
|
||||
|
||||
/* Generated from spec:/rtems/event/if/system-server-resume */
|
||||
|
||||
/**
|
||||
|
||||
@@ -335,7 +335,9 @@ static inline void _Priority_Set_action_node(
|
||||
Priority_Node *node
|
||||
)
|
||||
{
|
||||
#if defined(RTEMS_SMP)
|
||||
_Assert( aggregation->Action.next == NULL );
|
||||
#endif
|
||||
aggregation->Action.node = node;
|
||||
}
|
||||
|
||||
@@ -350,7 +352,9 @@ static inline void _Priority_Set_action_type(
|
||||
Priority_Action_type type
|
||||
)
|
||||
{
|
||||
#if defined(RTEMS_SMP)
|
||||
_Assert( aggregation->Action.next == NULL );
|
||||
#endif
|
||||
aggregation->Action.type = type;
|
||||
}
|
||||
|
||||
@@ -368,7 +372,9 @@ static inline void _Priority_Set_action(
|
||||
Priority_Action_type type
|
||||
)
|
||||
{
|
||||
#if defined(RTEMS_SMP)
|
||||
_Assert( aggregation->Action.next == NULL );
|
||||
#endif
|
||||
aggregation->Action.node = node;
|
||||
aggregation->Action.type = type;
|
||||
}
|
||||
|
||||
@@ -942,6 +942,12 @@ static inline Status_Control _Scheduler_Set(
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(RTEMS_SCORE_THREAD_HAS_SCHEDULER_CHANGE_INHIBITORS)
|
||||
if ( the_thread->is_scheduler_change_inhibited ) {
|
||||
return STATUS_RESOURCE_IN_USE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( the_thread->Wait.queue != NULL ) {
|
||||
return STATUS_RESOURCE_IN_USE;
|
||||
}
|
||||
|
||||
@@ -96,9 +96,32 @@ extern "C" {
|
||||
*/
|
||||
|
||||
#if defined(RTEMS_DEBUG)
|
||||
/**
|
||||
* @brief This define enables the thread resource count support.
|
||||
*/
|
||||
#define RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT
|
||||
#endif
|
||||
|
||||
#if defined(RTEMS_POSIX_API)
|
||||
/**
|
||||
* @brief This define enables support for an inactive real thread priority.
|
||||
*
|
||||
* For example, the POSIX sporadic server may temporarily remove the real
|
||||
* priority of a thread while it is in low priority mode.
|
||||
*/
|
||||
#define RTEMS_SCORE_THREAD_REAL_PRIORITY_MAY_BE_INACTIVE
|
||||
#endif
|
||||
|
||||
#if defined(RTEMS_POSIX_API) && defined(RTEMS_SMP)
|
||||
/**
|
||||
* @brief This define enables support to inhibit scheduler changes.
|
||||
*
|
||||
* For example, the POSIX sporadic server adds a second priority to a thread.
|
||||
* We cannot account for this priority in a scheduler change.
|
||||
*/
|
||||
#define RTEMS_SCORE_THREAD_HAS_SCHEDULER_CHANGE_INHIBITORS
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Type of the numeric argument of a thread entry function with at
|
||||
* least one numeric argument.
|
||||
@@ -898,6 +921,16 @@ struct _Thread_Control {
|
||||
*/
|
||||
bool was_created_with_inherited_scheduler;
|
||||
|
||||
#if defined(RTEMS_SCORE_THREAD_HAS_SCHEDULER_CHANGE_INHIBITORS)
|
||||
/**
|
||||
* @brief This field is true, if scheduler changes are inhibited.
|
||||
*
|
||||
* Currently, the POSIX sporadic server is the only inhibitor. If more are
|
||||
* added, then this needs to be changed to a counter or a bit field.
|
||||
*/
|
||||
bool is_scheduler_change_inhibited;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief This member contains the CPU budget control used to manage the CPU
|
||||
* budget of the thread.
|
||||
|
||||
@@ -800,6 +800,14 @@ static inline void _Thread_Priority_change(
|
||||
)
|
||||
{
|
||||
_Priority_Node_set_priority( priority_node, new_priority );
|
||||
|
||||
#if defined(RTEMS_SCORE_THREAD_REAL_PRIORITY_MAY_BE_INACTIVE)
|
||||
if ( !_Priority_Node_is_active( priority_node ) ) {
|
||||
/* The priority change is picked up once the node is added */
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
_Thread_Priority_changed(
|
||||
the_thread,
|
||||
priority_node,
|
||||
|
||||
@@ -114,7 +114,7 @@ int rtems_jffs2_compressor_rtime_decompress(
|
||||
positions[value]=outpos;
|
||||
if (repeat) {
|
||||
#ifdef __rtems__
|
||||
if ((repeat + outpos) >= destlen) {
|
||||
if ((repeat + outpos) > destlen) {
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -271,7 +271,7 @@ void rtems_aio_completed_list_op( listcb *listcbp )
|
||||
case AIO_LIO_EVENT:
|
||||
rtems_event_system_send(
|
||||
listcbp->lio_notification.task_id,
|
||||
RTEMS_EVENT_SYSTEM_AIO_LIST
|
||||
RTEMS_EVENT_SYSTEM_LIO_LIST_COMPLETED
|
||||
);
|
||||
break;
|
||||
}
|
||||
@@ -821,10 +821,3 @@ static void rtems_aio_handle_helper( rtems_aio_request *req )
|
||||
}
|
||||
}
|
||||
|
||||
void lio_notify_end_wait( union sigval attr ){
|
||||
rtems_id id = attr.sival_int;
|
||||
rtems_event_set event_in = RTEMS_EVENT_SYSTEM_AIO_LIST;
|
||||
|
||||
rtems_event_system_send( id, event_in );
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ int lio_listio(
|
||||
} else if ( mode == LIO_WAIT ) {
|
||||
rtems_event_set event_out;
|
||||
rtems_event_system_receive(
|
||||
RTEMS_EVENT_SYSTEM_AIO_LIST,
|
||||
RTEMS_EVENT_SYSTEM_LIO_LIST_COMPLETED,
|
||||
RTEMS_DEFAULT_OPTIONS,
|
||||
RTEMS_NO_TIMEOUT,
|
||||
&event_out
|
||||
|
||||
@@ -301,6 +301,9 @@ int pthread_create(
|
||||
the_attr->schedparam.sched_ss_max_repl;
|
||||
|
||||
if ( schedpolicy == SCHED_SPORADIC ) {
|
||||
#if defined(RTEMS_SCORE_THREAD_HAS_SCHEDULER_CHANGE_INHIBITORS)
|
||||
the_thread->is_scheduler_change_inhibited = true;
|
||||
#endif
|
||||
_POSIX_Threads_Sporadic_timer( &api->Sporadic.Timer );
|
||||
}
|
||||
#endif
|
||||
@@ -348,7 +351,7 @@ void _POSIX_Threads_Sporadic_timer( Watchdog_Control *watchdog )
|
||||
_Thread_queue_Context_clear_priority_updates( &queue_context );
|
||||
_Thread_Wait_acquire( the_thread, &queue_context );
|
||||
|
||||
if ( _Priority_Node_is_active( &api->Sporadic.Low_priority ) ) {
|
||||
if ( !_Priority_Node_is_active( &the_thread->Real_priority ) ) {
|
||||
_Thread_Priority_add(
|
||||
the_thread,
|
||||
&the_thread->Real_priority,
|
||||
@@ -359,7 +362,6 @@ void _POSIX_Threads_Sporadic_timer( Watchdog_Control *watchdog )
|
||||
&api->Sporadic.Low_priority,
|
||||
&queue_context
|
||||
);
|
||||
_Priority_Node_set_inactive( &api->Sporadic.Low_priority );
|
||||
}
|
||||
|
||||
_Watchdog_Per_CPU_remove_ticks( &api->Sporadic.Timer );
|
||||
@@ -388,7 +390,7 @@ static void _POSIX_Threads_Sporadic_budget_callout(
|
||||
*/
|
||||
the_thread->CPU_budget.available = UINT32_MAX;
|
||||
|
||||
if ( !_Priority_Node_is_active( &api->Sporadic.Low_priority ) ) {
|
||||
if ( _Priority_Node_is_active( &the_thread->Real_priority ) ) {
|
||||
_Thread_Priority_add(
|
||||
the_thread,
|
||||
&api->Sporadic.Low_priority,
|
||||
@@ -399,6 +401,7 @@ static void _POSIX_Threads_Sporadic_budget_callout(
|
||||
&the_thread->Real_priority,
|
||||
&queue_context
|
||||
);
|
||||
_Priority_Node_set_inactive( &the_thread->Real_priority );
|
||||
}
|
||||
|
||||
_Thread_Wait_release( the_thread, &queue_context );
|
||||
|
||||
@@ -78,6 +78,10 @@ static int _POSIX_Set_sched_param(
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
#if defined(RTEMS_SCORE_THREAD_HAS_SCHEDULER_CHANGE_INHIBITORS)
|
||||
the_thread->is_scheduler_change_inhibited = ( policy == SCHED_SPORADIC );
|
||||
#endif
|
||||
|
||||
#if defined(RTEMS_POSIX_API)
|
||||
if ( policy == SCHED_SPORADIC ) {
|
||||
low_prio = param->sched_ss_low_priority;
|
||||
@@ -98,7 +102,7 @@ static int _POSIX_Set_sched_param(
|
||||
_Priority_Node_set_priority( &the_thread->Real_priority, core_normal_prio );
|
||||
|
||||
#if defined(RTEMS_POSIX_API)
|
||||
if ( _Priority_Node_is_active( &api->Sporadic.Low_priority ) ) {
|
||||
if ( !_Priority_Node_is_active( &the_thread->Real_priority ) ) {
|
||||
_Thread_Priority_add(
|
||||
the_thread,
|
||||
&the_thread->Real_priority,
|
||||
@@ -109,7 +113,6 @@ static int _POSIX_Set_sched_param(
|
||||
&api->Sporadic.Low_priority,
|
||||
queue_context
|
||||
);
|
||||
_Priority_Node_set_inactive( &api->Sporadic.Low_priority );
|
||||
} else {
|
||||
#endif
|
||||
_Thread_Priority_changed(
|
||||
|
||||
@@ -68,7 +68,7 @@ void _Thread_queue_Do_nothing_priority_actions(
|
||||
Priority_Actions *priority_actions
|
||||
)
|
||||
{
|
||||
#if defined(RTEMS_DEBUG)
|
||||
#if defined(RTEMS_DEBUG) && defined(RTEMS_SMP)
|
||||
Priority_Aggregation *priority_aggregation;
|
||||
|
||||
priority_aggregation = _Priority_Actions_move( priority_actions );
|
||||
|
||||
@@ -9,12 +9,12 @@ content: |
|
||||
#
|
||||
|
||||
RTEMS_API = ${__RTEMS_MAJOR__}
|
||||
|
||||
RTEMS_CPU = ${ARCH}
|
||||
RTEMS_BSP = ${BSP_NAME}
|
||||
RTEMS_ROOT ?= ${PREFIX}
|
||||
|
||||
prefix = ${PREFIX}
|
||||
exec_prefix = $${prefix}/${ARCH}-rtems${__RTEMS_MAJOR__}
|
||||
prefix = $$(RTEMS_ROOT)
|
||||
exec_prefix = $$(prefix)/$$(RTEMS_CPU)-rtems$$(RTEMS_API)
|
||||
|
||||
CC_FOR_TARGET = ${PROGRAM_PREFIX}gcc
|
||||
CXX_FOR_TARGET = ${PROGRAM_PREFIX}g++
|
||||
@@ -43,7 +43,6 @@ content: |
|
||||
export SIZE
|
||||
export OBJCOPY
|
||||
|
||||
RTEMS_ROOT ?= $$(prefix)
|
||||
PROJECT_ROOT = $$(RTEMS_ROOT)
|
||||
RTEMS_CUSTOM = $$(RTEMS_ROOT)/make/custom/$$(RTEMS_BSP).cfg
|
||||
RTEMS_SHARE = $$(RTEMS_ROOT)/share/rtems$$(RTEMS_API)
|
||||
|
||||
@@ -25,8 +25,8 @@ content: |
|
||||
Version: ${RTEMS_VERSION}
|
||||
Description: RTEMS BSP ${ARCH}/${BSP_NAME}
|
||||
Cflags: $${ABI_FLAGS} -isystem$${includedir}
|
||||
Ldflags: -B$${libdir} ${PKGCONFIG_LDFLAGS}
|
||||
Libs: -B$${libdir} ${PKGCONFIG_LDFLAGS}
|
||||
Ldflags: $${ABI_FLAGS} -B$${libdir} ${PKGCONFIG_LDFLAGS}
|
||||
Libs: $${ABI_FLAGS} -B$${libdir} ${PKGCONFIG_LDFLAGS}
|
||||
copyrights:
|
||||
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||
enabled-by: true
|
||||
|
||||
@@ -39,17 +39,13 @@
|
||||
|
||||
const char rtems_test_name[] = "PSX 9";
|
||||
|
||||
static int CEILING_PRIORITY;
|
||||
static int HIGH_PRIORITY;
|
||||
static int LOW_PRIORITY;
|
||||
|
||||
static int get_current_prio( pthread_t thread )
|
||||
static int get_current_prio( void )
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_task_priority prio;
|
||||
int max;
|
||||
|
||||
sc = rtems_task_set_priority( thread, RTEMS_CURRENT_PRIORITY, &prio );
|
||||
sc = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio );
|
||||
rtems_test_assert( sc == RTEMS_SUCCESSFUL );
|
||||
|
||||
max = sched_get_priority_max( SCHED_FIFO );
|
||||
@@ -113,13 +109,35 @@ void *POSIX_Init(
|
||||
char buffer[ 80 ];
|
||||
pthread_mutexattr_t attr;
|
||||
time_t start;
|
||||
time_t now;
|
||||
int ceiling_priority;
|
||||
int high_priority;
|
||||
int low_priority;
|
||||
rtems_id scheduler_id;
|
||||
rtems_task_priority rtems_priority;
|
||||
rtems_status_code sc;
|
||||
|
||||
if (argument != NULL ) {
|
||||
/* We end up here due to the rtems_task_restart() below */
|
||||
|
||||
ceiling_priority = sched_get_priority_max( SCHED_SPORADIC );
|
||||
low_priority = ceiling_priority - 2;
|
||||
rtems_test_assert( get_current_prio() == low_priority );
|
||||
|
||||
while ( get_current_prio() == low_priority ) {
|
||||
/* Be busy until sched_ss_repl_period elapses */
|
||||
}
|
||||
|
||||
rtems_test_assert( get_current_prio() == 2 );
|
||||
|
||||
TEST_END();
|
||||
rtems_test_exit( 0 );
|
||||
}
|
||||
|
||||
TEST_BEGIN();
|
||||
|
||||
CEILING_PRIORITY = sched_get_priority_max( SCHED_SPORADIC );
|
||||
HIGH_PRIORITY = sched_get_priority_max( SCHED_SPORADIC ) - 1;
|
||||
LOW_PRIORITY = sched_get_priority_max( SCHED_SPORADIC ) - 2;
|
||||
ceiling_priority = sched_get_priority_max( SCHED_SPORADIC );
|
||||
high_priority = ceiling_priority - 1;
|
||||
low_priority = ceiling_priority - 2;
|
||||
|
||||
test_destroy_locked_mutex();
|
||||
|
||||
@@ -142,19 +160,19 @@ void *POSIX_Init(
|
||||
sprintf( buffer, " - current priority = %d", priority );
|
||||
print_current_time( "Init: ", buffer );
|
||||
|
||||
schedparam.sched_ss_repl_period.tv_sec = 0;
|
||||
schedparam.sched_ss_repl_period.tv_nsec = 500000000; /* 1/2 second */
|
||||
schedparam.sched_ss_init_budget.tv_sec = 0;
|
||||
schedparam.sched_ss_init_budget.tv_nsec = 250000000; /* 1/4 second */
|
||||
schedparam.sched_ss_repl_period.tv_sec = 2;
|
||||
schedparam.sched_ss_repl_period.tv_nsec = 0;
|
||||
schedparam.sched_ss_init_budget.tv_sec = 1;
|
||||
schedparam.sched_ss_init_budget.tv_nsec = 0;
|
||||
|
||||
schedparam.sched_priority = HIGH_PRIORITY;
|
||||
schedparam.sched_ss_low_priority = LOW_PRIORITY;
|
||||
schedparam.sched_priority = high_priority;
|
||||
schedparam.sched_ss_low_priority = low_priority;
|
||||
|
||||
puts( "Init: pthread_setschedparam - SUCCESSFUL (sporadic server)" );
|
||||
status = pthread_setschedparam( pthread_self(), SCHED_SPORADIC, &schedparam );
|
||||
rtems_test_assert( !status );
|
||||
|
||||
sprintf( buffer, " - new priority = %d", get_current_prio( pthread_self() ) );
|
||||
sprintf( buffer, " - new priority = %d", get_current_prio() );
|
||||
print_current_time( "Init: ", buffer );
|
||||
|
||||
/* go into a loop consuming CPU time to watch our priority change */
|
||||
@@ -162,7 +180,7 @@ void *POSIX_Init(
|
||||
for ( passes=0 ; passes <= 3 ; ) {
|
||||
int current_priority;
|
||||
|
||||
current_priority = get_current_prio( pthread_self() );
|
||||
current_priority = get_current_prio();
|
||||
|
||||
if ( priority != current_priority ) {
|
||||
priority = current_priority;
|
||||
@@ -184,8 +202,8 @@ void *POSIX_Init(
|
||||
schedparam.sched_ss_init_budget.tv_sec = 0;
|
||||
schedparam.sched_ss_init_budget.tv_nsec = 250000000; /* 1/4 second */
|
||||
|
||||
schedparam.sched_priority = HIGH_PRIORITY;
|
||||
schedparam.sched_ss_low_priority = LOW_PRIORITY;
|
||||
schedparam.sched_priority = high_priority;
|
||||
schedparam.sched_ss_low_priority = low_priority;
|
||||
|
||||
puts( "Init: pthread_setschedparam - SUCCESSFUL (sporadic server)" );
|
||||
status = pthread_setschedparam( pthread_self(), SCHED_SPORADIC, &schedparam );
|
||||
@@ -198,7 +216,7 @@ void *POSIX_Init(
|
||||
status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_PROTECT );
|
||||
rtems_test_assert( !status );
|
||||
|
||||
status = pthread_mutexattr_setprioceiling( &attr, CEILING_PRIORITY );
|
||||
status = pthread_mutexattr_setprioceiling( &attr, ceiling_priority );
|
||||
rtems_test_assert( !status );
|
||||
|
||||
puts( "Init: Creating a mutex" );
|
||||
@@ -207,51 +225,155 @@ void *POSIX_Init(
|
||||
printf( "status = %d\n", status );
|
||||
rtems_test_assert( !status );
|
||||
|
||||
sprintf( buffer, " - new priority = %d", get_current_prio( pthread_self() ) );
|
||||
sprintf( buffer, " - new priority = %d", get_current_prio() );
|
||||
print_current_time( "Init: ", buffer );
|
||||
|
||||
/* go into a loop consuming CPU time to watch our priority NOT lower */
|
||||
|
||||
start = time( &start );
|
||||
|
||||
puts( "Init: pthread_mutex_lock acquire the lock" );
|
||||
puts( "Init: Go into low priority and lock/unlock ceiling mutex" );
|
||||
|
||||
while ( get_current_prio() == low_priority ) {
|
||||
/* Be busy until sched_ss_repl_period elapses */
|
||||
}
|
||||
|
||||
rtems_test_assert( get_current_prio() == high_priority );
|
||||
status = pthread_mutex_lock( &Mutex_id );
|
||||
if ( status )
|
||||
printf( "status = %d %s\n", status, strerror(status) );
|
||||
rtems_test_assert( !status );
|
||||
rtems_test_assert( get_current_prio() == ceiling_priority );
|
||||
|
||||
do {
|
||||
priority = get_current_prio( pthread_self() );
|
||||
status = pthread_mutex_unlock( &Mutex_id );
|
||||
if ( status )
|
||||
printf( "status = %d %s\n", status, strerror(status) );
|
||||
rtems_test_assert( !status );
|
||||
rtems_test_assert( get_current_prio() == high_priority );
|
||||
|
||||
if ( priority != CEILING_PRIORITY ) {
|
||||
puts( "ERROR - Init's priority lowered while holding mutex" );
|
||||
rtems_test_exit(0);
|
||||
}
|
||||
puts( "Init: Go into high priority and lock/unlock ceiling mutex" );
|
||||
|
||||
now = time( &now );
|
||||
} while ( now - start < 3 );
|
||||
while ( get_current_prio() == high_priority ) {
|
||||
/* Be busy until sched_ss_init_budget elapses */
|
||||
}
|
||||
|
||||
/* with this unlock we should be able to go to low priority */
|
||||
rtems_test_assert( get_current_prio() == low_priority );
|
||||
status = pthread_mutex_lock( &Mutex_id );
|
||||
if ( status )
|
||||
printf( "status = %d %s\n", status, strerror(status) );
|
||||
rtems_test_assert( !status );
|
||||
rtems_test_assert( get_current_prio() == ceiling_priority );
|
||||
|
||||
puts( "Init: unlock mutex" );
|
||||
status = pthread_mutex_unlock( &Mutex_id );
|
||||
if ( status )
|
||||
printf( "status = %d\n", status );
|
||||
rtems_test_assert( !status );
|
||||
rtems_test_assert( get_current_prio() == low_priority );
|
||||
|
||||
sprintf( buffer, " - new priority = %d", get_current_prio( pthread_self() ) );
|
||||
print_current_time( "Init: ", buffer );
|
||||
status = pthread_mutex_destroy( &Mutex_id );
|
||||
rtems_test_assert( status == 0 );
|
||||
|
||||
for ( ; ; ) {
|
||||
if ( get_current_prio( pthread_self() ) == LOW_PRIORITY )
|
||||
break;
|
||||
puts( "Init: Go into low priority and change scheduler parameters" );
|
||||
|
||||
while ( get_current_prio() == high_priority ) {
|
||||
/* Be busy until sched_ss_init_budget elapses */
|
||||
}
|
||||
|
||||
sprintf( buffer, " - new priority = %d", get_current_prio( pthread_self() ) );
|
||||
print_current_time( "Init: ", buffer );
|
||||
rtems_test_assert( get_current_prio() == low_priority );
|
||||
schedparam.sched_priority = ceiling_priority;
|
||||
status = pthread_setschedparam( pthread_self(), SCHED_SPORADIC, &schedparam );
|
||||
rtems_test_assert( status == 0 );
|
||||
rtems_test_assert( get_current_prio() == ceiling_priority );
|
||||
|
||||
TEST_END();
|
||||
rtems_test_exit( 0 );
|
||||
puts( "Init: Go into low priority and set POSIX priority" );
|
||||
|
||||
schedparam.sched_priority = high_priority;
|
||||
status = pthread_setschedparam( pthread_self(), SCHED_SPORADIC, &schedparam );
|
||||
rtems_test_assert( status == 0 );
|
||||
rtems_test_assert( get_current_prio() == high_priority );
|
||||
|
||||
while ( get_current_prio() == high_priority ) {
|
||||
/* Be busy until sched_ss_init_budget elapses */
|
||||
}
|
||||
|
||||
rtems_test_assert( get_current_prio() == low_priority );
|
||||
status = pthread_setschedprio( pthread_self(), ceiling_priority );
|
||||
rtems_test_assert( status == 0 );
|
||||
rtems_test_assert( get_current_prio() == low_priority );
|
||||
|
||||
while ( get_current_prio() == low_priority ) {
|
||||
/* Be busy until sched_ss_repl_period elapses */
|
||||
}
|
||||
|
||||
rtems_test_assert( get_current_prio() == ceiling_priority );
|
||||
|
||||
puts( "Init: Go into low priority and set RTEMS priority" );
|
||||
|
||||
sc = rtems_task_get_scheduler( RTEMS_SELF, &scheduler_id );
|
||||
rtems_test_assert( sc == RTEMS_SUCCESSFUL );
|
||||
sc = rtems_scheduler_map_priority_from_posix(
|
||||
scheduler_id,
|
||||
ceiling_priority,
|
||||
&rtems_priority
|
||||
);
|
||||
rtems_test_assert( sc == RTEMS_SUCCESSFUL );
|
||||
|
||||
schedparam.sched_priority = high_priority;
|
||||
status = pthread_setschedparam( pthread_self(), SCHED_SPORADIC, &schedparam );
|
||||
rtems_test_assert( status == 0 );
|
||||
rtems_test_assert( get_current_prio() == high_priority );
|
||||
|
||||
while ( get_current_prio() == high_priority ) {
|
||||
/* Be busy until sched_ss_init_budget elapses */
|
||||
}
|
||||
|
||||
rtems_test_assert( get_current_prio() == low_priority );
|
||||
sc = rtems_task_set_priority( RTEMS_SELF, rtems_priority, &rtems_priority );
|
||||
rtems_test_assert( sc == RTEMS_SUCCESSFUL );
|
||||
rtems_test_assert( get_current_prio() == low_priority );
|
||||
|
||||
while ( get_current_prio() == low_priority ) {
|
||||
/* Be busy until sched_ss_repl_period elapses */
|
||||
}
|
||||
|
||||
rtems_test_assert( get_current_prio() == ceiling_priority );
|
||||
|
||||
puts( "Init: Go into low priority and set scheduler" );
|
||||
|
||||
sc = rtems_scheduler_ident_by_processor( 1, &scheduler_id );
|
||||
rtems_test_assert( sc == RTEMS_SUCCESSFUL );
|
||||
|
||||
schedparam.sched_priority = high_priority;
|
||||
status = pthread_setschedparam( pthread_self(), SCHED_SPORADIC, &schedparam );
|
||||
rtems_test_assert( status == 0 );
|
||||
rtems_test_assert( get_current_prio() == high_priority );
|
||||
|
||||
while ( get_current_prio() == high_priority ) {
|
||||
/* Be busy until sched_ss_init_budget elapses */
|
||||
}
|
||||
|
||||
rtems_test_assert( get_current_prio() == low_priority );
|
||||
sc = rtems_task_set_scheduler( RTEMS_SELF, scheduler_id, 1 );
|
||||
rtems_test_assert( sc == RTEMS_RESOURCE_IN_USE );
|
||||
rtems_test_assert( get_current_prio() == low_priority );
|
||||
|
||||
while ( get_current_prio() == low_priority ) {
|
||||
/* Be busy until sched_ss_repl_period elapses */
|
||||
}
|
||||
|
||||
rtems_test_assert( get_current_prio() == high_priority );
|
||||
|
||||
puts( "Init: Go into low priority and restart task" );
|
||||
|
||||
schedparam.sched_priority = high_priority;
|
||||
status = pthread_setschedparam( pthread_self(), SCHED_SPORADIC, &schedparam );
|
||||
rtems_test_assert( status == 0 );
|
||||
rtems_test_assert( get_current_prio() == high_priority );
|
||||
|
||||
while ( get_current_prio() == high_priority ) {
|
||||
/* Be busy until sched_ss_init_budget elapses */
|
||||
}
|
||||
|
||||
rtems_test_assert( get_current_prio() == low_priority );
|
||||
(void) rtems_task_restart( RTEMS_SELF, 1 );
|
||||
|
||||
return NULL; /* just so the compiler thinks we returned something */
|
||||
}
|
||||
|
||||
@@ -58,6 +58,28 @@ void *Task_2(
|
||||
|
||||
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
|
||||
|
||||
#ifdef RTEMS_SMP
|
||||
|
||||
#define CONFIGURE_MAXIMUM_PROCESSORS 2
|
||||
|
||||
#define CONFIGURE_SCHEDULER_EDF_SMP
|
||||
|
||||
#include <rtems/scheduler.h>
|
||||
|
||||
RTEMS_SCHEDULER_EDF_SMP( a );
|
||||
|
||||
RTEMS_SCHEDULER_EDF_SMP( b );
|
||||
|
||||
#define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
|
||||
RTEMS_SCHEDULER_TABLE_EDF_SMP( a, rtems_build_name( 'M', 'A', 'I', 'N' ) ), \
|
||||
RTEMS_SCHEDULER_TABLE_EDF_SMP( b, rtems_build_name( 'O', 'T', 'H', 'R' ) )
|
||||
|
||||
#define CONFIGURE_SCHEDULER_ASSIGNMENTS \
|
||||
RTEMS_SCHEDULER_ASSIGN( 0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY ), \
|
||||
RTEMS_SCHEDULER_ASSIGN( 1, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL )
|
||||
|
||||
#endif /* RTEMS_SMP */
|
||||
|
||||
#include <rtems/confdefs.h>
|
||||
|
||||
/* global variables */
|
||||
|
||||
6
wscript
6
wscript
@@ -1436,10 +1436,10 @@ def load_version(ctx):
|
||||
def configure_version(conf):
|
||||
version_label = load_version(conf)
|
||||
v_str = version["__RTEMS_MAJOR__"] + "." + version["__RTEMS_MINOR__"]
|
||||
if int(version["__RTEMS_REVISION__"]) != 0 and version_label != "":
|
||||
if int(version["__RTEMS_REVISION__"]) != 0:
|
||||
v_str += "." + version["__RTEMS_REVISION__"]
|
||||
if version_label != "":
|
||||
v_str += "." + version_label
|
||||
if version_label is not None and version_label != "":
|
||||
v_str += "." + version_label
|
||||
conf.msg("Configure RTEMS version", v_str, color="YELLOW")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user