forked from Imagelibrary/rtems
2002-07-01 Joel Sherrill <joel@OARcorp.com>
* Mega patch merge to change the format of the object IDs to
loosen the dependency between the SCORE and the various APIs.
There was considerable work to simplify the object name management
and it appears that the name_table field is no longer needed.
This patch also includes the addition of the internal mutex
which is currently only used to protect some types of allocation
and deallocation. This significantly can reduce context
switch latency under certain circumstances. In particular,
some heap/region operations were O(n) and had dispatching
disabled. This should help enormously. With this merge,
the patch is not as clean as it should be. In particular,
the documentation has not been modified to reflect the new object
ID layout, the IDs in the test screens are not updated, and
_Objects_Get_information needs to be a real routine not inlined.
As part of this patch a lot of MP code for thread/proxy blocking
was made conditional and cleaned up.
* include/rtems.h, inline/rtems/rtems/region.inl,
macros/rtems/rtems/region.inl, src/dpmem.c, src/dpmemcreate.c,
src/msg.c, src/msgqcreate.c, src/part.c, src/partcreate.c,
src/ratemon.c, src/ratemoncreate.c, src/region.c, src/regioncreate.c,
src/regiondelete.c, src/regionextend.c, src/regiongetinfo.c,
src/regiongetsegment.c, src/regiongetsegmentsize.c,
src/regionident.c, src/regionreturnsegment.c, src/rtemstimer.c,
src/sem.c, src/semcreate.c, src/taskcreate.c, src/taskident.c,
src/tasks.c, src/timercreate.c: Modified as part of above.
This commit is contained in:
@@ -1,3 +1,31 @@
|
|||||||
|
2002-07-01 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
|
* Mega patch merge to change the format of the object IDs to
|
||||||
|
loosen the dependency between the SCORE and the various APIs.
|
||||||
|
There was considerable work to simplify the object name management
|
||||||
|
and it appears that the name_table field is no longer needed.
|
||||||
|
This patch also includes the addition of the internal mutex
|
||||||
|
which is currently only used to protect some types of allocation
|
||||||
|
and deallocation. This significantly can reduce context
|
||||||
|
switch latency under certain circumstances. In particular,
|
||||||
|
some heap/region operations were O(n) and had dispatching
|
||||||
|
disabled. This should help enormously. With this merge,
|
||||||
|
the patch is not as clean as it should be. In particular,
|
||||||
|
the documentation has not been modified to reflect the new object
|
||||||
|
ID layout, the IDs in the test screens are not updated, and
|
||||||
|
_Objects_Get_information needs to be a real routine not inlined.
|
||||||
|
As part of this patch a lot of MP code for thread/proxy blocking
|
||||||
|
was made conditional and cleaned up.
|
||||||
|
* include/rtems.h, inline/rtems/rtems/region.inl,
|
||||||
|
macros/rtems/rtems/region.inl, src/dpmem.c, src/dpmemcreate.c,
|
||||||
|
src/msg.c, src/msgqcreate.c, src/part.c, src/partcreate.c,
|
||||||
|
src/ratemon.c, src/ratemoncreate.c, src/region.c, src/regioncreate.c,
|
||||||
|
src/regiondelete.c, src/regionextend.c, src/regiongetinfo.c,
|
||||||
|
src/regiongetsegment.c, src/regiongetsegmentsize.c,
|
||||||
|
src/regionident.c, src/regionreturnsegment.c, src/rtemstimer.c,
|
||||||
|
src/sem.c, src/semcreate.c, src/taskcreate.c, src/taskident.c,
|
||||||
|
src/tasks.c, src/timercreate.c: Modified as part of above.
|
||||||
|
|
||||||
2001-04-08 Joel Sherrill <joel@OARcorp.com>
|
2001-04-08 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
* src/tasks.c: Pre-initialized switch extension for list.
|
* src/tasks.c: Pre-initialized switch extension for list.
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ extern "C" {
|
|||||||
|
|
||||||
#define RTEMS_OBJECT_ID_INITIAL_INDEX OBJECTS_ID_INITIAL_INDEX
|
#define RTEMS_OBJECT_ID_INITIAL_INDEX OBJECTS_ID_INITIAL_INDEX
|
||||||
#define RTEMS_OBJECT_ID_FINAL_INDEX OBJECTS_ID_FINAL_INDEX
|
#define RTEMS_OBJECT_ID_FINAL_INDEX OBJECTS_ID_FINAL_INDEX
|
||||||
|
#define RTEMS_OBJECT_ID_INITIAL(api, class, node) OBJECTS_ID_INITIAL(api, class, node)
|
||||||
|
|
||||||
#define RTEMS_OBJECT_ID_INITIAL(class, node) OBJECTS_ID_INITIAL(class, node)
|
|
||||||
#define RTEMS_OBJECT_ID_FINAL OBJECTS_ID_FINAL
|
#define RTEMS_OBJECT_ID_FINAL OBJECTS_ID_FINAL
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ RTEMS_INLINE_ROUTINE Region_Control *_Region_Get (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
return (Region_Control *)
|
return (Region_Control *)
|
||||||
_Objects_Get( &_Region_Information, id, location );
|
_Objects_Get_no_protection( &_Region_Information, id, location );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
#define _Region_Get( _id, _location ) \
|
#define _Region_Get( _id, _location ) \
|
||||||
(Region_Control *) \
|
(Region_Control *) \
|
||||||
_Objects_Get( &_Region_Information, (_id), (_location) )
|
_Objects_Get_no_protection( &_Region_Information, (_id), (_location) )
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -38,13 +38,18 @@ void _Dual_ported_memory_Manager_initialization(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_Dual_ported_memory_Information,
|
&_Dual_ported_memory_Information, /* object information table */
|
||||||
OBJECTS_RTEMS_PORTS,
|
OBJECTS_CLASSIC_API, /* object API */
|
||||||
FALSE,
|
OBJECTS_RTEMS_PORTS, /* object class */
|
||||||
maximum_ports,
|
maximum_ports, /* maximum objects of this class */
|
||||||
sizeof( Dual_ported_memory_Control ),
|
sizeof( Dual_ported_memory_Control ),
|
||||||
FALSE,
|
/* size of this object's control block */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH,
|
FALSE, /* TRUE if names of this object are strings */
|
||||||
FALSE
|
RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of each object's name */
|
||||||
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
,
|
||||||
|
FALSE, /* TRUE if this is a global object class */
|
||||||
|
NULL /* Proxy extraction support callout */
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ rtems_status_code rtems_port_create(
|
|||||||
_Objects_Open(
|
_Objects_Open(
|
||||||
&_Dual_ported_memory_Information,
|
&_Dual_ported_memory_Information,
|
||||||
&the_port->Object,
|
&the_port->Object,
|
||||||
&name
|
name
|
||||||
);
|
);
|
||||||
|
|
||||||
*id = the_port->Object.id;
|
*id = the_port->Object.id;
|
||||||
|
|||||||
@@ -48,14 +48,19 @@ void _Message_queue_Manager_initialization(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_Message_queue_Information,
|
&_Message_queue_Information, /* object information table */
|
||||||
OBJECTS_RTEMS_MESSAGE_QUEUES,
|
OBJECTS_CLASSIC_API, /* object API */
|
||||||
TRUE,
|
OBJECTS_RTEMS_MESSAGE_QUEUES, /* object class */
|
||||||
maximum_message_queues,
|
maximum_message_queues, /* maximum objects of this class */
|
||||||
sizeof( Message_queue_Control ),
|
sizeof( Message_queue_Control ),
|
||||||
FALSE,
|
/* size of this object's control block */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH,
|
FALSE, /* TRUE if names of this object are strings */
|
||||||
FALSE
|
RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of each object's name */
|
||||||
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
,
|
||||||
|
FALSE, /* TRUE if this is a global object class */
|
||||||
|
NULL /* Proxy extraction support callout */
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ rtems_status_code rtems_message_queue_create(
|
|||||||
{
|
{
|
||||||
register Message_queue_Control *the_message_queue;
|
register Message_queue_Control *the_message_queue;
|
||||||
CORE_message_queue_Attributes the_msgq_attributes;
|
CORE_message_queue_Attributes the_msgq_attributes;
|
||||||
void *handler;
|
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
boolean is_global;
|
boolean is_global;
|
||||||
#endif
|
#endif
|
||||||
@@ -119,18 +118,12 @@ rtems_status_code rtems_message_queue_create(
|
|||||||
else
|
else
|
||||||
the_msgq_attributes.discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
|
the_msgq_attributes.discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
|
||||||
|
|
||||||
handler = NULL;
|
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
|
||||||
handler = _Message_queue_MP_Send_extract_proxy;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( ! _CORE_message_queue_Initialize(
|
if ( ! _CORE_message_queue_Initialize(
|
||||||
&the_message_queue->message_queue,
|
&the_message_queue->message_queue,
|
||||||
OBJECTS_RTEMS_MESSAGE_QUEUES,
|
|
||||||
&the_msgq_attributes,
|
&the_msgq_attributes,
|
||||||
count,
|
count,
|
||||||
max_message_size,
|
max_message_size
|
||||||
handler ) ) {
|
) ) {
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
if ( is_global )
|
if ( is_global )
|
||||||
_Objects_MP_Close(
|
_Objects_MP_Close(
|
||||||
@@ -145,7 +138,7 @@ rtems_status_code rtems_message_queue_create(
|
|||||||
_Objects_Open(
|
_Objects_Open(
|
||||||
&_Message_queue_Information,
|
&_Message_queue_Information,
|
||||||
&the_message_queue->Object,
|
&the_message_queue->Object,
|
||||||
&name
|
name
|
||||||
);
|
);
|
||||||
|
|
||||||
*id = the_message_queue->Object.id;
|
*id = the_message_queue->Object.id;
|
||||||
|
|||||||
@@ -39,14 +39,18 @@ void _Partition_Manager_initialization(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_Partition_Information,
|
&_Partition_Information, /* object information table */
|
||||||
OBJECTS_RTEMS_PARTITIONS,
|
OBJECTS_CLASSIC_API, /* object API */
|
||||||
TRUE,
|
OBJECTS_RTEMS_PARTITIONS, /* object class */
|
||||||
maximum_partitions,
|
maximum_partitions, /* maximum objects of this class */
|
||||||
sizeof( Partition_Control ),
|
sizeof( Partition_Control ), /* size of this object's control block */
|
||||||
FALSE,
|
FALSE, /* TRUE if the name is a string */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH,
|
RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */
|
||||||
FALSE
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
,
|
||||||
|
FALSE, /* TRUE if this is a global object class */
|
||||||
|
NULL /* Proxy extraction support callout */
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ rtems_status_code rtems_partition_create(
|
|||||||
_Chain_Initialize( &the_partition->Memory, starting_address,
|
_Chain_Initialize( &the_partition->Memory, starting_address,
|
||||||
length / buffer_size, buffer_size );
|
length / buffer_size, buffer_size );
|
||||||
|
|
||||||
_Objects_Open( &_Partition_Information, &the_partition->Object, &name );
|
_Objects_Open( &_Partition_Information, &the_partition->Object, name );
|
||||||
|
|
||||||
*id = the_partition->Object.id;
|
*id = the_partition->Object.id;
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
|||||||
@@ -41,13 +41,17 @@ void _Rate_monotonic_Manager_initialization(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_Rate_monotonic_Information,
|
&_Rate_monotonic_Information, /* object information table */
|
||||||
OBJECTS_RTEMS_PERIODS,
|
OBJECTS_CLASSIC_API, /* object API */
|
||||||
FALSE,
|
OBJECTS_RTEMS_PERIODS, /* object class */
|
||||||
maximum_periods,
|
maximum_periods, /* maximum objects of this class */
|
||||||
sizeof( Rate_monotonic_Control ),
|
sizeof( Rate_monotonic_Control ), /* size of this object's control block */
|
||||||
FALSE,
|
FALSE, /* TRUE if the name is a string */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH,
|
RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */
|
||||||
FALSE
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
,
|
||||||
|
FALSE, /* TRUE if this is a global object class */
|
||||||
|
NULL /* Proxy extraction support callout */
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ rtems_status_code rtems_rate_monotonic_create(
|
|||||||
the_period->owner = _Thread_Executing;
|
the_period->owner = _Thread_Executing;
|
||||||
the_period->state = RATE_MONOTONIC_INACTIVE;
|
the_period->state = RATE_MONOTONIC_INACTIVE;
|
||||||
|
|
||||||
_Objects_Open( &_Rate_monotonic_Information, &the_period->Object, &name );
|
_Objects_Open( &_Rate_monotonic_Information, &the_period->Object, name );
|
||||||
|
|
||||||
*id = the_period->Object.id;
|
*id = the_period->Object.id;
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
@@ -37,15 +38,23 @@ void _Region_Manager_initialization(
|
|||||||
unsigned32 maximum_regions
|
unsigned32 maximum_regions
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
/* XXX move me */
|
||||||
|
_API_Mutex_Initialization( 1 );
|
||||||
|
_API_Mutex_Allocate( _RTEMS_Allocator_Mutex );
|
||||||
|
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_Region_Information,
|
&_Region_Information, /* object information table */
|
||||||
OBJECTS_RTEMS_REGIONS,
|
OBJECTS_CLASSIC_API, /* object API */
|
||||||
FALSE,
|
OBJECTS_RTEMS_REGIONS, /* object class */
|
||||||
maximum_regions,
|
maximum_regions, /* maximum objects of this class */
|
||||||
sizeof( Region_Control ),
|
sizeof( Region_Control ), /* size of this object's control block */
|
||||||
FALSE,
|
FALSE, /* TRUE if the name is a string */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH,
|
RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */
|
||||||
FALSE
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
,
|
||||||
|
FALSE, /* TRUE if this is a global object class */
|
||||||
|
NULL /* Proxy extraction support callout */
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
@@ -59,12 +60,12 @@ rtems_status_code rtems_region_create(
|
|||||||
if ( !_Addresses_Is_aligned( starting_address ) )
|
if ( !_Addresses_Is_aligned( starting_address ) )
|
||||||
return RTEMS_INVALID_ADDRESS;
|
return RTEMS_INVALID_ADDRESS;
|
||||||
|
|
||||||
_Thread_Disable_dispatch(); /* to prevent deletion */
|
_RTEMS_Lock_allocator(); /* to prevent deletion */
|
||||||
|
|
||||||
the_region = _Region_Allocate();
|
the_region = _Region_Allocate();
|
||||||
|
|
||||||
if ( !the_region ) {
|
if ( !the_region ) {
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_TOO_MANY;
|
return RTEMS_TOO_MANY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +74,7 @@ rtems_status_code rtems_region_create(
|
|||||||
|
|
||||||
if ( !the_region->maximum_segment_size ) {
|
if ( !the_region->maximum_segment_size ) {
|
||||||
_Region_Free( the_region );
|
_Region_Free( the_region );
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_SIZE;
|
return RTEMS_INVALID_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,21 +86,15 @@ rtems_status_code rtems_region_create(
|
|||||||
|
|
||||||
_Thread_queue_Initialize(
|
_Thread_queue_Initialize(
|
||||||
&the_region->Wait_queue,
|
&the_region->Wait_queue,
|
||||||
OBJECTS_RTEMS_REGIONS,
|
|
||||||
_Attributes_Is_priority( attribute_set ) ?
|
_Attributes_Is_priority( attribute_set ) ?
|
||||||
THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
|
THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
|
||||||
STATES_WAITING_FOR_SEGMENT,
|
STATES_WAITING_FOR_SEGMENT,
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
|
||||||
_Region_MP_Send_extract_proxy,
|
|
||||||
#else
|
|
||||||
NULL,
|
|
||||||
#endif
|
|
||||||
RTEMS_TIMEOUT
|
RTEMS_TIMEOUT
|
||||||
);
|
);
|
||||||
|
|
||||||
_Objects_Open( &_Region_Information, &the_region->Object, &name );
|
_Objects_Open( &_Region_Information, &the_region->Object, name );
|
||||||
|
|
||||||
*id = the_region->Object.id;
|
*id = the_region->Object.id;
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
@@ -44,12 +45,15 @@ rtems_status_code rtems_region_delete(
|
|||||||
register Region_Control *the_region;
|
register Region_Control *the_region;
|
||||||
Objects_Locations location;
|
Objects_Locations location;
|
||||||
|
|
||||||
|
_RTEMS_Lock_allocator();
|
||||||
the_region = _Region_Get( id, &location );
|
the_region = _Region_Get( id, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_REMOTE: /* this error cannot be returned */
|
case OBJECTS_REMOTE: /* this error cannot be returned */
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INTERNAL_ERROR;
|
return RTEMS_INTERNAL_ERROR;
|
||||||
|
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ID;
|
return RTEMS_INVALID_ID;
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
@@ -57,10 +61,10 @@ rtems_status_code rtems_region_delete(
|
|||||||
if ( the_region->number_of_used_blocks == 0 ) {
|
if ( the_region->number_of_used_blocks == 0 ) {
|
||||||
_Objects_Close( &_Region_Information, &the_region->Object );
|
_Objects_Close( &_Region_Information, &the_region->Object );
|
||||||
_Region_Free( the_region );
|
_Region_Free( the_region );
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_RESOURCE_IN_USE;
|
return RTEMS_RESOURCE_IN_USE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
@@ -52,12 +53,15 @@ rtems_status_code rtems_region_extend(
|
|||||||
|
|
||||||
status = RTEMS_SUCCESSFUL;
|
status = RTEMS_SUCCESSFUL;
|
||||||
|
|
||||||
|
_RTEMS_Lock_allocator(); /* to prevent deletion */
|
||||||
the_region = _Region_Get( id, &location );
|
the_region = _Region_Get( id, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_REMOTE: /* this error cannot be returned */
|
case OBJECTS_REMOTE: /* this error cannot be returned */
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INTERNAL_ERROR;
|
return RTEMS_INTERNAL_ERROR;
|
||||||
|
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ID;
|
return RTEMS_INVALID_ID;
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
@@ -81,7 +85,7 @@ rtems_status_code rtems_region_extend(
|
|||||||
status = RTEMS_NOT_IMPLEMENTED;
|
status = RTEMS_NOT_IMPLEMENTED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return( status );
|
return( status );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <rtems/rtems/options.h>
|
#include <rtems/rtems/options.h>
|
||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
@@ -48,21 +49,24 @@ rtems_status_code rtems_region_get_information(
|
|||||||
if ( !the_info )
|
if ( !the_info )
|
||||||
return RTEMS_INVALID_ADDRESS;
|
return RTEMS_INVALID_ADDRESS;
|
||||||
|
|
||||||
|
_RTEMS_Lock_allocator();
|
||||||
the_region = _Region_Get( id, &location );
|
the_region = _Region_Get( id, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_REMOTE: /* this error cannot be returned */
|
case OBJECTS_REMOTE: /* this error cannot be returned */
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INTERNAL_ERROR;
|
return RTEMS_INTERNAL_ERROR;
|
||||||
|
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ID;
|
return RTEMS_INVALID_ID;
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
|
|
||||||
if ( _Heap_Get_information( &the_region->Memory, the_info ) ) {
|
if ( _Heap_Get_information( &the_region->Memory, the_info ) ) {
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ADDRESS;
|
return RTEMS_INVALID_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
@@ -58,18 +59,21 @@ rtems_status_code rtems_region_get_segment(
|
|||||||
if ( size == 0 )
|
if ( size == 0 )
|
||||||
return RTEMS_INVALID_SIZE;
|
return RTEMS_INVALID_SIZE;
|
||||||
|
|
||||||
|
_RTEMS_Lock_allocator();
|
||||||
executing = _Thread_Executing;
|
executing = _Thread_Executing;
|
||||||
the_region = _Region_Get( id, &location );
|
the_region = _Region_Get( id, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_REMOTE: /* this error cannot be returned */
|
case OBJECTS_REMOTE: /* this error cannot be returned */
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INTERNAL_ERROR;
|
return RTEMS_INTERNAL_ERROR;
|
||||||
|
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ID;
|
return RTEMS_INVALID_ID;
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
if ( size > the_region->maximum_segment_size ) {
|
if ( size > the_region->maximum_segment_size ) {
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_SIZE;
|
return RTEMS_INVALID_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,13 +85,13 @@ rtems_status_code rtems_region_get_segment(
|
|||||||
|
|
||||||
if ( the_segment ) {
|
if ( the_segment ) {
|
||||||
the_region->number_of_used_blocks += 1;
|
the_region->number_of_used_blocks += 1;
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
*segment = the_segment;
|
*segment = the_segment;
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( _Options_Is_no_wait( option_set ) ) {
|
if ( _Options_Is_no_wait( option_set ) ) {
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_UNSATISFIED;
|
return RTEMS_UNSATISFIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +104,7 @@ rtems_status_code rtems_region_get_segment(
|
|||||||
|
|
||||||
_Thread_queue_Enqueue( &the_region->Wait_queue, timeout );
|
_Thread_queue_Enqueue( &the_region->Wait_queue, timeout );
|
||||||
|
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return (rtems_status_code) executing->Wait.return_code;
|
return (rtems_status_code) executing->Wait.return_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
@@ -48,22 +49,25 @@ rtems_status_code rtems_region_get_segment_size(
|
|||||||
Objects_Locations location;
|
Objects_Locations location;
|
||||||
Thread_Control *executing;
|
Thread_Control *executing;
|
||||||
|
|
||||||
|
_RTEMS_Lock_allocator();
|
||||||
executing = _Thread_Executing;
|
executing = _Thread_Executing;
|
||||||
the_region = _Region_Get( id, &location );
|
the_region = _Region_Get( id, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_REMOTE: /* this error cannot be returned */
|
case OBJECTS_REMOTE: /* this error cannot be returned */
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INTERNAL_ERROR;
|
return RTEMS_INTERNAL_ERROR;
|
||||||
|
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ID;
|
return RTEMS_INVALID_ID;
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
|
|
||||||
if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) {
|
if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) {
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ADDRESS;
|
return RTEMS_INVALID_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
@@ -58,13 +59,16 @@ rtems_status_code rtems_region_return_segment(
|
|||||||
#endif
|
#endif
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
_RTEMS_Lock_allocator();
|
||||||
the_region = _Region_Get( id, &location );
|
the_region = _Region_Get( id, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
|
|
||||||
case OBJECTS_REMOTE: /* this error cannot be returned */
|
case OBJECTS_REMOTE: /* this error cannot be returned */
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INTERNAL_ERROR;
|
return RTEMS_INTERNAL_ERROR;
|
||||||
|
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ID;
|
return RTEMS_INVALID_ID;
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
@@ -75,7 +79,7 @@ rtems_status_code rtems_region_return_segment(
|
|||||||
if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) {
|
if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) {
|
||||||
memset(segment, (RTEMS_REGION_FREE_SHRED_PATTERN & 0xFF), size);
|
memset(segment, (RTEMS_REGION_FREE_SHRED_PATTERN & 0xFF), size);
|
||||||
} else {
|
} else {
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ADDRESS;
|
return RTEMS_INVALID_ADDRESS;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -85,7 +89,7 @@ rtems_status_code rtems_region_return_segment(
|
|||||||
_Region_Debug_Walk( the_region, 4 );
|
_Region_Debug_Walk( the_region, 4 );
|
||||||
|
|
||||||
if ( !status ) {
|
if ( !status ) {
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ADDRESS;
|
return RTEMS_INVALID_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +114,7 @@ rtems_status_code rtems_region_return_segment(
|
|||||||
the_thread->Wait.return_code = RTEMS_SUCCESSFUL;
|
the_thread->Wait.return_code = RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,14 +38,18 @@ void _Timer_Manager_initialization(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_Timer_Information,
|
&_Timer_Information, /* object information table */
|
||||||
OBJECTS_RTEMS_TIMERS,
|
OBJECTS_CLASSIC_API, /* object API */
|
||||||
FALSE,
|
OBJECTS_RTEMS_TIMERS, /* object class */
|
||||||
maximum_timers,
|
maximum_timers, /* maximum objects of this class */
|
||||||
sizeof( Timer_Control ),
|
sizeof( Timer_Control ), /* size of this object's control block */
|
||||||
FALSE,
|
FALSE, /* TRUE if the name is a string */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH,
|
RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */
|
||||||
FALSE
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
,
|
||||||
|
FALSE, /* TRUE if this is a global object class */
|
||||||
|
NULL /* Proxy extraction support callout */
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -62,14 +62,18 @@ void _Semaphore_Manager_initialization(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_Semaphore_Information,
|
&_Semaphore_Information, /* object information table */
|
||||||
OBJECTS_RTEMS_SEMAPHORES,
|
OBJECTS_CLASSIC_API, /* object API */
|
||||||
TRUE,
|
OBJECTS_RTEMS_SEMAPHORES, /* object class */
|
||||||
maximum_semaphores,
|
maximum_semaphores, /* maximum objects of this class */
|
||||||
sizeof( Semaphore_Control ),
|
sizeof( Semaphore_Control ), /* size of this object's control block */
|
||||||
FALSE,
|
FALSE, /* TRUE if the name is a string */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH,
|
RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */
|
||||||
FALSE
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
,
|
||||||
|
FALSE, /* TRUE if this is a global object class */
|
||||||
|
NULL /* Proxy extraction support callout */
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -172,14 +172,8 @@ rtems_status_code rtems_semaphore_create(
|
|||||||
|
|
||||||
_CORE_mutex_Initialize(
|
_CORE_mutex_Initialize(
|
||||||
&the_semaphore->Core_control.mutex,
|
&the_semaphore->Core_control.mutex,
|
||||||
OBJECTS_RTEMS_SEMAPHORES,
|
|
||||||
&the_mutex_attributes,
|
&the_mutex_attributes,
|
||||||
lock,
|
lock
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
|
||||||
_Semaphore_MP_Send_extract_proxy
|
|
||||||
#else
|
|
||||||
NULL
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if ( _Attributes_Is_priority( attribute_set ) )
|
if ( _Attributes_Is_priority( attribute_set ) )
|
||||||
@@ -202,18 +196,12 @@ rtems_status_code rtems_semaphore_create(
|
|||||||
|
|
||||||
_CORE_semaphore_Initialize(
|
_CORE_semaphore_Initialize(
|
||||||
&the_semaphore->Core_control.semaphore,
|
&the_semaphore->Core_control.semaphore,
|
||||||
OBJECTS_RTEMS_SEMAPHORES,
|
|
||||||
&the_semaphore_attributes,
|
&the_semaphore_attributes,
|
||||||
count,
|
count
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
|
||||||
_Semaphore_MP_Send_extract_proxy
|
|
||||||
#else
|
|
||||||
NULL
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Objects_Open( &_Semaphore_Information, &the_semaphore->Object, &name );
|
_Objects_Open( &_Semaphore_Information, &the_semaphore->Object, name );
|
||||||
|
|
||||||
*id = the_semaphore->Object.id;
|
*id = the_semaphore->Object.id;
|
||||||
|
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ rtems_status_code rtems_task_create(
|
|||||||
THREAD_CPU_BUDGET_ALGORITHM_NONE,
|
THREAD_CPU_BUDGET_ALGORITHM_NONE,
|
||||||
NULL, /* no budget algorithm callout */
|
NULL, /* no budget algorithm callout */
|
||||||
_Modes_Get_interrupt_level(initial_modes),
|
_Modes_Get_interrupt_level(initial_modes),
|
||||||
&name
|
name
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( !status ) {
|
if ( !status ) {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ rtems_status_code rtems_task_ident(
|
|||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = _Objects_Name_to_id( &_RTEMS_tasks_Information, &name, node, id );
|
status = _Objects_Name_to_id( &_RTEMS_tasks_Information, name, node, id );
|
||||||
|
|
||||||
return _Status_Object_name_errors_to_status[ status ];
|
return _Status_Object_name_errors_to_status[ status ];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -249,14 +249,18 @@ void _RTEMS_tasks_Manager_initialization(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_RTEMS_tasks_Information,
|
&_RTEMS_tasks_Information, /* object information table */
|
||||||
OBJECTS_RTEMS_TASKS,
|
OBJECTS_CLASSIC_API, /* object API */
|
||||||
TRUE,
|
OBJECTS_RTEMS_TASKS, /* object class */
|
||||||
maximum_tasks,
|
maximum_tasks, /* maximum objects of this class */
|
||||||
sizeof( Thread_Control ),
|
sizeof( Thread_Control ), /* size of this object's control block */
|
||||||
FALSE,
|
FALSE, /* TRUE if the name is a string */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH,
|
RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */
|
||||||
TRUE
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
,
|
||||||
|
FALSE, /* TRUE if this is a global object class */
|
||||||
|
NULL /* Proxy extraction support callout */
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ rtems_status_code rtems_timer_create(
|
|||||||
|
|
||||||
the_timer->the_class = TIMER_DORMANT;
|
the_timer->the_class = TIMER_DORMANT;
|
||||||
|
|
||||||
_Objects_Open( &_Timer_Information, &the_timer->Object, &name );
|
_Objects_Open( &_Timer_Information, &the_timer->Object, name );
|
||||||
|
|
||||||
*id = the_timer->Object.id;
|
*id = the_timer->Object.id;
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
|
|||||||
@@ -1,3 +1,31 @@
|
|||||||
|
2002-07-01 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
|
* Mega patch merge to change the format of the object IDs to
|
||||||
|
loosen the dependency between the SCORE and the various APIs.
|
||||||
|
There was considerable work to simplify the object name management
|
||||||
|
and it appears that the name_table field is no longer needed.
|
||||||
|
This patch also includes the addition of the internal mutex
|
||||||
|
which is currently only used to protect some types of allocation
|
||||||
|
and deallocation. This significantly can reduce context
|
||||||
|
switch latency under certain circumstances. In particular,
|
||||||
|
some heap/region operations were O(n) and had dispatching
|
||||||
|
disabled. This should help enormously. With this merge,
|
||||||
|
the patch is not as clean as it should be. In particular,
|
||||||
|
the documentation has not been modified to reflect the new object
|
||||||
|
ID layout, the IDs in the test screens are not updated, and
|
||||||
|
_Objects_Get_information needs to be a real routine not inlined.
|
||||||
|
As part of this patch a lot of MP code for thread/proxy blocking
|
||||||
|
was made conditional and cleaned up.
|
||||||
|
* include/rtems.h, inline/rtems/rtems/region.inl,
|
||||||
|
macros/rtems/rtems/region.inl, src/dpmem.c, src/dpmemcreate.c,
|
||||||
|
src/msg.c, src/msgqcreate.c, src/part.c, src/partcreate.c,
|
||||||
|
src/ratemon.c, src/ratemoncreate.c, src/region.c, src/regioncreate.c,
|
||||||
|
src/regiondelete.c, src/regionextend.c, src/regiongetinfo.c,
|
||||||
|
src/regiongetsegment.c, src/regiongetsegmentsize.c,
|
||||||
|
src/regionident.c, src/regionreturnsegment.c, src/rtemstimer.c,
|
||||||
|
src/sem.c, src/semcreate.c, src/taskcreate.c, src/taskident.c,
|
||||||
|
src/tasks.c, src/timercreate.c: Modified as part of above.
|
||||||
|
|
||||||
2001-04-08 Joel Sherrill <joel@OARcorp.com>
|
2001-04-08 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
* src/tasks.c: Pre-initialized switch extension for list.
|
* src/tasks.c: Pre-initialized switch extension for list.
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ extern "C" {
|
|||||||
|
|
||||||
#define RTEMS_OBJECT_ID_INITIAL_INDEX OBJECTS_ID_INITIAL_INDEX
|
#define RTEMS_OBJECT_ID_INITIAL_INDEX OBJECTS_ID_INITIAL_INDEX
|
||||||
#define RTEMS_OBJECT_ID_FINAL_INDEX OBJECTS_ID_FINAL_INDEX
|
#define RTEMS_OBJECT_ID_FINAL_INDEX OBJECTS_ID_FINAL_INDEX
|
||||||
|
#define RTEMS_OBJECT_ID_INITIAL(api, class, node) OBJECTS_ID_INITIAL(api, class, node)
|
||||||
|
|
||||||
#define RTEMS_OBJECT_ID_INITIAL(class, node) OBJECTS_ID_INITIAL(class, node)
|
|
||||||
#define RTEMS_OBJECT_ID_FINAL OBJECTS_ID_FINAL
|
#define RTEMS_OBJECT_ID_FINAL OBJECTS_ID_FINAL
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ RTEMS_INLINE_ROUTINE Region_Control *_Region_Get (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
return (Region_Control *)
|
return (Region_Control *)
|
||||||
_Objects_Get( &_Region_Information, id, location );
|
_Objects_Get_no_protection( &_Region_Information, id, location );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
#define _Region_Get( _id, _location ) \
|
#define _Region_Get( _id, _location ) \
|
||||||
(Region_Control *) \
|
(Region_Control *) \
|
||||||
_Objects_Get( &_Region_Information, (_id), (_location) )
|
_Objects_Get_no_protection( &_Region_Information, (_id), (_location) )
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -38,13 +38,18 @@ void _Dual_ported_memory_Manager_initialization(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_Dual_ported_memory_Information,
|
&_Dual_ported_memory_Information, /* object information table */
|
||||||
OBJECTS_RTEMS_PORTS,
|
OBJECTS_CLASSIC_API, /* object API */
|
||||||
FALSE,
|
OBJECTS_RTEMS_PORTS, /* object class */
|
||||||
maximum_ports,
|
maximum_ports, /* maximum objects of this class */
|
||||||
sizeof( Dual_ported_memory_Control ),
|
sizeof( Dual_ported_memory_Control ),
|
||||||
FALSE,
|
/* size of this object's control block */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH,
|
FALSE, /* TRUE if names of this object are strings */
|
||||||
FALSE
|
RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of each object's name */
|
||||||
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
,
|
||||||
|
FALSE, /* TRUE if this is a global object class */
|
||||||
|
NULL /* Proxy extraction support callout */
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ rtems_status_code rtems_port_create(
|
|||||||
_Objects_Open(
|
_Objects_Open(
|
||||||
&_Dual_ported_memory_Information,
|
&_Dual_ported_memory_Information,
|
||||||
&the_port->Object,
|
&the_port->Object,
|
||||||
&name
|
name
|
||||||
);
|
);
|
||||||
|
|
||||||
*id = the_port->Object.id;
|
*id = the_port->Object.id;
|
||||||
|
|||||||
@@ -48,14 +48,19 @@ void _Message_queue_Manager_initialization(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_Message_queue_Information,
|
&_Message_queue_Information, /* object information table */
|
||||||
OBJECTS_RTEMS_MESSAGE_QUEUES,
|
OBJECTS_CLASSIC_API, /* object API */
|
||||||
TRUE,
|
OBJECTS_RTEMS_MESSAGE_QUEUES, /* object class */
|
||||||
maximum_message_queues,
|
maximum_message_queues, /* maximum objects of this class */
|
||||||
sizeof( Message_queue_Control ),
|
sizeof( Message_queue_Control ),
|
||||||
FALSE,
|
/* size of this object's control block */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH,
|
FALSE, /* TRUE if names of this object are strings */
|
||||||
FALSE
|
RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of each object's name */
|
||||||
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
,
|
||||||
|
FALSE, /* TRUE if this is a global object class */
|
||||||
|
NULL /* Proxy extraction support callout */
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ rtems_status_code rtems_message_queue_create(
|
|||||||
{
|
{
|
||||||
register Message_queue_Control *the_message_queue;
|
register Message_queue_Control *the_message_queue;
|
||||||
CORE_message_queue_Attributes the_msgq_attributes;
|
CORE_message_queue_Attributes the_msgq_attributes;
|
||||||
void *handler;
|
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
boolean is_global;
|
boolean is_global;
|
||||||
#endif
|
#endif
|
||||||
@@ -119,18 +118,12 @@ rtems_status_code rtems_message_queue_create(
|
|||||||
else
|
else
|
||||||
the_msgq_attributes.discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
|
the_msgq_attributes.discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
|
||||||
|
|
||||||
handler = NULL;
|
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
|
||||||
handler = _Message_queue_MP_Send_extract_proxy;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( ! _CORE_message_queue_Initialize(
|
if ( ! _CORE_message_queue_Initialize(
|
||||||
&the_message_queue->message_queue,
|
&the_message_queue->message_queue,
|
||||||
OBJECTS_RTEMS_MESSAGE_QUEUES,
|
|
||||||
&the_msgq_attributes,
|
&the_msgq_attributes,
|
||||||
count,
|
count,
|
||||||
max_message_size,
|
max_message_size
|
||||||
handler ) ) {
|
) ) {
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
if ( is_global )
|
if ( is_global )
|
||||||
_Objects_MP_Close(
|
_Objects_MP_Close(
|
||||||
@@ -145,7 +138,7 @@ rtems_status_code rtems_message_queue_create(
|
|||||||
_Objects_Open(
|
_Objects_Open(
|
||||||
&_Message_queue_Information,
|
&_Message_queue_Information,
|
||||||
&the_message_queue->Object,
|
&the_message_queue->Object,
|
||||||
&name
|
name
|
||||||
);
|
);
|
||||||
|
|
||||||
*id = the_message_queue->Object.id;
|
*id = the_message_queue->Object.id;
|
||||||
|
|||||||
@@ -39,14 +39,18 @@ void _Partition_Manager_initialization(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_Partition_Information,
|
&_Partition_Information, /* object information table */
|
||||||
OBJECTS_RTEMS_PARTITIONS,
|
OBJECTS_CLASSIC_API, /* object API */
|
||||||
TRUE,
|
OBJECTS_RTEMS_PARTITIONS, /* object class */
|
||||||
maximum_partitions,
|
maximum_partitions, /* maximum objects of this class */
|
||||||
sizeof( Partition_Control ),
|
sizeof( Partition_Control ), /* size of this object's control block */
|
||||||
FALSE,
|
FALSE, /* TRUE if the name is a string */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH,
|
RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */
|
||||||
FALSE
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
,
|
||||||
|
FALSE, /* TRUE if this is a global object class */
|
||||||
|
NULL /* Proxy extraction support callout */
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ rtems_status_code rtems_partition_create(
|
|||||||
_Chain_Initialize( &the_partition->Memory, starting_address,
|
_Chain_Initialize( &the_partition->Memory, starting_address,
|
||||||
length / buffer_size, buffer_size );
|
length / buffer_size, buffer_size );
|
||||||
|
|
||||||
_Objects_Open( &_Partition_Information, &the_partition->Object, &name );
|
_Objects_Open( &_Partition_Information, &the_partition->Object, name );
|
||||||
|
|
||||||
*id = the_partition->Object.id;
|
*id = the_partition->Object.id;
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
|||||||
@@ -41,13 +41,17 @@ void _Rate_monotonic_Manager_initialization(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_Rate_monotonic_Information,
|
&_Rate_monotonic_Information, /* object information table */
|
||||||
OBJECTS_RTEMS_PERIODS,
|
OBJECTS_CLASSIC_API, /* object API */
|
||||||
FALSE,
|
OBJECTS_RTEMS_PERIODS, /* object class */
|
||||||
maximum_periods,
|
maximum_periods, /* maximum objects of this class */
|
||||||
sizeof( Rate_monotonic_Control ),
|
sizeof( Rate_monotonic_Control ), /* size of this object's control block */
|
||||||
FALSE,
|
FALSE, /* TRUE if the name is a string */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH,
|
RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */
|
||||||
FALSE
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
,
|
||||||
|
FALSE, /* TRUE if this is a global object class */
|
||||||
|
NULL /* Proxy extraction support callout */
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ rtems_status_code rtems_rate_monotonic_create(
|
|||||||
the_period->owner = _Thread_Executing;
|
the_period->owner = _Thread_Executing;
|
||||||
the_period->state = RATE_MONOTONIC_INACTIVE;
|
the_period->state = RATE_MONOTONIC_INACTIVE;
|
||||||
|
|
||||||
_Objects_Open( &_Rate_monotonic_Information, &the_period->Object, &name );
|
_Objects_Open( &_Rate_monotonic_Information, &the_period->Object, name );
|
||||||
|
|
||||||
*id = the_period->Object.id;
|
*id = the_period->Object.id;
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
@@ -37,15 +38,23 @@ void _Region_Manager_initialization(
|
|||||||
unsigned32 maximum_regions
|
unsigned32 maximum_regions
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
/* XXX move me */
|
||||||
|
_API_Mutex_Initialization( 1 );
|
||||||
|
_API_Mutex_Allocate( _RTEMS_Allocator_Mutex );
|
||||||
|
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_Region_Information,
|
&_Region_Information, /* object information table */
|
||||||
OBJECTS_RTEMS_REGIONS,
|
OBJECTS_CLASSIC_API, /* object API */
|
||||||
FALSE,
|
OBJECTS_RTEMS_REGIONS, /* object class */
|
||||||
maximum_regions,
|
maximum_regions, /* maximum objects of this class */
|
||||||
sizeof( Region_Control ),
|
sizeof( Region_Control ), /* size of this object's control block */
|
||||||
FALSE,
|
FALSE, /* TRUE if the name is a string */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH,
|
RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */
|
||||||
FALSE
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
,
|
||||||
|
FALSE, /* TRUE if this is a global object class */
|
||||||
|
NULL /* Proxy extraction support callout */
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
@@ -59,12 +60,12 @@ rtems_status_code rtems_region_create(
|
|||||||
if ( !_Addresses_Is_aligned( starting_address ) )
|
if ( !_Addresses_Is_aligned( starting_address ) )
|
||||||
return RTEMS_INVALID_ADDRESS;
|
return RTEMS_INVALID_ADDRESS;
|
||||||
|
|
||||||
_Thread_Disable_dispatch(); /* to prevent deletion */
|
_RTEMS_Lock_allocator(); /* to prevent deletion */
|
||||||
|
|
||||||
the_region = _Region_Allocate();
|
the_region = _Region_Allocate();
|
||||||
|
|
||||||
if ( !the_region ) {
|
if ( !the_region ) {
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_TOO_MANY;
|
return RTEMS_TOO_MANY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +74,7 @@ rtems_status_code rtems_region_create(
|
|||||||
|
|
||||||
if ( !the_region->maximum_segment_size ) {
|
if ( !the_region->maximum_segment_size ) {
|
||||||
_Region_Free( the_region );
|
_Region_Free( the_region );
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_SIZE;
|
return RTEMS_INVALID_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,21 +86,15 @@ rtems_status_code rtems_region_create(
|
|||||||
|
|
||||||
_Thread_queue_Initialize(
|
_Thread_queue_Initialize(
|
||||||
&the_region->Wait_queue,
|
&the_region->Wait_queue,
|
||||||
OBJECTS_RTEMS_REGIONS,
|
|
||||||
_Attributes_Is_priority( attribute_set ) ?
|
_Attributes_Is_priority( attribute_set ) ?
|
||||||
THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
|
THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
|
||||||
STATES_WAITING_FOR_SEGMENT,
|
STATES_WAITING_FOR_SEGMENT,
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
|
||||||
_Region_MP_Send_extract_proxy,
|
|
||||||
#else
|
|
||||||
NULL,
|
|
||||||
#endif
|
|
||||||
RTEMS_TIMEOUT
|
RTEMS_TIMEOUT
|
||||||
);
|
);
|
||||||
|
|
||||||
_Objects_Open( &_Region_Information, &the_region->Object, &name );
|
_Objects_Open( &_Region_Information, &the_region->Object, name );
|
||||||
|
|
||||||
*id = the_region->Object.id;
|
*id = the_region->Object.id;
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
@@ -44,12 +45,15 @@ rtems_status_code rtems_region_delete(
|
|||||||
register Region_Control *the_region;
|
register Region_Control *the_region;
|
||||||
Objects_Locations location;
|
Objects_Locations location;
|
||||||
|
|
||||||
|
_RTEMS_Lock_allocator();
|
||||||
the_region = _Region_Get( id, &location );
|
the_region = _Region_Get( id, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_REMOTE: /* this error cannot be returned */
|
case OBJECTS_REMOTE: /* this error cannot be returned */
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INTERNAL_ERROR;
|
return RTEMS_INTERNAL_ERROR;
|
||||||
|
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ID;
|
return RTEMS_INVALID_ID;
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
@@ -57,10 +61,10 @@ rtems_status_code rtems_region_delete(
|
|||||||
if ( the_region->number_of_used_blocks == 0 ) {
|
if ( the_region->number_of_used_blocks == 0 ) {
|
||||||
_Objects_Close( &_Region_Information, &the_region->Object );
|
_Objects_Close( &_Region_Information, &the_region->Object );
|
||||||
_Region_Free( the_region );
|
_Region_Free( the_region );
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_RESOURCE_IN_USE;
|
return RTEMS_RESOURCE_IN_USE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
@@ -52,12 +53,15 @@ rtems_status_code rtems_region_extend(
|
|||||||
|
|
||||||
status = RTEMS_SUCCESSFUL;
|
status = RTEMS_SUCCESSFUL;
|
||||||
|
|
||||||
|
_RTEMS_Lock_allocator(); /* to prevent deletion */
|
||||||
the_region = _Region_Get( id, &location );
|
the_region = _Region_Get( id, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_REMOTE: /* this error cannot be returned */
|
case OBJECTS_REMOTE: /* this error cannot be returned */
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INTERNAL_ERROR;
|
return RTEMS_INTERNAL_ERROR;
|
||||||
|
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ID;
|
return RTEMS_INVALID_ID;
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
@@ -81,7 +85,7 @@ rtems_status_code rtems_region_extend(
|
|||||||
status = RTEMS_NOT_IMPLEMENTED;
|
status = RTEMS_NOT_IMPLEMENTED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return( status );
|
return( status );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <rtems/rtems/options.h>
|
#include <rtems/rtems/options.h>
|
||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
@@ -48,21 +49,24 @@ rtems_status_code rtems_region_get_information(
|
|||||||
if ( !the_info )
|
if ( !the_info )
|
||||||
return RTEMS_INVALID_ADDRESS;
|
return RTEMS_INVALID_ADDRESS;
|
||||||
|
|
||||||
|
_RTEMS_Lock_allocator();
|
||||||
the_region = _Region_Get( id, &location );
|
the_region = _Region_Get( id, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_REMOTE: /* this error cannot be returned */
|
case OBJECTS_REMOTE: /* this error cannot be returned */
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INTERNAL_ERROR;
|
return RTEMS_INTERNAL_ERROR;
|
||||||
|
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ID;
|
return RTEMS_INVALID_ID;
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
|
|
||||||
if ( _Heap_Get_information( &the_region->Memory, the_info ) ) {
|
if ( _Heap_Get_information( &the_region->Memory, the_info ) ) {
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ADDRESS;
|
return RTEMS_INVALID_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
@@ -58,18 +59,21 @@ rtems_status_code rtems_region_get_segment(
|
|||||||
if ( size == 0 )
|
if ( size == 0 )
|
||||||
return RTEMS_INVALID_SIZE;
|
return RTEMS_INVALID_SIZE;
|
||||||
|
|
||||||
|
_RTEMS_Lock_allocator();
|
||||||
executing = _Thread_Executing;
|
executing = _Thread_Executing;
|
||||||
the_region = _Region_Get( id, &location );
|
the_region = _Region_Get( id, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_REMOTE: /* this error cannot be returned */
|
case OBJECTS_REMOTE: /* this error cannot be returned */
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INTERNAL_ERROR;
|
return RTEMS_INTERNAL_ERROR;
|
||||||
|
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ID;
|
return RTEMS_INVALID_ID;
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
if ( size > the_region->maximum_segment_size ) {
|
if ( size > the_region->maximum_segment_size ) {
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_SIZE;
|
return RTEMS_INVALID_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,13 +85,13 @@ rtems_status_code rtems_region_get_segment(
|
|||||||
|
|
||||||
if ( the_segment ) {
|
if ( the_segment ) {
|
||||||
the_region->number_of_used_blocks += 1;
|
the_region->number_of_used_blocks += 1;
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
*segment = the_segment;
|
*segment = the_segment;
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( _Options_Is_no_wait( option_set ) ) {
|
if ( _Options_Is_no_wait( option_set ) ) {
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_UNSATISFIED;
|
return RTEMS_UNSATISFIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +104,7 @@ rtems_status_code rtems_region_get_segment(
|
|||||||
|
|
||||||
_Thread_queue_Enqueue( &the_region->Wait_queue, timeout );
|
_Thread_queue_Enqueue( &the_region->Wait_queue, timeout );
|
||||||
|
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return (rtems_status_code) executing->Wait.return_code;
|
return (rtems_status_code) executing->Wait.return_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
@@ -48,22 +49,25 @@ rtems_status_code rtems_region_get_segment_size(
|
|||||||
Objects_Locations location;
|
Objects_Locations location;
|
||||||
Thread_Control *executing;
|
Thread_Control *executing;
|
||||||
|
|
||||||
|
_RTEMS_Lock_allocator();
|
||||||
executing = _Thread_Executing;
|
executing = _Thread_Executing;
|
||||||
the_region = _Region_Get( id, &location );
|
the_region = _Region_Get( id, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_REMOTE: /* this error cannot be returned */
|
case OBJECTS_REMOTE: /* this error cannot be returned */
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INTERNAL_ERROR;
|
return RTEMS_INTERNAL_ERROR;
|
||||||
|
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ID;
|
return RTEMS_INVALID_ID;
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
|
|
||||||
if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) {
|
if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) {
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ADDRESS;
|
return RTEMS_INVALID_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <rtems/rtems/region.h>
|
#include <rtems/rtems/region.h>
|
||||||
#include <rtems/score/states.h>
|
#include <rtems/score/states.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/apimutex.h>
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
@@ -58,13 +59,16 @@ rtems_status_code rtems_region_return_segment(
|
|||||||
#endif
|
#endif
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
_RTEMS_Lock_allocator();
|
||||||
the_region = _Region_Get( id, &location );
|
the_region = _Region_Get( id, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
|
|
||||||
case OBJECTS_REMOTE: /* this error cannot be returned */
|
case OBJECTS_REMOTE: /* this error cannot be returned */
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INTERNAL_ERROR;
|
return RTEMS_INTERNAL_ERROR;
|
||||||
|
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ID;
|
return RTEMS_INVALID_ID;
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
@@ -75,7 +79,7 @@ rtems_status_code rtems_region_return_segment(
|
|||||||
if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) {
|
if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) {
|
||||||
memset(segment, (RTEMS_REGION_FREE_SHRED_PATTERN & 0xFF), size);
|
memset(segment, (RTEMS_REGION_FREE_SHRED_PATTERN & 0xFF), size);
|
||||||
} else {
|
} else {
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ADDRESS;
|
return RTEMS_INVALID_ADDRESS;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -85,7 +89,7 @@ rtems_status_code rtems_region_return_segment(
|
|||||||
_Region_Debug_Walk( the_region, 4 );
|
_Region_Debug_Walk( the_region, 4 );
|
||||||
|
|
||||||
if ( !status ) {
|
if ( !status ) {
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_INVALID_ADDRESS;
|
return RTEMS_INVALID_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +114,7 @@ rtems_status_code rtems_region_return_segment(
|
|||||||
the_thread->Wait.return_code = RTEMS_SUCCESSFUL;
|
the_thread->Wait.return_code = RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Thread_Enable_dispatch();
|
_RTEMS_Unlock_allocator();
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,14 +38,18 @@ void _Timer_Manager_initialization(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_Timer_Information,
|
&_Timer_Information, /* object information table */
|
||||||
OBJECTS_RTEMS_TIMERS,
|
OBJECTS_CLASSIC_API, /* object API */
|
||||||
FALSE,
|
OBJECTS_RTEMS_TIMERS, /* object class */
|
||||||
maximum_timers,
|
maximum_timers, /* maximum objects of this class */
|
||||||
sizeof( Timer_Control ),
|
sizeof( Timer_Control ), /* size of this object's control block */
|
||||||
FALSE,
|
FALSE, /* TRUE if the name is a string */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH,
|
RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */
|
||||||
FALSE
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
,
|
||||||
|
FALSE, /* TRUE if this is a global object class */
|
||||||
|
NULL /* Proxy extraction support callout */
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -62,14 +62,18 @@ void _Semaphore_Manager_initialization(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_Semaphore_Information,
|
&_Semaphore_Information, /* object information table */
|
||||||
OBJECTS_RTEMS_SEMAPHORES,
|
OBJECTS_CLASSIC_API, /* object API */
|
||||||
TRUE,
|
OBJECTS_RTEMS_SEMAPHORES, /* object class */
|
||||||
maximum_semaphores,
|
maximum_semaphores, /* maximum objects of this class */
|
||||||
sizeof( Semaphore_Control ),
|
sizeof( Semaphore_Control ), /* size of this object's control block */
|
||||||
FALSE,
|
FALSE, /* TRUE if the name is a string */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH,
|
RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */
|
||||||
FALSE
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
,
|
||||||
|
FALSE, /* TRUE if this is a global object class */
|
||||||
|
NULL /* Proxy extraction support callout */
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -172,14 +172,8 @@ rtems_status_code rtems_semaphore_create(
|
|||||||
|
|
||||||
_CORE_mutex_Initialize(
|
_CORE_mutex_Initialize(
|
||||||
&the_semaphore->Core_control.mutex,
|
&the_semaphore->Core_control.mutex,
|
||||||
OBJECTS_RTEMS_SEMAPHORES,
|
|
||||||
&the_mutex_attributes,
|
&the_mutex_attributes,
|
||||||
lock,
|
lock
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
|
||||||
_Semaphore_MP_Send_extract_proxy
|
|
||||||
#else
|
|
||||||
NULL
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if ( _Attributes_Is_priority( attribute_set ) )
|
if ( _Attributes_Is_priority( attribute_set ) )
|
||||||
@@ -202,18 +196,12 @@ rtems_status_code rtems_semaphore_create(
|
|||||||
|
|
||||||
_CORE_semaphore_Initialize(
|
_CORE_semaphore_Initialize(
|
||||||
&the_semaphore->Core_control.semaphore,
|
&the_semaphore->Core_control.semaphore,
|
||||||
OBJECTS_RTEMS_SEMAPHORES,
|
|
||||||
&the_semaphore_attributes,
|
&the_semaphore_attributes,
|
||||||
count,
|
count
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
|
||||||
_Semaphore_MP_Send_extract_proxy
|
|
||||||
#else
|
|
||||||
NULL
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Objects_Open( &_Semaphore_Information, &the_semaphore->Object, &name );
|
_Objects_Open( &_Semaphore_Information, &the_semaphore->Object, name );
|
||||||
|
|
||||||
*id = the_semaphore->Object.id;
|
*id = the_semaphore->Object.id;
|
||||||
|
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ rtems_status_code rtems_task_create(
|
|||||||
THREAD_CPU_BUDGET_ALGORITHM_NONE,
|
THREAD_CPU_BUDGET_ALGORITHM_NONE,
|
||||||
NULL, /* no budget algorithm callout */
|
NULL, /* no budget algorithm callout */
|
||||||
_Modes_Get_interrupt_level(initial_modes),
|
_Modes_Get_interrupt_level(initial_modes),
|
||||||
&name
|
name
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( !status ) {
|
if ( !status ) {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ rtems_status_code rtems_task_ident(
|
|||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = _Objects_Name_to_id( &_RTEMS_tasks_Information, &name, node, id );
|
status = _Objects_Name_to_id( &_RTEMS_tasks_Information, name, node, id );
|
||||||
|
|
||||||
return _Status_Object_name_errors_to_status[ status ];
|
return _Status_Object_name_errors_to_status[ status ];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -249,14 +249,18 @@ void _RTEMS_tasks_Manager_initialization(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_RTEMS_tasks_Information,
|
&_RTEMS_tasks_Information, /* object information table */
|
||||||
OBJECTS_RTEMS_TASKS,
|
OBJECTS_CLASSIC_API, /* object API */
|
||||||
TRUE,
|
OBJECTS_RTEMS_TASKS, /* object class */
|
||||||
maximum_tasks,
|
maximum_tasks, /* maximum objects of this class */
|
||||||
sizeof( Thread_Control ),
|
sizeof( Thread_Control ), /* size of this object's control block */
|
||||||
FALSE,
|
FALSE, /* TRUE if the name is a string */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH,
|
RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */
|
||||||
TRUE
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
,
|
||||||
|
FALSE, /* TRUE if this is a global object class */
|
||||||
|
NULL /* Proxy extraction support callout */
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ rtems_status_code rtems_timer_create(
|
|||||||
|
|
||||||
the_timer->the_class = TIMER_DORMANT;
|
the_timer->the_class = TIMER_DORMANT;
|
||||||
|
|
||||||
_Objects_Open( &_Timer_Information, &the_timer->Object, &name );
|
_Objects_Open( &_Timer_Information, &the_timer->Object, name );
|
||||||
|
|
||||||
*id = the_timer->Object.id;
|
*id = the_timer->Object.id;
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
|
|||||||
Reference in New Issue
Block a user