summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-11-24 11:51:28 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-07 14:22:01 +0100
commit3899bc1a4b3294306ae2fd3f8ff0ee10365d9f4b (patch)
tree3912fc89bbde8a64a20111e02c618e85eb7bb000
parentscore: Rename Objects_Information::allocation_size (diff)
downloadrtems-3899bc1a4b3294306ae2fd3f8ff0ee10365d9f4b.tar.bz2
score: Optimize object lookup
Use the maximum ID for the ID to object translation. Using the maximum ID gets rid of an additional load from the object information in _Objects_Get(). In addition, object lookups fail for every ID in case the object information is cleared to zero. This makes it a bit more robust during system startup (see new tests in spconfig02). The local table no longer needs a NULL pointer entry at array index zero. Adjust all the object iteration loops accordingly. Remove Objects_Information::minimum_id since it contains only redundant information. Add _Objects_Get_minimum_id() to get the minimum ID. Update #3621.
-rw-r--r--cpukit/include/rtems/score/objectimpl.h26
-rw-r--r--cpukit/posix/src/killinfo.c2
-rw-r--r--cpukit/rtems/src/ratemonreportstatistics.c10
-rw-r--r--cpukit/rtems/src/ratemonresetall.c12
-rw-r--r--cpukit/rtems/src/rtemsobjectgetclassinfo.c2
-rw-r--r--cpukit/score/src/objectallocate.c9
-rw-r--r--cpukit/score/src/objectextendinformation.c20
-rw-r--r--cpukit/score/src/objectfree.c3
-rw-r--r--cpukit/score/src/objectgetlocal.c21
-rw-r--r--cpukit/score/src/objectgetnext.c2
-rw-r--r--cpukit/score/src/objectgetnoprotection.c19
-rw-r--r--cpukit/score/src/objectinitializeinformation.c17
-rw-r--r--cpukit/score/src/objectnametoid.c4
-rw-r--r--cpukit/score/src/objectnametoidstring.c2
-rw-r--r--cpukit/score/src/objectshrinkinformation.c10
-rw-r--r--cpukit/score/src/threaditerate.c2
-rw-r--r--testsuites/sptests/spconfig02/init.c238
17 files changed, 302 insertions, 97 deletions
diff --git a/cpukit/include/rtems/score/objectimpl.h b/cpukit/include/rtems/score/objectimpl.h
index c3597c33ff..a516e21c65 100644
--- a/cpukit/include/rtems/score/objectimpl.h
+++ b/cpukit/include/rtems/score/objectimpl.h
@@ -120,8 +120,6 @@ typedef void ( *Objects_Thread_queue_Extract_callout )(
* manage each class of objects.
*/
typedef struct {
- /** This is the minimum valid id of this object class. */
- Objects_Id minimum_id;
/** This is the maximum valid id of this object class. */
Objects_Id maximum_id;
/** This points to the table of local objects. */
@@ -192,6 +190,11 @@ extern uint16_t _Objects_Maximum_nodes;
#endif
/**
+ * This is the minimum object ID index associated with an object.
+ */
+#define OBJECTS_INDEX_MINIMUM 1U
+
+/**
* The following is the list of information blocks per API for each object
* class. From the ID, we can go to one of these information blocks,
* and obtain a pointer to the appropriate object control block.
@@ -832,6 +835,22 @@ RTEMS_INLINE_ROUTINE bool _Objects_Are_ids_equal(
}
/**
+ * Returns the identifier with the minimum index for the specified identifier.
+ *
+ * The specified identifier must have valid API, class and node fields.
+ *
+ * @param[in] id The identifier to be processed.
+ *
+ * @return The corresponding ID with the minimum index.
+ */
+RTEMS_INLINE_ROUTINE Objects_Id _Objects_Get_minimum_id( Objects_Id id )
+{
+ id &= ~OBJECTS_INDEX_MASK;
+ id += (Objects_Id) OBJECTS_INDEX_MINIMUM << OBJECTS_INDEX_START_BIT;
+ return id;
+}
+
+/**
* This function sets the pointer to the local_table object
* referenced by the index.
*
@@ -856,9 +875,10 @@ RTEMS_INLINE_ROUTINE void _Objects_Set_local_object(
* where the Id is known to be good. Therefore, this should NOT
* occur in normal situations.
*/
+ _Assert( index >= OBJECTS_INDEX_MINIMUM );
_Assert( index <= information->maximum );
- information->local_table[ index ] = the_object;
+ information->local_table[ index - OBJECTS_INDEX_MINIMUM ] = the_object;
}
/**
diff --git a/cpukit/posix/src/killinfo.c b/cpukit/posix/src/killinfo.c
index 6f45b29ec6..cabd91c700 100644
--- a/cpukit/posix/src/killinfo.c
+++ b/cpukit/posix/src/killinfo.c
@@ -210,7 +210,7 @@ int _POSIX_signals_Send(
maximum = the_info->maximum;
object_table = the_info->local_table;
- for ( index = 1 ; index <= maximum ; index++ ) {
+ for ( index = 0 ; index < maximum ; ++index ) {
the_thread = (Thread_Control *) object_table[ index ];
if ( !the_thread )
diff --git a/cpukit/rtems/src/ratemonreportstatistics.c b/cpukit/rtems/src/ratemonreportstatistics.c
index 1f7542f8df..cf04a787e3 100644
--- a/cpukit/rtems/src/ratemonreportstatistics.c
+++ b/cpukit/rtems/src/ratemonreportstatistics.c
@@ -35,6 +35,7 @@ void rtems_rate_monotonic_report_statistics_with_plugin(
)
{
rtems_status_code status;
+ rtems_id maximum_id;
rtems_id id;
rtems_rate_monotonic_period_statistics the_stats;
rtems_rate_monotonic_period_status the_status;
@@ -67,9 +68,12 @@ ididididid NNNN ccccc mmmmmm X
* Cycle through all possible ids and try to report on each one. If it
* is a period that is inactive, we just get an error back. No big deal.
*/
- for ( id=_Rate_monotonic_Information.minimum_id ;
- id <= _Rate_monotonic_Information.maximum_id ;
- id++ ) {
+ maximum_id = _Rate_monotonic_Information.maximum_id;
+ for (
+ id = _Objects_Get_minimum_id( maximum_id ) ;
+ id <= maximum_id ;
+ ++id
+ ) {
status = rtems_rate_monotonic_get_statistics( id, &the_stats );
if ( status != RTEMS_SUCCESSFUL )
continue;
diff --git a/cpukit/rtems/src/ratemonresetall.c b/cpukit/rtems/src/ratemonresetall.c
index a8418e82c4..c9e9089528 100644
--- a/cpukit/rtems/src/ratemonresetall.c
+++ b/cpukit/rtems/src/ratemonresetall.c
@@ -25,7 +25,8 @@
*/
void rtems_rate_monotonic_reset_all_statistics( void )
{
- Objects_Id id;
+ rtems_id maximum_id;
+ rtems_id id;
/*
* Prevent allocation or deallocation of any of the periods while we are
@@ -37,9 +38,12 @@ void rtems_rate_monotonic_reset_all_statistics( void )
* Cycle through all possible ids and try to reset each one. If it
* is a period that is inactive, we just get an error back. No big deal.
*/
- for ( id=_Rate_monotonic_Information.minimum_id ;
- id <= _Rate_monotonic_Information.maximum_id ;
- id++ ) {
+ maximum_id = _Rate_monotonic_Information.maximum_id;
+ for (
+ id = _Objects_Get_minimum_id( maximum_id ) ;
+ id <= maximum_id ;
+ ++id
+ ) {
(void) rtems_rate_monotonic_reset_statistics( id );
}
diff --git a/cpukit/rtems/src/rtemsobjectgetclassinfo.c b/cpukit/rtems/src/rtemsobjectgetclassinfo.c
index ffcbd96cae..3ebe3535f5 100644
--- a/cpukit/rtems/src/rtemsobjectgetclassinfo.c
+++ b/cpukit/rtems/src/rtemsobjectgetclassinfo.c
@@ -44,7 +44,7 @@ rtems_status_code rtems_object_get_class_information(
/*
* Return information about this object class to the user.
*/
- info->minimum_id = obj_info->minimum_id;
+ info->minimum_id = _Objects_Get_minimum_id( obj_info->maximum_id );
info->maximum_id = obj_info->maximum_id;
info->auto_extend = obj_info->auto_extend;
info->maximum = obj_info->maximum;
diff --git a/cpukit/score/src/objectallocate.c b/cpukit/score/src/objectallocate.c
index 81e322757c..2f991477da 100644
--- a/cpukit/score/src/objectallocate.c
+++ b/cpukit/score/src/objectallocate.c
@@ -62,16 +62,15 @@ Objects_Control *_Objects_Allocate_unprotected(
* extend information base.
*/
- if ( !the_object ) {
+ if ( the_object == NULL ) {
_Objects_Extend_information( information );
the_object = _Objects_Get_inactive( information );
}
- if ( the_object ) {
- uint32_t block;
+ if ( the_object != NULL ) {
+ Objects_Maximum block;
- block = (uint32_t) _Objects_Get_index( the_object->id ) -
- _Objects_Get_index( information->minimum_id );
+ block = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM;
block /= information->objects_per_block;
information->inactive_per_block[ block ]--;
diff --git a/cpukit/score/src/objectextendinformation.c b/cpukit/score/src/objectextendinformation.c
index b8e72f93b6..a8346ce937 100644
--- a/cpukit/score/src/objectextendinformation.c
+++ b/cpukit/score/src/objectextendinformation.c
@@ -48,7 +48,6 @@ void _Objects_Extend_information(
uint32_t block;
uint32_t index_base;
uint32_t index_end;
- uint32_t minimum_index;
uint32_t index;
uint32_t maximum;
size_t object_block_size;
@@ -65,11 +64,9 @@ void _Objects_Extend_information(
* extend the block table, then we will change do_extend.
*/
do_extend = true;
- minimum_index = _Objects_Get_index( information->minimum_id );
- index_base = minimum_index;
+ index_base = 0;
block = 0;
- /* if ( information->maximum < minimum_index ) */
if ( information->object_blocks == NULL )
block_count = 0;
else {
@@ -149,7 +146,7 @@ void _Objects_Extend_information(
* Allocate the tables and break it up.
*/
object_blocks_size = block_count * sizeof( *object_blocks );
- local_table_size = ( maximum + minimum_index ) * sizeof( *local_table );
+ local_table_size = maximum * sizeof( *local_table );
table_size = object_blocks_size
+ local_table_size
+ block_count * sizeof( *inactive_per_block );
@@ -181,7 +178,7 @@ void _Objects_Extend_information(
*/
block_count--;
- if ( information->maximum > minimum_index ) {
+ if ( information->maximum > 0 ) {
/*
* Copy each section of the table over. This has to be performed as
* separate parts as size of each block has changed.
@@ -199,15 +196,8 @@ void _Objects_Extend_information(
memcpy(
local_table,
information->local_table,
- ( information->maximum + minimum_index ) * sizeof( *local_table )
+ information->maximum * sizeof( *local_table )
);
- } else {
- /*
- * Deal with the special case of the 0 to minimum_index
- */
- for ( index = 0; index < minimum_index; index++ ) {
- local_table[ index ] = NULL;
- }
}
/*
@@ -256,7 +246,7 @@ void _Objects_Extend_information(
information->the_api,
information->the_class,
_Objects_Local_node,
- index
+ index + OBJECTS_INDEX_MINIMUM
);
_Chain_Initialize_node( &the_object->Node );
diff --git a/cpukit/score/src/objectfree.c b/cpukit/score/src/objectfree.c
index 3e7c8e409c..cf31a5b24e 100644
--- a/cpukit/score/src/objectfree.c
+++ b/cpukit/score/src/objectfree.c
@@ -37,8 +37,7 @@ void _Objects_Free(
Objects_Maximum inactive;
objects_per_block = information->objects_per_block;
- block = _Objects_Get_index( the_object->id );
- block -= _Objects_Get_index( information->minimum_id );
+ block = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM;
block /= objects_per_block;
++information->inactive_per_block[ block ];
diff --git a/cpukit/score/src/objectgetlocal.c b/cpukit/score/src/objectgetlocal.c
index a1a81db436..e8a109f457 100644
--- a/cpukit/score/src/objectgetlocal.c
+++ b/cpukit/score/src/objectgetlocal.c
@@ -31,22 +31,29 @@ Objects_Control *_Objects_Get(
const Objects_Information *information
)
{
- uint32_t index;
+ Objects_Id delta;
+ Objects_Id maximum_id;
+ Objects_Id end;
- index = id - information->minimum_id + 1;
+ maximum_id = information->maximum_id;
+ delta = maximum_id - id;
+ end = _Objects_Get_index( maximum_id );
- if ( information->maximum >= index ) {
+ if ( RTEMS_PREDICT_TRUE( delta < end ) ) {
+ ISR_Level level;
Objects_Control *the_object;
- _ISR_lock_ISR_disable( lock_context );
+ _ISR_Local_disable( level );
+ _ISR_lock_Context_set_level( lock_context, level );
- the_object = information->local_table[ index ];
- if ( the_object != NULL ) {
+ the_object =
+ information->local_table[ end - OBJECTS_INDEX_MINIMUM - delta ];
+ if ( RTEMS_PREDICT_TRUE( the_object != NULL ) ) {
/* ISR disabled on behalf of caller */
return the_object;
}
- _ISR_lock_ISR_enable( lock_context );
+ _ISR_Local_enable( level );
}
return NULL;
diff --git a/cpukit/score/src/objectgetnext.c b/cpukit/score/src/objectgetnext.c
index a46c02f2c2..054ed22fc1 100644
--- a/cpukit/score/src/objectgetnext.c
+++ b/cpukit/score/src/objectgetnext.c
@@ -36,7 +36,7 @@ Objects_Control *_Objects_Get_next(
return NULL;
if (_Objects_Get_index(id) == OBJECTS_ID_INITIAL_INDEX)
- next_id = information->minimum_id;
+ next_id = _Objects_Get_minimum_id( information->maximum_id );
else
next_id = id;
diff --git a/cpukit/score/src/objectgetnoprotection.c b/cpukit/score/src/objectgetnoprotection.c
index 85692234fa..e5045b26de 100644
--- a/cpukit/score/src/objectgetnoprotection.c
+++ b/cpukit/score/src/objectgetnoprotection.c
@@ -25,19 +25,16 @@ Objects_Control *_Objects_Get_no_protection(
const Objects_Information *information
)
{
- Objects_Control *the_object;
- uint32_t index;
+ Objects_Id delta;
+ Objects_Id maximum_id;
+ Objects_Id end;
- /*
- * You can't just extract the index portion or you can get tricked
- * by a value between 1 and maximum.
- */
- index = id - information->minimum_id + 1;
+ maximum_id = information->maximum_id;
+ delta = maximum_id - id;
+ end = _Objects_Get_index( maximum_id );
- if ( information->maximum >= index ) {
- if ( (the_object = information->local_table[ index ]) != NULL ) {
- return the_object;
- }
+ if ( RTEMS_PREDICT_TRUE( delta < end ) ) {
+ return information->local_table[ end - OBJECTS_INDEX_MINIMUM - delta ];
}
/*
diff --git a/cpukit/score/src/objectinitializeinformation.c b/cpukit/score/src/objectinitializeinformation.c
index a341dc1a5d..530e4e10ba 100644
--- a/cpukit/score/src/objectinitializeinformation.c
+++ b/cpukit/score/src/objectinitializeinformation.c
@@ -37,9 +37,7 @@ void _Objects_Do_initialize_information(
#endif
)
{
- static Objects_Control *null_local_table = NULL;
- uint32_t minimum_index;
- Objects_Maximum maximum_per_allocation;
+ Objects_Maximum maximum_per_allocation;
information->the_api = the_api;
information->the_class = the_class;
@@ -48,6 +46,7 @@ void _Objects_Do_initialize_information(
information->inactive_per_block = 0;
information->object_blocks = 0;
information->inactive = 0;
+ information->local_table = NULL;
/*
* Set the maximum value to 0. It will be updated when objects are
@@ -79,18 +78,6 @@ void _Objects_Do_initialize_information(
information->objects_per_block = maximum_per_allocation;
/*
- * Provide a null local table entry for the case of any empty table.
- */
- information->local_table = &null_local_table;
-
- /*
- * Calculate minimum and maximum Id's
- */
- minimum_index = (maximum_per_allocation == 0) ? 0 : 1;
- information->minimum_id =
- _Objects_Build_id( the_api, the_class, _Objects_Local_node, minimum_index );
-
- /*
* Calculate the maximum name length
*
* NOTE: Either 4 bytes for Classic API names or an arbitrary
diff --git a/cpukit/score/src/objectnametoid.c b/cpukit/score/src/objectnametoid.c
index 030d64a4bd..c3b014e3e1 100644
--- a/cpukit/score/src/objectnametoid.c
+++ b/cpukit/score/src/objectnametoid.c
@@ -29,7 +29,7 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32(
{
bool search_local_node;
Objects_Control *the_object;
- uint32_t index;
+ Objects_Maximum index;
#if defined(RTEMS_MULTIPROCESSING)
Objects_Name name_for_mp;
#endif
@@ -52,7 +52,7 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32(
search_local_node = true;
if ( search_local_node ) {
- for ( index = 1; index <= information->maximum; index++ ) {
+ for ( index = 0; index < information->maximum; ++index ) {
the_object = information->local_table[ index ];
if ( !the_object )
continue;
diff --git a/cpukit/score/src/objectnametoidstring.c b/cpukit/score/src/objectnametoidstring.c
index 3bca0441e0..a015d5fc25 100644
--- a/cpukit/score/src/objectnametoidstring.c
+++ b/cpukit/score/src/objectnametoidstring.c
@@ -52,7 +52,7 @@ Objects_Control *_Objects_Get_by_name(
*name_length_p = name_length;
}
- for ( index = 1; index <= information->maximum; index++ ) {
+ for ( index = 0; index < information->maximum; ++index ) {
Objects_Control *the_object;
the_object = information->local_table[ index ];
diff --git a/cpukit/score/src/objectshrinkinformation.c b/cpukit/score/src/objectshrinkinformation.c
index cf3618f8fa..3b1841a16b 100644
--- a/cpukit/score/src/objectshrinkinformation.c
+++ b/cpukit/score/src/objectshrinkinformation.c
@@ -28,9 +28,9 @@ void _Objects_Shrink_information(
)
{
Objects_Maximum objects_per_block;
- Objects_Maximum index_base;
Objects_Maximum block_count;
Objects_Maximum block;
+ Objects_Maximum index_base;
_Assert( _Objects_Allocator_is_owner() );
@@ -39,14 +39,14 @@ void _Objects_Shrink_information(
*/
objects_per_block = information->objects_per_block;
- index_base = _Objects_Get_index( information->minimum_id );
- block_count = ( information->maximum - index_base ) / objects_per_block;
+ block_count = information->maximum / objects_per_block;
+ index_base = 0;
for ( block = 0; block < block_count; block++ ) {
if ( information->inactive_per_block[ block ] == objects_per_block ) {
Chain_Node *node;
const Chain_Node *tail;
- uint32_t index_end;
+ Objects_Maximum index_end;
node = _Chain_First( &information->Inactive );
tail = _Chain_Immutable_tail( &information->Inactive );
@@ -57,7 +57,7 @@ void _Objects_Shrink_information(
uint32_t index;
object = (Objects_Control *) node;
- index = _Objects_Get_index( object->id );
+ index = _Objects_Get_index( object->id ) - OBJECTS_INDEX_MINIMUM;
/*
* Get the next node before the node is extracted
diff --git a/cpukit/score/src/threaditerate.c b/cpukit/score/src/threaditerate.c
index eff3472d57..9fa9b89166 100644
--- a/cpukit/score/src/threaditerate.c
+++ b/cpukit/score/src/threaditerate.c
@@ -39,7 +39,7 @@ void _Thread_Iterate(
continue;
}
- for ( i = 1 ; i <= information->maximum ; ++i ) {
+ for ( i = 0 ; i < information->maximum ; ++i ) {
Thread_Control *the_thread;
the_thread = (Thread_Control *) information->local_table[ i ];
diff --git a/testsuites/sptests/spconfig02/init.c b/testsuites/sptests/spconfig02/init.c
index 34631fece2..ee889293bc 100644
--- a/testsuites/sptests/spconfig02/init.c
+++ b/testsuites/sptests/spconfig02/init.c
@@ -18,6 +18,7 @@
#include <rtems.h>
#include <rtems/score/objectimpl.h>
+#include <rtems/sysinit.h>
#include <tmacros.h>
@@ -25,7 +26,7 @@ const char rtems_test_name[] = "SPCONFIG 2";
static const rtems_name name = rtems_build_name('N', 'A', 'M', 'E');
-static void test_barrier(void)
+static void test_barrier_create(void)
{
rtems_status_code sc;
rtems_id id;
@@ -34,7 +35,33 @@ static void test_barrier(void)
rtems_test_assert(sc == RTEMS_TOO_MANY);
}
-static void test_message_queue(void)
+static void test_barrier_delete(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ sc = rtems_barrier_delete(0);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+
+ id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_BARRIERS, 1, 0);
+ sc = rtems_barrier_delete(id);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+}
+
+static void test_barrier_get(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ sc = rtems_barrier_wait(0, RTEMS_NO_TIMEOUT);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+
+ id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_BARRIERS, 1, 0);
+ sc = rtems_barrier_wait(id, RTEMS_NO_TIMEOUT);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+}
+
+static void test_message_queue_create(void)
{
rtems_status_code sc;
rtems_id id;
@@ -47,6 +74,12 @@ static void test_message_queue(void)
&id
);
rtems_test_assert(sc == RTEMS_TOO_MANY);
+}
+
+static void test_message_queue_delete(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
sc = rtems_message_queue_delete(0);
rtems_test_assert(sc == RTEMS_INVALID_ID);
@@ -56,7 +89,21 @@ static void test_message_queue(void)
rtems_test_assert(sc == RTEMS_INVALID_ID);
}
-static void test_partition(void)
+static void test_message_queue_get(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+ uint32_t count;
+
+ sc = rtems_message_queue_flush(0, &count);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+
+ id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_MESSAGE_QUEUES, 1, 0);
+ sc = rtems_message_queue_flush(id, &count);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+}
+
+static void test_partition_create(void)
{
rtems_status_code sc;
rtems_id id;
@@ -71,6 +118,12 @@ static void test_partition(void)
&id
);
rtems_test_assert(sc == RTEMS_TOO_MANY);
+}
+
+static void test_partition_delete(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
sc = rtems_partition_delete(0);
rtems_test_assert(sc == RTEMS_INVALID_ID);
@@ -80,13 +133,32 @@ static void test_partition(void)
rtems_test_assert(sc == RTEMS_INVALID_ID);
}
-static void test_rate_monotonic(void)
+static void test_partition_get(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ sc = rtems_partition_return_buffer(0, NULL);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+
+ id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_PARTITIONS, 1, 0);
+ sc = rtems_partition_return_buffer(id, NULL);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+}
+
+static void test_rate_monotonic_create(void)
{
rtems_status_code sc;
rtems_id id;
sc = rtems_rate_monotonic_create(name, &id);
rtems_test_assert(sc == RTEMS_TOO_MANY);
+}
+
+static void test_rate_monotonic_delete(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
sc = rtems_rate_monotonic_delete(0);
rtems_test_assert(sc == RTEMS_INVALID_ID);
@@ -96,7 +168,20 @@ static void test_rate_monotonic(void)
rtems_test_assert(sc == RTEMS_INVALID_ID);
}
-static void test_region(void)
+static void test_rate_monotonic_get(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ sc = rtems_rate_monotonic_cancel(0);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+
+ id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_PERIODS, 1, 0);
+ sc = rtems_rate_monotonic_cancel(id);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+}
+
+static void test_region_create(void)
{
rtems_status_code sc;
rtems_id id;
@@ -111,6 +196,12 @@ static void test_region(void)
&id
);
rtems_test_assert(sc == RTEMS_TOO_MANY);
+}
+
+static void test_region_delete(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
sc = rtems_region_delete(0);
rtems_test_assert(sc == RTEMS_INVALID_ID);
@@ -120,7 +211,20 @@ static void test_region(void)
rtems_test_assert(sc == RTEMS_INVALID_ID);
}
-static void test_semaphore(void)
+static void test_region_get(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ sc = rtems_region_return_segment(0, NULL);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+
+ id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_REGIONS, 1, 0);
+ sc = rtems_region_return_segment(id, NULL);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+}
+
+static void test_semaphore_create(void)
{
rtems_status_code sc;
rtems_id id;
@@ -133,6 +237,12 @@ static void test_semaphore(void)
&id
);
rtems_test_assert(sc == RTEMS_TOO_MANY);
+}
+
+static void test_semaphore_delete(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
sc = rtems_semaphore_delete(0);
rtems_test_assert(sc == RTEMS_INVALID_ID);
@@ -142,7 +252,20 @@ static void test_semaphore(void)
rtems_test_assert(sc == RTEMS_INVALID_ID);
}
-static void test_task(void)
+static void test_semaphore_get(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ sc = rtems_semaphore_release(0);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+
+ id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_SEMAPHORES, 1, 0);
+ sc = rtems_semaphore_release(id);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+}
+
+static void test_task_create(void)
{
rtems_status_code sc;
rtems_id id;
@@ -156,19 +279,41 @@ static void test_task(void)
&id
);
rtems_test_assert(sc == RTEMS_TOO_MANY);
+}
+
+static void test_task_delete(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TASKS, 1, 0);
sc = rtems_task_delete(id);
rtems_test_assert(sc == RTEMS_INVALID_ID);
}
-static void test_timer(void)
+static void test_task_get(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TASKS, 1, 0);
+ sc = rtems_task_resume(id);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+}
+
+static void test_timer_create(void)
{
rtems_status_code sc;
rtems_id id;
sc = rtems_timer_create(name, &id);
rtems_test_assert(sc == RTEMS_TOO_MANY);
+}
+
+static void test_timer_delete(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
sc = rtems_timer_delete(0);
rtems_test_assert(sc == RTEMS_INVALID_ID);
@@ -178,7 +323,20 @@ static void test_timer(void)
rtems_test_assert(sc == RTEMS_INVALID_ID);
}
-static void test_user_extensions(void)
+static void test_timer_get(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ sc = rtems_timer_reset(0);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+
+ id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TIMERS, 1, 0);
+ sc = rtems_timer_reset(id);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+}
+
+static void test_user_extensions_create(void)
{
rtems_status_code sc;
rtems_id id;
@@ -187,6 +345,12 @@ static void test_user_extensions(void)
memset(&table, 0, sizeof(table));
sc = rtems_extension_create(name, &table, &id);
rtems_test_assert(sc == RTEMS_TOO_MANY);
+}
+
+static void test_user_extensions_delete(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
sc = rtems_extension_delete(0);
rtems_test_assert(sc == RTEMS_INVALID_ID);
@@ -246,22 +410,56 @@ static void test_some_id_to_name(void)
static void Init(rtems_task_argument arg)
{
- rtems_print_printer_printk(&rtems_test_printer);
- TEST_BEGIN();
- test_barrier();
- test_message_queue();
- test_partition();
- test_rate_monotonic();
- test_region();
- test_semaphore();
- test_task();
- test_timer();
- test_user_extensions();
+ test_barrier_create();
+ test_barrier_delete();
+ test_barrier_get();
+ test_message_queue_create();
+ test_message_queue_delete();
+ test_message_queue_get();
+ test_partition_create();
+ test_partition_delete();
+ test_partition_get();
+ test_rate_monotonic_create();
+ test_rate_monotonic_delete();
+ test_rate_monotonic_get();
+ test_region_create();
+ test_region_delete();
+ test_region_get();
+ test_semaphore_create();
+ test_semaphore_delete();
+ test_semaphore_get();
+ test_task_create();
+ test_task_delete();
+ test_task_get();
+ test_timer_create();
+ test_timer_delete();
+ test_timer_get();
+ test_user_extensions_create();
+ test_user_extensions_delete();
test_some_id_to_name();
TEST_END();
rtems_test_exit(0);
}
+static void before_object_information_initialization(void)
+{
+ rtems_print_printer_printk(&rtems_test_printer);
+ TEST_BEGIN();
+ test_barrier_get();
+ test_message_queue_get();
+ test_partition_get();
+ test_rate_monotonic_get();
+ test_semaphore_get();
+ test_task_get();
+ test_timer_get();
+}
+
+RTEMS_SYSINIT_ITEM(
+ before_object_information_initialization,
+ RTEMS_SYSINIT_INITIAL_EXTENSIONS,
+ RTEMS_SYSINIT_ORDER_LAST
+);
+
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM