ChibiOS/RT 7.0.5
Dynamic Objects Factory

Detailed Description

The object factory is a subsystem that allows to:

  • Register static objects by name.
  • Dynamically create objects and assign them a name.
  • Retrieve existing objects by name.
  • Free objects by reference.

Allocated OS objects are handled using a reference counter, only when all references have been released then the object memory is freed in a pool.

Precondition
This subsystem requires the CH_CFG_USE_MEMCORE and CH_CFG_USE_MEMPOOLS options to be set to TRUE. The option CH_CFG_USE_HEAP is also required if the support for variable length objects is enabled.
Note
Compatible with RT and NIL.
Collaboration diagram for Dynamic Objects Factory:

Data Structures

struct  ch_dyn_element
 Type of a dynamic object list element. More...
struct  ch_dyn_list
 Type of a dynamic object list. More...
struct  ch_registered_static_object
 Type of a registered object. More...
struct  ch_dyn_object
 Type of a dynamic buffer object. More...
struct  ch_dyn_semaphore
 Type of a dynamic semaphore. More...
struct  ch_dyn_mailbox
 Type of a dynamic buffer object. More...
struct  ch_dyn_objects_fifo
 Type of a dynamic buffer object. More...
struct  ch_dyn_pipe
 Type of a dynamic pipe object. More...
struct  ch_objects_factory
 Type of the factory main object. More...

Macros

#define F_LOCK()
#define F_UNLOCK()
#define CH_CFG_FACTORY_MAX_NAMES_LENGTH   8
 Maximum length for object names.
#define CH_CFG_FACTORY_OBJECTS_REGISTRY   TRUE
 Enables the registry of generic objects.
#define CH_CFG_FACTORY_GENERIC_BUFFERS   TRUE
 Enables factory for generic buffers.
#define CH_CFG_FACTORY_SEMAPHORES   TRUE
 Enables factory for semaphores.
#define CH_CFG_FACTORY_SEMAPHORES   FALSE
 Enables factory for semaphores.
#define CH_CFG_FACTORY_MAILBOXES   TRUE
 Enables factory for mailboxes.
#define CH_CFG_FACTORY_MAILBOXES   FALSE
 Enables factory for mailboxes.
#define CH_CFG_FACTORY_OBJ_FIFOS   TRUE
 Enables factory for objects FIFOs.
#define CH_CFG_FACTORY_OBJ_FIFOS   TRUE
 Enables factory for objects FIFOs.
#define CH_CFG_FACTORY_OBJ_FIFOS   FALSE
 Enables factory for objects FIFOs.
#define CH_CFG_FACTORY_PIPES   TRUE
 Enables factory for Pipes.
#define CH_CFG_FACTORY_PIPES   FALSE
 Enables factory for Pipes.
#define CH_FACTORY_REQUIRES_POOLS
#define CH_FACTORY_REQUIRES_HEAP

Typedefs

typedef struct ch_dyn_element dyn_element_t
 Type of a dynamic object list element.
typedef struct ch_dyn_list dyn_list_t
 Type of a dynamic object list.
typedef struct ch_registered_static_object registered_object_t
 Type of a registered object.
typedef struct ch_dyn_object dyn_buffer_t
 Type of a dynamic buffer object.
typedef struct ch_dyn_semaphore dyn_semaphore_t
 Type of a dynamic semaphore.
typedef struct ch_dyn_mailbox dyn_mailbox_t
 Type of a dynamic buffer object.
typedef struct ch_dyn_objects_fifo dyn_objects_fifo_t
 Type of a dynamic buffer object.
typedef struct ch_dyn_pipe dyn_pipe_t
 Type of a dynamic pipe object.
typedef struct ch_objects_factory objects_factory_t
 Type of the factory main object.

Functions

static void copy_name (const char *sp, char *dp)
static void dyn_list_init (dyn_list_t *dlp)
static dyn_element_tdyn_list_find (const char *name, dyn_list_t *dlp)
static dyn_element_tdyn_list_find_prev (dyn_element_t *element, dyn_list_t *dlp)
static dyn_element_tdyn_list_unlink (dyn_element_t *prev)
static dyn_element_tdyn_create_object_heap (const char *name, dyn_list_t *dlp, size_t size, unsigned align)
static void dyn_release_object_heap (dyn_element_t *dep, dyn_list_t *dlp)
static dyn_element_tdyn_create_object_pool (const char *name, dyn_list_t *dlp, memory_pool_t *mp)
static void dyn_release_object_pool (dyn_element_t *dep, dyn_list_t *dlp, memory_pool_t *mp)
static dyn_element_tdyn_find_object (const char *name, dyn_list_t *dlp)
void __factory_init (void)
 Initializes the objects factory.
registered_object_tchFactoryRegisterObject (const char *name, void *objp)
 Registers a generic object.
registered_object_tchFactoryFindObject (const char *name)
 Retrieves a registered object.
registered_object_tchFactoryFindObjectByPointer (void *objp)
 Retrieves a registered object by pointer.
void chFactoryReleaseObject (registered_object_t *rop)
 Releases a registered object.
dyn_buffer_tchFactoryCreateBuffer (const char *name, size_t size)
 Creates a generic dynamic buffer object.
dyn_buffer_tchFactoryFindBuffer (const char *name)
 Retrieves a dynamic buffer object.
void chFactoryReleaseBuffer (dyn_buffer_t *dbp)
 Releases a dynamic buffer object.
dyn_semaphore_tchFactoryCreateSemaphore (const char *name, cnt_t n)
 Creates a dynamic semaphore object.
dyn_semaphore_tchFactoryFindSemaphore (const char *name)
 Retrieves a dynamic semaphore object.
void chFactoryReleaseSemaphore (dyn_semaphore_t *dsp)
 Releases a dynamic semaphore object.
dyn_mailbox_tchFactoryCreateMailbox (const char *name, size_t n)
 Creates a dynamic mailbox object.
dyn_mailbox_tchFactoryFindMailbox (const char *name)
 Retrieves a dynamic mailbox object.
void chFactoryReleaseMailbox (dyn_mailbox_t *dmp)
 Releases a dynamic mailbox object.
dyn_objects_fifo_tchFactoryCreateObjectsFIFO (const char *name, size_t objsize, size_t objn, unsigned objalign)
 Creates a dynamic "objects FIFO" object.
dyn_objects_fifo_tchFactoryFindObjectsFIFO (const char *name)
 Retrieves a dynamic "objects FIFO" object.
void chFactoryReleaseObjectsFIFO (dyn_objects_fifo_t *dofp)
 Releases a dynamic "objects FIFO" object.
dyn_pipe_tchFactoryCreatePipe (const char *name, size_t size)
 Creates a dynamic pipe object.
dyn_pipe_tchFactoryFindPipe (const char *name)
 Retrieves a dynamic pipe object.
void chFactoryReleasePipe (dyn_pipe_t *dpp)
 Releases a dynamic pipe object.
static dyn_element_tchFactoryDuplicateReference (dyn_element_t *dep)
 Duplicates an object reference.
static void * chFactoryGetObject (registered_object_t *rop)
 Returns the pointer to the inner registered object.
static size_t chFactoryGetBufferSize (dyn_buffer_t *dbp)
 Returns the size of a generic dynamic buffer object.
static uint8_t * chFactoryGetBuffer (dyn_buffer_t *dbp)
 Returns the pointer to the inner buffer.
static semaphore_tchFactoryGetSemaphore (dyn_semaphore_t *dsp)
 Returns the pointer to the inner semaphore.
static mailbox_tchFactoryGetMailbox (dyn_mailbox_t *dmp)
 Returns the pointer to the inner mailbox.
static objects_fifo_tchFactoryGetObjectsFIFO (dyn_objects_fifo_t *dofp)
 Returns the pointer to the inner objects FIFO.
static pipe_tchFactoryGetPipe (dyn_pipe_t *dpp)
 Returns the pointer to the inner pipe.

Variables

objects_factory_t ch_factory
 Factory object static instance.

Macro Definition Documentation

◆ F_LOCK

◆ F_UNLOCK

◆ CH_CFG_FACTORY_MAX_NAMES_LENGTH

#define CH_CFG_FACTORY_MAX_NAMES_LENGTH   8

Maximum length for object names.

If the specified length is zero then the name is stored by pointer but this could have unintended side effects.

Definition at line 47 of file chfactory.h.

◆ CH_CFG_FACTORY_OBJECTS_REGISTRY

#define CH_CFG_FACTORY_OBJECTS_REGISTRY   TRUE

Enables the registry of generic objects.

Definition at line 54 of file chfactory.h.

◆ CH_CFG_FACTORY_GENERIC_BUFFERS

#define CH_CFG_FACTORY_GENERIC_BUFFERS   TRUE

Enables factory for generic buffers.

Definition at line 61 of file chfactory.h.

◆ CH_CFG_FACTORY_SEMAPHORES [1/2]

#define CH_CFG_FACTORY_SEMAPHORES   TRUE

Enables factory for semaphores.

Definition at line 68 of file chfactory.h.

◆ CH_CFG_FACTORY_SEMAPHORES [2/2]

#define CH_CFG_FACTORY_SEMAPHORES   FALSE

Enables factory for semaphores.

Definition at line 68 of file chfactory.h.

◆ CH_CFG_FACTORY_MAILBOXES [1/2]

#define CH_CFG_FACTORY_MAILBOXES   TRUE

Enables factory for mailboxes.

Definition at line 75 of file chfactory.h.

◆ CH_CFG_FACTORY_MAILBOXES [2/2]

#define CH_CFG_FACTORY_MAILBOXES   FALSE

Enables factory for mailboxes.

Definition at line 75 of file chfactory.h.

◆ CH_CFG_FACTORY_OBJ_FIFOS [1/3]

#define CH_CFG_FACTORY_OBJ_FIFOS   TRUE

Enables factory for objects FIFOs.

Definition at line 82 of file chfactory.h.

◆ CH_CFG_FACTORY_OBJ_FIFOS [2/3]

#define CH_CFG_FACTORY_OBJ_FIFOS   TRUE

Enables factory for objects FIFOs.

Definition at line 82 of file chfactory.h.

◆ CH_CFG_FACTORY_OBJ_FIFOS [3/3]

#define CH_CFG_FACTORY_OBJ_FIFOS   FALSE

Enables factory for objects FIFOs.

Definition at line 82 of file chfactory.h.

◆ CH_CFG_FACTORY_PIPES [1/2]

#define CH_CFG_FACTORY_PIPES   TRUE

Enables factory for Pipes.

Definition at line 96 of file chfactory.h.

◆ CH_CFG_FACTORY_PIPES [2/2]

#define CH_CFG_FACTORY_PIPES   FALSE

Enables factory for Pipes.

Definition at line 96 of file chfactory.h.

◆ CH_FACTORY_REQUIRES_POOLS

#define CH_FACTORY_REQUIRES_POOLS
Value:
#define CH_CFG_FACTORY_OBJECTS_REGISTRY
Enables the registry of generic objects.
Definition chconf.h:502
#define CH_CFG_FACTORY_SEMAPHORES
Enables factory for semaphores.
Definition chconf.h:516
#define TRUE
Generic 'true' preprocessor boolean constant.
Definition ch.h:86

Definition at line 131 of file chfactory.h.

◆ CH_FACTORY_REQUIRES_HEAP

#define CH_FACTORY_REQUIRES_HEAP
Value:
#define CH_CFG_FACTORY_OBJ_FIFOS
Enables factory for objects FIFOs.
Definition chconf.h:530
#define CH_CFG_FACTORY_PIPES
Enables factory for Pipes.
Definition chconf.h:537
#define CH_CFG_FACTORY_MAILBOXES
Enables factory for mailboxes.
Definition chconf.h:523
#define CH_CFG_FACTORY_GENERIC_BUFFERS
Enables factory for generic buffers.
Definition chconf.h:509

Definition at line 135 of file chfactory.h.

Typedef Documentation

◆ dyn_element_t

typedef struct ch_dyn_element dyn_element_t

Type of a dynamic object list element.

◆ dyn_list_t

typedef struct ch_dyn_list dyn_list_t

Type of a dynamic object list.

◆ registered_object_t

Type of a registered object.

◆ dyn_buffer_t

typedef struct ch_dyn_object dyn_buffer_t

Type of a dynamic buffer object.

◆ dyn_semaphore_t

Type of a dynamic semaphore.

◆ dyn_mailbox_t

typedef struct ch_dyn_mailbox dyn_mailbox_t

Type of a dynamic buffer object.

◆ dyn_objects_fifo_t

Type of a dynamic buffer object.

◆ dyn_pipe_t

typedef struct ch_dyn_pipe dyn_pipe_t

Type of a dynamic pipe object.

◆ objects_factory_t

Type of the factory main object.

Function Documentation

◆ copy_name()

void copy_name ( const char * sp,
char * dp )
static

Definition at line 86 of file chfactory.c.

References CH_CFG_FACTORY_MAX_NAMES_LENGTH.

Referenced by dyn_create_object_heap(), and dyn_create_object_pool().

◆ dyn_list_init()

void dyn_list_init ( dyn_list_t * dlp)
inlinestatic

Definition at line 98 of file chfactory.c.

References ch_dyn_list::next.

Referenced by __factory_init().

◆ dyn_list_find()

dyn_element_t * dyn_list_find ( const char * name,
dyn_list_t * dlp )
static

◆ dyn_list_find_prev()

dyn_element_t * dyn_list_find_prev ( dyn_element_t * element,
dyn_list_t * dlp )
static

Definition at line 116 of file chfactory.c.

References ch_dyn_element::next.

Referenced by dyn_release_object_heap(), and dyn_release_object_pool().

◆ dyn_list_unlink()

dyn_element_t * dyn_list_unlink ( dyn_element_t * prev)
static

Definition at line 133 of file chfactory.c.

References ch_dyn_element::next.

Referenced by dyn_release_object_heap(), and dyn_release_object_pool().

◆ dyn_create_object_heap()

dyn_element_t * dyn_create_object_heap ( const char * name,
dyn_list_t * dlp,
size_t size,
unsigned align )
static

◆ dyn_release_object_heap()

void dyn_release_object_heap ( dyn_element_t * dep,
dyn_list_t * dlp )
static

◆ dyn_create_object_pool()

dyn_element_t * dyn_create_object_pool ( const char * name,
dyn_list_t * dlp,
memory_pool_t * mp )
static

◆ dyn_release_object_pool()

void dyn_release_object_pool ( dyn_element_t * dep,
dyn_list_t * dlp,
memory_pool_t * mp )
static

Definition at line 228 of file chfactory.c.

References chDbgAssert, chDbgCheck, chPoolFree(), dyn_list_find_prev(), dyn_list_unlink(), and ch_dyn_element::refs.

Referenced by chFactoryReleaseObject(), and chFactoryReleaseSemaphore().

Here is the call graph for this function:

◆ dyn_find_object()

dyn_element_t * dyn_find_object ( const char * name,
dyn_list_t * dlp )
static

◆ __factory_init()

void __factory_init ( void )

Initializes the objects factory.

Function Class:
Object or module nitializer function.

Definition at line 277 of file chfactory.c.

References ch_factory, chCoreAllocAlignedI(), chMtxObjectInit(), chPoolObjectInit(), chSemObjectInit(), and dyn_list_init().

Referenced by __oslib_init().

Here is the call graph for this function:

◆ chFactoryRegisterObject()

registered_object_t * chFactoryRegisterObject ( const char * name,
void * objp )

Registers a generic object.

Postcondition
A reference to the registered object is returned and the reference counter is initialized to one.
Parameters
[in]namename to be assigned to the registered object
[in]objppointer to the object to be registered
Returns
The reference to the registered object.
Return values
NULLif the object to be registered cannot be allocated or a registered object with the same name exists.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 326 of file chfactory.c.

References ch_factory, dyn_create_object_pool(), F_LOCK, F_UNLOCK, and ch_registered_static_object::objp.

Here is the call graph for this function:

◆ chFactoryFindObject()

registered_object_t * chFactoryFindObject ( const char * name)

Retrieves a registered object.

Postcondition
A reference to the registered object is returned with the reference counter increased by one.
Parameters
[in]namename of the registered object
Returns
The reference to the found registered object.
Return values
NULLif a registered object with the specified name does not exist.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 358 of file chfactory.c.

References ch_factory, dyn_find_object(), F_LOCK, and F_UNLOCK.

Here is the call graph for this function:

◆ chFactoryFindObjectByPointer()

registered_object_t * chFactoryFindObjectByPointer ( void * objp)

Retrieves a registered object by pointer.

Postcondition
A reference to the registered object is returned with the reference counter increased by one.
Parameters
[in]objppointer to the object to be retrieved
Returns
The reference to the found registered object.
Return values
NULLif a registered object with the specified pointer does not exist.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 383 of file chfactory.c.

References ch_factory, ch_registered_static_object::element, F_LOCK, F_UNLOCK, ch_dyn_element::next, ch_registered_static_object::objp, and ch_dyn_element::refs.

◆ chFactoryReleaseObject()

void chFactoryReleaseObject ( registered_object_t * rop)

Releases a registered object.

The reference counter of the registered object is decreased by one, if reaches zero then the registered object memory is freed.

Note
The object itself is not freed, it could be static, only the allocated list element is freed.
Parameters
[in]ropregistered object reference
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 416 of file chfactory.c.

References ch_factory, dyn_release_object_pool(), ch_registered_static_object::element, F_LOCK, and F_UNLOCK.

Here is the call graph for this function:

◆ chFactoryCreateBuffer()

dyn_buffer_t * chFactoryCreateBuffer ( const char * name,
size_t size )

Creates a generic dynamic buffer object.

Postcondition
A reference to the dynamic buffer object is returned and the reference counter is initialized to one.
The dynamic buffer object is filled with zeros.
Parameters
[in]namename to be assigned to the new dynamic buffer object
[in]sizepayload size of the dynamic buffer object to be created
Returns
The reference to the created dynamic buffer object.
Return values
NULLif the dynamic buffer object cannot be allocated or a dynamic buffer object with the same name exists.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 444 of file chfactory.c.

References ch_factory, CH_HEAP_ALIGNMENT, dyn_create_object_heap(), F_LOCK, and F_UNLOCK.

Here is the call graph for this function:

◆ chFactoryFindBuffer()

dyn_buffer_t * chFactoryFindBuffer ( const char * name)

Retrieves a dynamic buffer object.

Postcondition
A reference to the dynamic buffer object is returned with the reference counter increased by one.
Parameters
[in]namename of the dynamic buffer object
Returns
The reference to the found dynamic buffer object.
Return values
NULLif a dynamic buffer object with the specified name does not exist.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 476 of file chfactory.c.

References ch_factory, dyn_find_object(), F_LOCK, and F_UNLOCK.

Here is the call graph for this function:

◆ chFactoryReleaseBuffer()

void chFactoryReleaseBuffer ( dyn_buffer_t * dbp)

Releases a dynamic buffer object.

The reference counter of the dynamic buffer object is decreased by one, if reaches zero then the dynamic buffer object memory is freed.

Parameters
[in]dbpdynamic buffer object reference
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 498 of file chfactory.c.

References ch_factory, dyn_release_object_heap(), ch_dyn_object::element, F_LOCK, and F_UNLOCK.

Here is the call graph for this function:

◆ chFactoryCreateSemaphore()

dyn_semaphore_t * chFactoryCreateSemaphore ( const char * name,
cnt_t n )

Creates a dynamic semaphore object.

Postcondition
A reference to the dynamic semaphore object is returned and the reference counter is initialized to one.
The dynamic semaphore object is initialized and ready to use.
Parameters
[in]namename to be assigned to the new dynamic semaphore object
[in]ndynamic semaphore object counter initialization value
Returns
The reference to the created dynamic semaphore object.
Return values
NULLif the dynamic semaphore object cannot be allocated or a dynamic semaphore with the same name exists.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 524 of file chfactory.c.

References ch_factory, chSemObjectInit(), dyn_create_object_pool(), F_LOCK, F_UNLOCK, and ch_dyn_semaphore::sem.

Here is the call graph for this function:

◆ chFactoryFindSemaphore()

dyn_semaphore_t * chFactoryFindSemaphore ( const char * name)

Retrieves a dynamic semaphore object.

Postcondition
A reference to the dynamic semaphore object is returned with the reference counter increased by one.
Parameters
[in]namename of the dynamic semaphore object
Returns
The reference to the found dynamic semaphore object.
Return values
NULLif a dynamic semaphore object with the specified name does not exist.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 555 of file chfactory.c.

References ch_factory, dyn_find_object(), F_LOCK, and F_UNLOCK.

Here is the call graph for this function:

◆ chFactoryReleaseSemaphore()

void chFactoryReleaseSemaphore ( dyn_semaphore_t * dsp)

Releases a dynamic semaphore object.

The reference counter of the dynamic semaphore object is decreased by one, if reaches zero then the dynamic semaphore object memory is freed.

Parameters
[in]dspdynamic semaphore object reference
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 577 of file chfactory.c.

References ch_factory, dyn_release_object_pool(), ch_dyn_semaphore::element, F_LOCK, and F_UNLOCK.

Here is the call graph for this function:

◆ chFactoryCreateMailbox()

dyn_mailbox_t * chFactoryCreateMailbox ( const char * name,
size_t n )

Creates a dynamic mailbox object.

