section_iter.h

Sifli Power management API.

Author

Sifli software development team

Defines

SECTION_SET_DEF(_name, _type, _count)

Create a set of sections.

A set of sections, is an ordered collections of sections.

备注

This macro reserves memory for the given set of sections.

参数:
  • _name[in] Name of the set.

  • _type[in] Type of the elements stored in the sections.

  • _count[in] Number of the sections in the set. This parameter is ignored in case of GCC.

SECTION_DEF_(_priority, _name, _type)
SECTION_SET_DEF_(_priority, _name)
SECTION_SET_ITEM_REGISTER(_name, _priority, _var)

Macro to declare a variable and register it in the section set.

备注

The order of the section in the set is based on the priority. The order with which variables are placed in a section is dependant on the order with which the linker encouters the variables during linking.

参数:
  • _name[in] Name of the section set.

  • _priority[in] Priority of the desired section.

  • _var[in] The variable to register in the given section.

Functions

void section_iter_init(section_iter_t *p_iter, section_set_t const *p_set)

Function for initializing the section set iterator.

参数:
  • p_iter[in] Pointer to the iterator.

  • p_set[in] Pointer to the sections set.

void section_iter_next(section_iter_t *p_iter)

Function for incrementing iterator.

参数:
  • p_iter[in] Pointer to the iterator.

static inline void *section_iter_get(section_iter_t const *p_iter)

Function for getting the element pointed to by the iterator.

参数:
  • p_iter[in] Pointer to the iterator.

返回值:

Pointer – to the element or NULL if iterator points end of the set.

struct section_t
#include <section_iter.h>

Single section description structure.

Public Members

void *p_start

Pointer to the start of section.

void *p_end

Pointer to the end of section.

struct section_set_t
#include <section_iter.h>

Set of the sections description structure.

Public Members

const section_t *p_first

Pointer to the first section in the set.

const section_t *p_last

Pointer to the last section in the set.

size_t item_size

Size of the single item in the section.

struct section_iter_t
#include <section_iter.h>

Section iterator structure.

Public Members

const section_set_t *p_set

Pointer to the appropriate section set.

const section_t *p_section

Pointer to the selected section.

In case of GCC all sections in the set are sorted and placed in contiguous area, because they are treated as one section.

void *p_item

Pointer to the selected item in the section.