BSP

This is the hardware independent BSP (Board Support Package) Interface for Mynewt.

Description

Contains the basic operations to initialize, specify memory to include in coredump, configure interrupt priority etc.

API

void hal_bsp_init(void)

Initializes BSP; registers flash_map with the system.

const struct hal_flash* hal_bsp_flash_dev(uint8_t flash_id)
void* _sbrk(int incr)
const struct hal_bsp_mem_dump* hal_bsp_core_dump(int * area_cnt)

Report which memory areas should be included inside a coredump.

int hal_bsp_hw_id_len(void)

Retrieves the length, in bytes, of the hardware ID.

Return
The length of the hardware ID.

int hal_bsp_hw_id(uint8_t * id, int max_len)

Get unique HW identifier/serial number for platform.

Returns the number of bytes filled in.

Return
0 on success, non-zero error code on failure
Parameters
  • id: Pointer to the ID to fill out
  • max_len: Maximum length to fill into the ID

int hal_bsp_power_state(int state)

Move the system into the specified power state.

Return
0 on success, non-zero if system cannot move into this power state.
Parameters
  • state: The power state to move the system into, this is one of
    • HAL_BSP_POWER_ON: Full system on
    • HAL_BSP_POWER_WFI: Processor off, wait for interrupt.
    • HAL_BSP_POWER_SLEEP: Put the system to sleep
    • HAL_BSP_POWER_DEEP_SLEEP: Put the system into deep sleep.
    • HAL_BSP_POWER_OFF: Turn off the system.
    • HAL_BSP_POWER_PERUSER: From this value on, allow user defined power states.

uint32_t hal_bsp_get_nvic_priority(int irq_num, uint32_t pri)

Returns priority of given interrupt number.

HAL_BSP_MAX_ID_LEN
HAL_BSP_POWER_ON

Full System On.

HAL_BSP_POWER_WFI

Wait for Interrupt: CPU off.

HAL_BSP_POWER_SLEEP

System sleep mode, processor off, some peripherals off too.

HAL_BSP_POWER_DEEP_SLEEP

Deep sleep: possible loss of RAM retention, system wakes up in undefined state.

HAL_BSP_POWER_OFF

System powering off.

HAL_BSP_POWER_PERUSER

Per-user power state, base number for user to define custom power states.