Postcondition
A reference to the dynamic mailbox object is returned and the reference counter is initialized to one.
The dynamic mailbox object is initialized and ready to use.
Parameters
[in]namename to be assigned to the new dynamic mailbox object
[in]nmailbox buffer size as number of messages
Returns
The reference to the created dynamic mailbox object.
Return values
NULLif the dynamic mailbox object cannot be allocated or a dynamic mailbox object with the same name exists.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 605 of file chfactory.c.

References ch_factory, CH_HEAP_ALIGNMENT, chMBObjectInit(), dyn_create_object_heap(), F_LOCK, F_UNLOCK, and ch_dyn_mailbox::mbx.

Here is the call graph for this function:

◆ chFactoryFindMailbox()

dyn_mailbox_t * chFactoryFindMailbox ( const char * name)

Retrieves a dynamic mailbox object.

Postcondition
A reference to the dynamic mailbox object is returned with the reference counter increased by one.
Parameters
[in]namename of the dynamic mailbox object
Returns
The reference to the found dynamic mailbox object.
Return values
NULLif a dynamic mailbox object with the specified name does not exist.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 638 of file chfactory.c.

References ch_factory, dyn_find_object(), F_LOCK, and F_UNLOCK.

Here is the call graph for this function:

◆ chFactoryReleaseMailbox()

void chFactoryReleaseMailbox ( dyn_mailbox_t * dmp)

Releases a dynamic mailbox object.

The reference counter of the dynamic mailbox object is decreased by one, if reaches zero then the dynamic mailbox object memory is freed.

Parameters
[in]dmpdynamic mailbox object reference
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 660 of file chfactory.c.

References ch_factory, dyn_release_object_heap(), ch_dyn_mailbox::element, F_LOCK, and F_UNLOCK.

Here is the call graph for this function:

◆ chFactoryCreateObjectsFIFO()

dyn_objects_fifo_t * chFactoryCreateObjectsFIFO ( const char * name,
size_t objsize,
size_t objn,
unsigned objalign )

Creates a dynamic "objects FIFO" object.

Postcondition
A reference to the dynamic "objects FIFO" object is returned and the reference counter is initialized to one.
The dynamic "objects FIFO" object is initialized and ready to use.
Parameters
[in]namename to be assigned to the new dynamic "objects FIFO" object
[in]objsizesize of objects
[in]objnnumber of objects available
[in]objalignrequired objects alignment
Returns
The reference to the created dynamic "objects FIFO" object.
Return values
NULLif the dynamic "objects FIFO" object cannot be allocated or a dynamic "objects FIFO" object with the same name exists.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 690 of file chfactory.c.

References ch_factory, chFifoObjectInitAligned(), dyn_create_object_heap(), F_LOCK, F_UNLOCK, ch_dyn_objects_fifo::fifo, and MEM_ALIGN_NEXT.

Here is the call graph for this function:

◆ chFactoryFindObjectsFIFO()

dyn_objects_fifo_t * chFactoryFindObjectsFIFO ( const char * name)

Retrieves a dynamic "objects FIFO" object.

Postcondition
A reference to the dynamic "objects FIFO" object is returned with the reference counter increased by one.
Parameters
[in]namename of the dynamic "objects FIFO" object
Returns
The reference to the found dynamic "objects FIFO" object.
Return values
NULLif a dynamic "objects FIFO" object with the specified name does not exist.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 738 of file chfactory.c.

References ch_factory, dyn_find_object(), F_LOCK, and F_UNLOCK.

Here is the call graph for this function:

◆ chFactoryReleaseObjectsFIFO()

void chFactoryReleaseObjectsFIFO ( dyn_objects_fifo_t * dofp)

Releases a dynamic "objects FIFO" object.

The reference counter of the dynamic "objects FIFO" object is decreased by one, if reaches zero then the dynamic "objects FIFO" object memory is freed.

Parameters
[in]dofpdynamic "objects FIFO" object reference
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 760 of file chfactory.c.

References ch_factory, dyn_release_object_heap(), ch_dyn_objects_fifo::element, F_LOCK, and F_UNLOCK.

Here is the call graph for this function:

◆ chFactoryCreatePipe()

dyn_pipe_t * chFactoryCreatePipe ( const char * name,
size_t size )

Creates a dynamic pipe object.

Postcondition
A reference to the dynamic pipe object is returned and the reference counter is initialized to one.
The dynamic pipe object is initialized and ready to use.
Parameters
[in]namename to be assigned to the new dynamic pipe object
[in]sizepipe buffer size
Returns
The reference to the created dynamic pipe object.
Return values
NULLif the dynamic pipe object cannot be allocated or a dynamic pipe object with the same name exists.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 788 of file chfactory.c.

