Power Profiles Service

group Power Profiles Service

Manages groups of power rails corresponding to system states.

The Power Profiles service acts as a translation layer between high-level system states (Safe, Nominal) and physical rails.

It:

  • accepts commands to enter specific power profiles

  • executes the actual switch toggling for the rails defined in the power profile

  • reads rail mappings from the system configuration.

group Types

Enumerations and structures used by the Power Profiles service.

Enums

enum power_profile_t

High-level system power configurations.

Values:

enumerator POWER_PROFILE_NOMINAL

Standard operation, most rails enabled

enumerator POWER_PROFILE_SAFE

Safe mode in case of faults or low power, most rails disabled

enum power_profile_status_t

Status codes for profile operations.

Values:

enumerator POWER_PROFILE_SUCCESS

The operation was completed successfully

enumerator POWER_PROFILE_ERROR_INVALID_PROFILE

The requested power profile does not exist

struct power_profile_info_t
#include <power_profiles.h>

Internal container for profile configuration data.

Used to retrieve the specific list of rails associated with a requested profile.

Public Members

const power_rail_t *rails

Pointer to the array of rails

int count

Number of rails in the profile

struct power_profiles_t
#include <power_profiles.h>

Container for the Power Profiles Service state.

Public Members

rail_controller_t *rail_controller

Pointer to the rail controller instance.

power_profile_t current_profile

The currently active power profile.

bool initialized

True if the service has been initialized.

group Public API

Functions for applying power configurations.

Functions

void power_profiles_init(power_profiles_t *profiles, rail_controller_t *controller)

Initialize the Power Profiles Service.

This must be called once at startup. It subscribes to profile change request events from the application layer.

Parameters:
  • profiles[in] The power profiles service instance.

  • controller[in] The rail controller instance.

power_profile_status_t power_profiles_enable(power_profiles_t *profiles, power_profile_t profile)

Enable all power rails associated with a specific profile.

Iterates through the list of rails defined for the given profile and instructs the Rail Controller to turn them ON.

Parameters:
  • profiles[in] The power profiles service instance.

  • profile[in] The target profile to enable (e.g., POWER_PROFILE_NOMINAL).

Return values:
  • POWER_PROFILE_SUCCESS – Operation successful.

  • POWER_PROFILE_ERROR_INVALID_PROFILE – The provided profile ID does not exist.

power_profile_status_t power_profiles_disable(power_profiles_t *profiles, power_profile_t profile)

Disable all power rails associated with a specific profile.

Iterates through the list of rails defined for the given profile and instructs the Rail Controller to turn them OFF.

Note

This is typically used when transitioning out of a state, or to shut down specific subsystems associated with a mode.

Parameters:
  • profiles[in] The power profiles service instance.

  • profile[in] The target profile to disable.

Return values:
  • POWER_PROFILE_SUCCESS – Operation successful.

  • POWER_PROFILE_ERROR_INVALID_PROFILE – The provided profile ID does not exist.