forked from Imagelibrary/rtems
score: Remove _Objects_Open()
Use the type safe _Objects_Open_u32() instead. Return the object identifier to enforce a common usage pattern.
This commit is contained in:
@@ -738,50 +738,27 @@ RTEMS_INLINE_ROUTINE void _Objects_Invalidate_Id(
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Places the_object control pointer and object name
|
||||
* in the Local Pointer and Local Name Tables, respectively.
|
||||
* @brief Assigns the 32-bit unsigned integer name to the object and places the
|
||||
* object in the local object table.
|
||||
*
|
||||
* This method uses Objects_Name for the object name.
|
||||
* @param information is the object information.
|
||||
*
|
||||
* @param[in, out] information Points to an Object Information Table.
|
||||
* @param the_object Pointer to an object.
|
||||
* @param name The name of the object to make accessible.
|
||||
* @param[in, out] the_object is the object to open.
|
||||
*
|
||||
* @param name is the name of the object to open.
|
||||
*
|
||||
* @return Returns the identifier of the object which is now valid.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Objects_Open(
|
||||
Objects_Information *information,
|
||||
Objects_Control *the_object,
|
||||
Objects_Name name
|
||||
)
|
||||
{
|
||||
_Assert( information != NULL );
|
||||
_Assert( the_object != NULL );
|
||||
|
||||
the_object->name = name;
|
||||
|
||||
_Objects_Set_local_object(
|
||||
information,
|
||||
_Objects_Get_index( the_object->id ),
|
||||
the_object
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Places the_object control pointer and object name
|
||||
* in the Local Pointer and Local Name Tables, respectively.
|
||||
*
|
||||
* This method uses uint32_t for the object name.
|
||||
*
|
||||
* @param[in, out] information Points to an Object Information Table.
|
||||
* @param the_object Pointer to an object.
|
||||
* @param name The name of the object to make accessible.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Objects_Open_u32(
|
||||
RTEMS_INLINE_ROUTINE Objects_Id _Objects_Open_u32(
|
||||
const Objects_Information *information,
|
||||
Objects_Control *the_object,
|
||||
uint32_t name
|
||||
)
|
||||
{
|
||||
_Assert( information != NULL );
|
||||
_Assert( !_Objects_Has_string_name( information ) );
|
||||
_Assert( the_object != NULL );
|
||||
|
||||
the_object->name.name_u32 = name;
|
||||
|
||||
_Objects_Set_local_object(
|
||||
@@ -789,17 +766,19 @@ RTEMS_INLINE_ROUTINE void _Objects_Open_u32(
|
||||
_Objects_Get_index( the_object->id ),
|
||||
the_object
|
||||
);
|
||||
|
||||
return the_object->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Places the_object control pointer and object name
|
||||
* in the Local Pointer and Local Name Tables, respectively.
|
||||
* @brief Assigns the string name to the object and places the object in the
|
||||
* local object table.
|
||||
*
|
||||
* This method uses a String for the object name.
|
||||
* @param information is the object information.
|
||||
*
|
||||
* @param[in, out] information Points to an Object Information Table.
|
||||
* @param the_object Pointer to an object.
|
||||
* @param name The name of the object to make accessible.
|
||||
* @param[in, out] the_object is the object to open.
|
||||
*
|
||||
* @param name is the name of the object to open.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Objects_Open_string(
|
||||
const Objects_Information *information,
|
||||
@@ -807,7 +786,10 @@ RTEMS_INLINE_ROUTINE void _Objects_Open_string(
|
||||
const char *name
|
||||
)
|
||||
{
|
||||
_Assert( information != NULL );
|
||||
_Assert( _Objects_Has_string_name( information ) );
|
||||
_Assert( the_object != NULL );
|
||||
|
||||
the_object->name.name_p = name;
|
||||
|
||||
_Objects_Set_local_object(
|
||||
|
||||
@@ -164,9 +164,9 @@ typedef struct {
|
||||
Thread_CPU_budget_algorithm_callout budget_callout;
|
||||
|
||||
/**
|
||||
* @brief Name of the object for the thread.
|
||||
* @brief 32-bit unsigned integer name of the object for the thread.
|
||||
*/
|
||||
Objects_Name name;
|
||||
uint32_t name;
|
||||
|
||||
/**
|
||||
* @brief The thread's initial ISR level.
|
||||
|
||||
@@ -63,14 +63,7 @@ rtems_status_code rtems_barrier_create(
|
||||
|
||||
_CORE_barrier_Initialize( &the_barrier->Barrier, &the_attributes );
|
||||
|
||||
_Objects_Open(
|
||||
&_Barrier_Information,
|
||||
&the_barrier->Object,
|
||||
(Objects_Name) name
|
||||
);
|
||||
|
||||
*id = the_barrier->Object.id;
|
||||
|
||||
*id = _Objects_Open_u32( &_Barrier_Information, &the_barrier->Object, name );
|
||||
_Objects_Allocator_unlock();
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
@@ -59,13 +59,11 @@ rtems_status_code rtems_port_create(
|
||||
the_port->external_base = external_start;
|
||||
the_port->length = length - 1;
|
||||
|
||||
_Objects_Open(
|
||||
*id = _Objects_Open_u32(
|
||||
&_Dual_ported_memory_Information,
|
||||
&the_port->Object,
|
||||
(Objects_Name) name
|
||||
name
|
||||
);
|
||||
|
||||
*id = the_port->Object.id;
|
||||
_Objects_Allocator_unlock();
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
@@ -158,14 +158,12 @@ rtems_status_code _Message_queue_Create(
|
||||
return _Status_Get( status );
|
||||
}
|
||||
|
||||
_Objects_Open(
|
||||
*id = _Objects_Open_u32(
|
||||
&_Message_queue_Information,
|
||||
&the_message_queue->Object,
|
||||
(Objects_Name) config->name
|
||||
config->name
|
||||
);
|
||||
|
||||
*id = the_message_queue->Object.id;
|
||||
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
if ( is_global )
|
||||
_Message_queue_MP_Send_process_packet(
|
||||
|
||||
@@ -138,13 +138,12 @@ rtems_status_code rtems_partition_create(
|
||||
attribute_set
|
||||
);
|
||||
|
||||
_Objects_Open(
|
||||
*id = _Objects_Open_u32(
|
||||
&_Partition_Information,
|
||||
&the_partition->Object,
|
||||
(Objects_Name) name
|
||||
name
|
||||
);
|
||||
|
||||
*id = the_partition->Object.id;
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
if ( _Attributes_Is_global( attribute_set ) )
|
||||
_Partition_MP_Send_process_packet(
|
||||
|
||||
@@ -60,13 +60,11 @@ rtems_status_code rtems_rate_monotonic_create(
|
||||
|
||||
_Rate_monotonic_Reset_statistics( the_period );
|
||||
|
||||
_Objects_Open(
|
||||
*id = _Objects_Open_u32(
|
||||
&_Rate_monotonic_Information,
|
||||
&the_period->Object,
|
||||
(Objects_Name) name
|
||||
name
|
||||
);
|
||||
|
||||
*id = the_period->Object.id;
|
||||
_Objects_Allocator_unlock();
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
@@ -75,13 +75,12 @@ rtems_status_code rtems_region_create(
|
||||
} else {
|
||||
the_region->attribute_set = attribute_set;
|
||||
|
||||
_Objects_Open(
|
||||
*id = _Objects_Open_u32(
|
||||
&_Region_Information,
|
||||
&the_region->Object,
|
||||
(Objects_Name) name
|
||||
name
|
||||
);
|
||||
|
||||
*id = the_region->Object.id;
|
||||
return_status = RTEMS_SUCCESSFUL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,14 +245,12 @@ rtems_status_code rtems_semaphore_create(
|
||||
* Whether we initialized it as a mutex or counting semaphore, it is
|
||||
* now ready to be "offered" for use as a Classic API Semaphore.
|
||||
*/
|
||||
_Objects_Open(
|
||||
*id = _Objects_Open_u32(
|
||||
&_Semaphore_Information,
|
||||
&the_semaphore->Object,
|
||||
(Objects_Name) name
|
||||
name
|
||||
);
|
||||
|
||||
*id = the_semaphore->Object.id;
|
||||
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
if ( _Attributes_Is_global( attribute_set ) )
|
||||
_Semaphore_MP_Send_process_packet(
|
||||
|
||||
@@ -135,7 +135,7 @@ rtems_status_code _RTEMS_tasks_Create(
|
||||
THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE
|
||||
: THREAD_CPU_BUDGET_ALGORITHM_NONE,
|
||||
thread_config.isr_level = _Modes_Get_interrupt_level( config->initial_modes );
|
||||
thread_config.name.name_u32 = config->name;
|
||||
thread_config.name = config->name;
|
||||
thread_config.is_fp = _Attributes_Is_floating_point( attributes );
|
||||
thread_config.is_preemptible = _Modes_Is_preempt( config->initial_modes );
|
||||
|
||||
|
||||
@@ -209,13 +209,11 @@ rtems_status_code rtems_timer_create(
|
||||
the_timer->the_class = TIMER_DORMANT;
|
||||
_Watchdog_Preinitialize( &the_timer->Ticker, _Per_CPU_Get_snapshot() );
|
||||
|
||||
_Objects_Open(
|
||||
*id = _Objects_Open_u32(
|
||||
&_Timer_Information,
|
||||
&the_timer->Object,
|
||||
(Objects_Name) name
|
||||
name
|
||||
);
|
||||
|
||||
*id = the_timer->Object.id;
|
||||
_Objects_Allocator_unlock();
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
@@ -55,13 +55,11 @@ rtems_status_code rtems_extension_create(
|
||||
|
||||
_User_extensions_Add_set_with_table( &the_extension->Extension, extension_table );
|
||||
|
||||
_Objects_Open(
|
||||
*id = _Objects_Open_u32(
|
||||
&_Extension_Information,
|
||||
&the_extension->Object,
|
||||
(Objects_Name) name
|
||||
name
|
||||
);
|
||||
|
||||
*id = the_extension->Object.id;
|
||||
_Objects_Allocator_unlock();
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ static void _MPCI_Create_server( void )
|
||||
|
||||
memset( &config, 0, sizeof( config ) );
|
||||
config.scheduler = &_Scheduler_Table[ 0 ];
|
||||
config.name.name_u32 = _Objects_Build_name( 'M', 'P', 'C', 'I' );
|
||||
config.name = _Objects_Build_name( 'M', 'P', 'C', 'I' );
|
||||
config.priority = PRIORITY_PSEUDO_ISR;
|
||||
config.budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_NONE;
|
||||
config.is_fp = CPU_ALL_TASKS_ARE_FP;
|
||||
|
||||
@@ -50,7 +50,7 @@ static void _Thread_Create_idle_for_CPU( Per_CPU_Control *cpu )
|
||||
config.scheduler->maximum_priority
|
||||
);
|
||||
config.budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_NONE;
|
||||
config.name.name_u32 = _Objects_Build_name( 'I', 'D', 'L', 'E' );
|
||||
config.name = _Objects_Build_name( 'I', 'D', 'L', 'E' );
|
||||
config.is_fp = CPU_IDLE_TASK_IS_FP;
|
||||
config.is_preemptible = true;
|
||||
config.stack_size = _Thread_Idle_stack_size
|
||||
|
||||
@@ -241,10 +241,7 @@ bool _Thread_Initialize(
|
||||
|
||||
_Thread_Action_control_initialize( &the_thread->Post_switch_actions );
|
||||
|
||||
/*
|
||||
* Open the object
|
||||
*/
|
||||
_Objects_Open( &information->Objects, &the_thread->Object, config->name );
|
||||
_Objects_Open_u32( &information->Objects, &the_thread->Object, config->name );
|
||||
|
||||
/*
|
||||
* We assume the Allocator Mutex is locked and dispatching is
|
||||
|
||||
Reference in New Issue
Block a user