References ch_factory, CH_HEAP_ALIGNMENT, chPipeObjectInit(), dyn_create_object_heap(), F_LOCK, F_UNLOCK, and ch_dyn_pipe::pipe.

Here is the call graph for this function:

◆ chFactoryFindPipe()

dyn_pipe_t * chFactoryFindPipe ( const char * name)

Retrieves a dynamic pipe object.

Postcondition
A reference to the dynamic pipe object is returned with the reference counter increased by one.
Parameters
[in]namename of the pipe object
Returns
The reference to the found dynamic pipe object.
Return values
NULLif a dynamic pipe object with the specified name does not exist.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 821 of file chfactory.c.

References ch_factory, dyn_find_object(), F_LOCK, and F_UNLOCK.

Here is the call graph for this function:

◆ chFactoryReleasePipe()

void chFactoryReleasePipe ( dyn_pipe_t * dpp)

Releases a dynamic pipe object.

The reference counter of the dynamic pipe object is decreased by one, if reaches zero then the dynamic pipe object memory is freed.

Parameters
[in]dppdynamic pipe object reference
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 843 of file chfactory.c.

References ch_factory, dyn_release_object_heap(), ch_dyn_pipe::element, F_LOCK, and F_UNLOCK.

Here is the call graph for this function:

◆ chFactoryDuplicateReference()

dyn_element_t * chFactoryDuplicateReference ( dyn_element_t * dep)
inlinestatic

Duplicates an object reference.

Note
This function can be used on any kind of dynamic object.
Parameters
[in]deppointer to the element field of the object
Returns
The duplicated object reference.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 409 of file chfactory.h.

References ch_dyn_element::refs.

◆ chFactoryGetObject()

void * chFactoryGetObject ( registered_object_t * rop)
inlinestatic

Returns the pointer to the inner registered object.

Parameters
[in]ropregistered object reference
Returns
The pointer to the registered object.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 425 of file chfactory.h.

References ch_registered_static_object::objp.

◆ chFactoryGetBufferSize()

size_t chFactoryGetBufferSize ( dyn_buffer_t * dbp)
inlinestatic

Returns the size of a generic dynamic buffer object.

Parameters
[in]dbpdynamic buffer object reference
Returns
The size of the buffer object in bytes.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 440 of file chfactory.h.

References chHeapGetSize().

Here is the call graph for this function:

◆ chFactoryGetBuffer()

uint8_t * chFactoryGetBuffer ( dyn_buffer_t * dbp)
inlinestatic

Returns the pointer to the inner buffer.

Parameters
[in]dbpdynamic buffer object reference
Returns
The pointer to the dynamic buffer.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 453 of file chfactory.h.

◆ chFactoryGetSemaphore()

semaphore_t * chFactoryGetSemaphore ( dyn_semaphore_t * dsp)
inlinestatic

Returns the pointer to the inner semaphore.

Parameters
[in]dspdynamic semaphore object reference
Returns
The pointer to the semaphore.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 468 of file chfactory.h.

References ch_dyn_semaphore::sem.

◆ chFactoryGetMailbox()

mailbox_t * chFactoryGetMailbox ( dyn_mailbox_t * dmp)
inlinestatic

Returns the pointer to the inner mailbox.

Parameters
[in]dmpdynamic mailbox object reference
Returns
The pointer to the mailbox.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 483 of file chfactory.h.

References ch_dyn_mailbox::mbx.

◆ chFactoryGetObjectsFIFO()

objects_fifo_t * chFactoryGetObjectsFIFO ( dyn_objects_fifo_t * dofp)
inlinestatic

Returns the pointer to the inner objects FIFO.

Parameters
[in]dofpdynamic "objects FIFO" object reference
Returns
The pointer to the objects FIFO.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 498 of file chfactory.h.

References ch_dyn_objects_fifo::fifo.

◆ chFactoryGetPipe()

pipe_t * chFactoryGetPipe ( dyn_pipe_t * dpp)
inlinestatic

Returns the pointer to the inner pipe.

Parameters
[in]dppdynamic pipe object reference
Returns
The pointer to the pipe.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 513 of file chfactory.h.

References ch_dyn_pipe::pipe.

Variable Documentation

◆ ch_factory