跳转至

Application Management

Application-level bootstrap and clock providers. More...

Files

Name
lib/application/app.h
Application descriptor and clock/boot provider interfaces.

Classes

Name
struct __CFBDApplication
Application descriptor.

Types

Name
typedef uint32_t(*)(void) CFBD_ClockFreqProvider
Function returning the system clock frequency in Hertz.
typedef uint32_t(*)(void) CFBD_ClockTickProvider
Function returning a monotonically increasing tick value.
typedef struct __CFBDApplication CFBDApplication
Application descriptor.

Functions

Name
CFBDBootTuple * CFBD_AppBootMaker(void )
Return a pointer to a boot tuple table for the application.
CFBD_ClockFreqProvider CFBD_AppClockProvider(void )
Return the application's clock frequency provider.
CFBD_ClockTickProvider CFBD_AppTickProvider(void )
Return the application's tick provider.
CFBDApplication * getApp(CFBD_Bool request_auto_boot)
Obtain the global CFBDApplication instance.

Detailed Description

Application-level bootstrap and clock providers.

Provides the core application descriptor and helper functions for managing application initialization and timing services. This module allows applications to register their bootstrap sequences and clock providers with the CFBD framework.

Types Documentation

typedef CFBD_ClockFreqProvider

CFBD_ClockFreqProvider;

Function returning the system clock frequency in Hertz.

See:

Return: uint32_t Current clock frequency in Hertz (Hz).

Par: Example

uint32_t stm32_clock_freq(void) {
    // STM32F103 typically runs at 72 MHz
    return 72000000;
}

Provider returns the current core/system clock frequency in Hz. This value is used by timing helpers and drivers to convert between ticks and wall-clock time. If the platform supports dynamic clock scaling, the provider should return the up-to-date frequency when called.

Implementations must ensure the returned value is accurate and stable for use in timing-critical calculations. Typical implementations read clock configuration registers or return a hardcoded constant.

typedef CFBD_ClockTickProvider

CFBD_ClockTickProvider;

Function returning a monotonically increasing tick value.

See:

Return: uint32_t Current tick counter value. Should increment steadily and wrap around gracefully.

Par: Example

extern volatile uint32_t g_systick_count;

uint32_t get_systick(void) {
    return g_systick_count;
}

Provider returns a tick counter value (units are implementation defined, typically processor ticks or a hardware timer count). The value should be monotonically increasing and suitable for measuring short intervals when combined with the frequency provider.

Common implementations include:

  • System timer (SysTick) count for ARM Cortex-M processors
  • Hardware timer register values
  • Software tick counters incremented by interrupts

typedef CFBDApplication

typedef struct __CFBDApplication CFBDApplication;

Application descriptor.

See:

Aggregates the bootstrap function and clock providers for an application. Typical usage is to expose a single application instance via [getApp()](Modules/group__Application__Module.md#function-getapp) that other framework components query to obtain boot actions and timing sources.

The application descriptor serves as a central registry for all application-level services, allowing framework components to access initialization routines and timing information without requiring direct coupling to application code.

Functions Documentation

function CFBD_AppBootMaker

CFBDBootTuple * CFBD_AppBootMaker(
    void 
)

Return a pointer to a boot tuple table for the application.

See:

Return: CFBDBootTuple* Pointer to the boot tuple table or NULL.

The returned pointer typically refers to a static array of [CFBDBootTuple](Classes/structCFBDBootTuple.md) entries describing ordered bootstrap actions. The caller must not attempt to free the returned pointer. Return value may be NULL if the application exposes no explicit boot table.

The boot table provides a declarative way to specify initialization sequences without requiring explicit function calls.

function CFBD_AppClockProvider

CFBD_ClockFreqProvider CFBD_AppClockProvider(
    void 
)

Return the application's clock frequency provider.

See:

Return: CFBD_ClockFreqProvider Function pointer returning system frequency in Hz, or NULL if not provided.

Retrieves the frequency provider function registered with the application descriptor. This allows framework components to query the system clock frequency without direct application coupling.

function CFBD_AppTickProvider

CFBD_ClockTickProvider CFBD_AppTickProvider(
    void 
)

Return the application's tick provider.

See:

Return: CFBD_ClockTickProvider Function pointer returning current tick count, or NULL if not provided.

Retrieves the tick provider function registered with the application descriptor. This allows framework components to measure time intervals without direct application coupling.

function getApp

CFBDApplication * getApp(
    CFBD_Bool request_auto_boot
)

Obtain the global CFBDApplication instance.

Parameters:

  • request_auto_boot If CFBD_TRUE, request that the application performs any auto-boot actions before returning (implementation-defined). If CFBD_FALSE, returns the descriptor without triggering bootstrap.

See:

Return: CFBDApplication* Pointer to the application descriptor, or NULL if no application is registered.

Par:

  • Example: Get application with automatic bootstrap

CFBDApplication* app = getApp(CFBD_TRUE);
if (app && app->freq_provider) {
    uint32_t freq = app->freq_provider();
}
* Example: Get application descriptor without bootstrap

CFBDApplication* app = getApp(CFBD_FALSE);
// Manually call bootstrap if needed
if (app && app->selfBootFunc) {
    app->selfBootFunc(app, app->bootargs);
}

Returns a pointer to the global application descriptor. If request_auto_boot is true the function may trigger automatic application bootstrap actions according to the platform policy.

This is the primary entry point for framework components to access application-level services.


Updated on 2026-02-03 at 13:21:55 +0000