rtems: Update partition documentation

This commit is contained in:
Sebastian Huber
2020-10-14 09:43:48 +02:00
parent 4c1e793a2d
commit ede8f51e54
2 changed files with 84 additions and 31 deletions

View File

@@ -33,39 +33,71 @@ extern "C" {
*/ */
/** /**
* The following defines the control block used to manage each partition. * @brief The Partition Control Block (PTCB) represents a partition.
*/ */
typedef struct { typedef struct {
/** This field is the object management portion of a Partition instance. */ /**
Objects_Control Object; * @brief This member turns the PTCB into an object.
/** This field is the lock of the Partition. */ */
ISR_LOCK_MEMBER( Lock ) Objects_Control Object;
/** This field is the physical starting address of the Partition. */
void *starting_address; /**
/** This field is the size of the Partition in bytes. */ * @brief This lock protects the chain of unallocated buffers and the number
uintptr_t length; * of allocated buffers.
/** This field is the size of each buffer in bytes */ */
size_t buffer_size; ISR_LOCK_MEMBER( Lock )
/** This field is the attribute set provided at create time. */
rtems_attribute attribute_set; /**
/** This field is the of allocated buffers. */ * @brief This member contains the physical starting address of the buffer
uintptr_t number_of_used_blocks; * area.
/** This field is the chain used to manage unallocated buffers. */ */
Chain_Control Memory; void *starting_address;
} Partition_Control;
/**
* @brief This member contains the size of the buffer area in bytes.
*/
uintptr_t length;
/**
* @brief This member contains the size of each buffer in bytes.
*/
size_t buffer_size;
/**
* @brief This member contains the attribute set provided at creation time.
*/
rtems_attribute attribute_set;
/**
* @brief This member contains the count of allocated buffers.
*/
uintptr_t number_of_used_blocks;
/**
* @brief This chain is used to manage unallocated buffers.
*/
Chain_Control Memory;
} Partition_Control;
/** /**
* @brief The Classic Partition objects information. * @brief The Partition Manager objects information is used to manage the
* objects of this class.
*
* If #CONFIGURE_MAXIMUM_PARTITIONS is greater than zero, then the object
* information is defined by PARTITION_INFORMATION_DEFINE(), otherwise it is
* defined by OBJECTS_INFORMATION_DEFINE_ZERO().
*/ */
extern Objects_Information _Partition_Information; extern Objects_Information _Partition_Information;
#if defined(RTEMS_MULTIPROCESSING) #if defined(RTEMS_MULTIPROCESSING)
/** /**
* @brief Partition_MP_Send_extract_proxy * @brief Sends the extract proxy request.
* *
* This routine is invoked when a task is deleted and it * This routine is invoked when a task is deleted and it has a proxy which must
* has a proxy which must be removed from a thread queue and * be removed from a thread queue and the remote node must be informed of this.
* the remote node must be informed of this. *
* @param[in, out] the_thread is the thread proxy.
* @param id is the partition identifier.
*/ */
void _Partition_MP_Send_extract_proxy ( void _Partition_MP_Send_extract_proxy (
Thread_Control *the_thread, Thread_Control *the_thread,
@@ -74,21 +106,20 @@ void _Partition_MP_Send_extract_proxy (
#endif #endif
/** /**
* @brief Macro to define the objects information for the Classic Partition * @brief Defines the Partition Manager objects information.
* objects.
* *
* This macro should only be used by <rtems/confdefs.h>. * This macro should only be used by <rtems/confdefs/objectsclassic.h>.
* *
* @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag * @param _max is the configured object maximum (the #OBJECTS_UNLIMITED_OBJECTS
* may be set). * flag may be set).
*/ */
#define PARTITION_INFORMATION_DEFINE( max ) \ #define PARTITION_INFORMATION_DEFINE( _max ) \
OBJECTS_INFORMATION_DEFINE( \ OBJECTS_INFORMATION_DEFINE( \
_Partition, \ _Partition, \
OBJECTS_CLASSIC_API, \ OBJECTS_CLASSIC_API, \
OBJECTS_RTEMS_PARTITIONS, \ OBJECTS_RTEMS_PARTITIONS, \
Partition_Control, \ Partition_Control, \
max, \ _max, \
OBJECTS_NO_STRING_NAME, \ OBJECTS_NO_STRING_NAME, \
_Partition_MP_Send_extract_proxy \ _Partition_MP_Send_extract_proxy \
) )

View File

@@ -28,7 +28,7 @@ extern "C" {
#endif #endif
/** /**
* @defgroup ClassicPartImpl Classic Partition Manager Implementation * @defgroup ClassicPartImpl Partition Manager Implementation
* *
* @ingroup RTEMSImplClassic * @ingroup RTEMSImplClassic
* *
@@ -177,6 +177,14 @@ RTEMS_INLINE_ROUTINE void _Partition_Free (
_Objects_Free( &_Partition_Information, &the_partition->Object ); _Objects_Free( &_Partition_Information, &the_partition->Object );
} }
/**
* @brief Calls _Objects_Get() using the ::_Partition_Information.
*
* @param id is the object identifier.
* @param[out] lock_context is the lock context.
*
* @return See _Objects_Get().
*/
RTEMS_INLINE_ROUTINE Partition_Control *_Partition_Get( RTEMS_INLINE_ROUTINE Partition_Control *_Partition_Get(
Objects_Id id, Objects_Id id,
ISR_lock_Context *lock_context ISR_lock_Context *lock_context
@@ -189,6 +197,13 @@ RTEMS_INLINE_ROUTINE Partition_Control *_Partition_Get(
); );
} }
/**
* @brief Acquires the partition lock in an ISR disabled section.
*
* @param[in, out] the_partition is the partition control block.
*
* @param[in, out] lock_context is the lock context set up by _Partition_Get().
*/
RTEMS_INLINE_ROUTINE void _Partition_Acquire_critical( RTEMS_INLINE_ROUTINE void _Partition_Acquire_critical(
Partition_Control *the_partition, Partition_Control *the_partition,
ISR_lock_Context *lock_context ISR_lock_Context *lock_context
@@ -197,6 +212,13 @@ RTEMS_INLINE_ROUTINE void _Partition_Acquire_critical(
_ISR_lock_Acquire( &the_partition->Lock, lock_context ); _ISR_lock_Acquire( &the_partition->Lock, lock_context );
} }
/**
* @brief Releases the partition lock and restores the ISR level.
*
* @param[in, out] the_partition is the partition control block.
*
* @param[in, out] lock_context is the lock context set up by _Partition_Get().
*/
RTEMS_INLINE_ROUTINE void _Partition_Release( RTEMS_INLINE_ROUTINE void _Partition_Release(
Partition_Control *the_partition, Partition_Control *the_partition,
ISR_lock_Context *lock_context ISR_lock_Context *lock_context