Functions
Functions
SYSTEM » Platform SDK

## Functions
void | platform_sdk_init (void)
| platform sdk init function. More...
void | mem_pwr_mgmt_full_power_set (void)
| set the memory power state to full. This function is mainly used in some scenarios where all SRAMs need to be powered on More...
void | mem_pwr_mgmt_mode_set_from (uint32_t start_addr, uint32_t size)
| Control the memory power supply by specifying start address and length. More...
void | mem_pwr_mgmt_init (void)
| memory check process More...
void | system_lp_counter_set (uint8_t cnt_a, uint8_t cnt_b)
| update the counter A and counter B. More...
void | ble_wakeup_osc_time_set (run_mode_t run_mode, uint16_t osc_us)
| Set Time to wakeup oscillator before BLE Activity. More...
uint16_t | ble_wakeup_osc_time_get (run_mode_t run_mode)
| Get Time to wakeup oscillator before BLE Activity. More...
uint32_t | nvds_get_start_addr (void)
| Get NVDS Start Address. More...
void | ble_program_delay_set (run_mode_t run_mode, uint8_t hslot)
| Set BLE Program Delay. More...
void | ble_sleep_algo_dur_set (run_mode_t run_mode, uint16_t dur_hus)
| Set BLE Sleep Algorithm Duration. More...
void | ble_max_push_frame_time_set (run_mode_t run_mode, uint16_t max_push_hus)
| Set Maximum BLE Pushing Frame Time. More...
void | sys_min_sleep_threshold_set (run_mode_t run_mode, uint32_t min_sleep_us)
| Set Minimum System Sleep Time. More...
void | platform_clock_init (mcu_clock_type_t sys_clock, sdk_clock_type_t clock, uint16_t accuracy, uint16_t xo_offset)
| Platform low power clock init function. More...
void | platform_clock_init_rng (mcu_clock_type_t sys_clock, sdk_clock_type_t clock, uint16_t accuracy, uint16_t xo_offset)
| Platform low power clock init function. More...
void | platform_rng2_calibration_start (void)
| Start RNG2 OSC calibration. More...
void | platform_rng2_calibration_stop (bool wait)
| Stop RNG2 OSC calibration. More...
bool | platform_rng2_calibration_is_busy (void)
| Check whether RNG2 OSC calibration is on going. More...
uint32_t | platform_rng2_calibration_get (bool wait_result, bool allow_cached)
| Get RNG2 OSC calibration result. More...
void | platform_init (void)
| Platform init function. More...
void | warm_boot_first (void)
| the first warm boot stage. More...
void | warm_boot_second (void)
| the second warm boot stage.. More...
void | system_pmu_init (mcu_clock_type_t clock_type)
| PMU init function. More...
void | system_pmu_deinit (void)
| PMU deinit function. More...
void | warm_boot (void)
| Warm boot process. More...
void | warm_boot_set_exflash_readid_delay (uint32_t delay_us)
| Set delay time between flash wakeup and read chip id in warm boot. Please referrent the time of Flash Deep Power- down to Stand-by mode. More...
uint32_t | warm_boot_get_exflash_readid_delay (void)
| Get delay time between flash wakeup and read chip id in warm boot. More...
void | pmu_calibration_handler (void *p_arg)
| PMU calibration handler. More...
void | platform_init_push (void)
| protection platform timeout through watchdog. More...
void | platform_init_pop (void)
| protection platform timeout through watchdog. More...
hal_status_t | platform_flash_enable_quad (void)
| write flash QE More...
hal_status_t | platform_flash_protection (uint32_t base_priority)
| During Flash erase/write operation, Disable external interrupts with a priority less than or equal to base_priority in the system. More...
hal_status_t | platform_interrupt_protection_push (void)
| protection interrupt handler during writing/erasing flash. More...
hal_status_t | platform_interrupt_protection_pop (void)
| protection interrupt handler during writing/erasing flash. More...
void | pwr_mgmt_warm_boot (void)
| Power Management warm boot. More...

## Detailed Description

## Function Documentation

## ◆ ble_max_push_frame_time_set()

void ble_max_push_frame_time_set | ( | run_mode_t | run_mode,
|  | uint16_t | max_push_hus
| ) |  |

Set Maximum BLE Pushing Frame Time.

Parameters

  [in] | run_mode | : run mode.
  [in] | max_push_hus | : maximum pushing frame time(unit: hus).

Return values

  | void

## ◆ ble_program_delay_set()

void ble_program_delay_set | ( | run_mode_t | run_mode,
|  | uint8_t | hslot
| ) |  |

Set BLE Program Delay.

Parameters

  [in] | run_mode | : run mode.
  [in] | hslot | : program delay in half slot(unit: 312.5us).

Return values

  | void

## ◆ ble_sleep_algo_dur_set()

void ble_sleep_algo_dur_set | ( | run_mode_t | run_mode,
|  | uint16_t | dur_hus
| ) |  |

Set BLE Sleep Algorithm Duration.

Parameters

  [in] | run_mode | : run mode.
  [in] | dur_hus | : BLE Sleep Algorithm Duration(unit: 0.5us).

Return values

  | void

## ◆ ble_wakeup_osc_time_get()

uint16_t ble_wakeup_osc_time_get | ( | run_mode_t | run_mode | ) |

Get Time to wakeup oscillator before BLE Activity.

Parameters

  [in] | run_mode | : run mode.

Return values

  | osc_us : Time Reserved for wakeup oscillator(unit: us).

## ◆ ble_wakeup_osc_time_set()

void ble_wakeup_osc_time_set | ( | run_mode_t | run_mode,
|  | uint16_t | osc_us
| ) |  |

Set Time to wakeup oscillator before BLE Activity.

Parameters

  [in] | run_mode | : run mode.
  [in] | osc_us | : Time Reserved for wakeup oscillator(unit: us).

Return values

  | void

## ◆ mem_pwr_mgmt_full_power_set()

void mem_pwr_mgmt_full_power_set | ( | void |  | ) |

set the memory power state to full. This function is mainly used in some scenarios where all SRAMs need to be powered on

Return values

  | void

## ◆ mem_pwr_mgmt_init()

void mem_pwr_mgmt_init | ( | void |  | ) |

memory check process

Return values

  | void

## ◆ mem_pwr_mgmt_mode_set_from()

void mem_pwr_mgmt_mode_set_from | ( | uint32_t | start_addr,
|  | uint32_t | size
| ) |  |

Control the memory power supply by specifying start address and length.

Parameters

  [in] | start_addr | : the start address of memory that user want to config
  [in] | size | : the size of memory that user want to config

Return values

  | void

## ◆ nvds_get_start_addr()

uint32_t nvds_get_start_addr | ( | void |  | ) |

Get NVDS Start Address.

Return values

  | address : The NVDS Start Address.

## ◆ platform_clock_init()

void platform_clock_init | ( | mcu_clock_type_t | sys_clock,
|  | sdk_clock_type_t | clock,
|  | uint16_t | accuracy,
|  | uint16_t | xo_offset
| ) |  |

Platform low power clock init function.

Parameters

  [in] | sys_clock | System clock.
  [in] | clock | : External RTC setting.
  [in] | accuracy | : Low speed clock accuracy.
  [in] | xo_offset | : Clock calibration parameter.

Return values

  | void

## ◆ platform_clock_init_rng()

void platform_clock_init_rng | ( | mcu_clock_type_t | sys_clock,
|  | sdk_clock_type_t | clock,
|  | uint16_t | accuracy,
|  | uint16_t | xo_offset
| ) |  |

Platform low power clock init function.

Parameters

  [in] | sys_clock | System clock.
  [in] | clock | : Internal RNG/RNG2 setting.
  [in] | accuracy | : Low speed clock accuracy.
  [in] | xo_offset | : Clock calibration parameter.

Return values

  | void

## ◆ platform_flash_enable_quad()

hal_status_t platform_flash_enable_quad | ( | void |  | ) |

write flash QE

Return values

  | hal status

## ◆ platform_flash_protection()

hal_status_t platform_flash_protection | ( | uint32_t | base_priority | ) |

During Flash erase/write operation, Disable external interrupts with a priority less than or equal to base_priority in the system.

Parameters

  [in] | base_priority | Base Priority value to set.

Return values

  | hal status

## ◆ platform_init()

void platform_init | ( | void |  | ) |

Platform init function.

Return values

  | void

## ◆ platform_init_pop()

void platform_init_pop | ( | void |  | ) |

protection platform timeout through watchdog.

Return values

  | hal status

## ◆ platform_init_push()

void platform_init_push | ( | void |  | ) |

protection platform timeout through watchdog.

Return values

  | hal status

## ◆ platform_interrupt_protection_pop()

hal_status_t platform_interrupt_protection_pop | ( | void |  | ) |

protection interrupt handler during writing/erasing flash.

Return values

  | hal status

## ◆ platform_interrupt_protection_push()

hal_status_t platform_interrupt_protection_push | ( | void |  | ) |

protection interrupt handler during writing/erasing flash.

Return values

  | hal status

## ◆ platform_rng2_calibration_get()

uint32_t platform_rng2_calibration_get | ( | bool | wait_result,
|  | bool | allow_cached
| ) |  |

Get RNG2 OSC calibration result.

Parameters

  [in] | wait_result | : true will wait calibration done to get RNG2 OSC frequency
  [in] | allow_cached | : true will using previous RNG2 OSC calibration frequency

Return values

  | uint32_t : RNG2 OSC frequency in HZ

## ◆ platform_rng2_calibration_is_busy()

bool platform_rng2_calibration_is_busy | ( | void |  | ) |

Check whether RNG2 OSC calibration is on going.

Return values

  | bool : true calibration is on going, false calibration is not started or done

## ◆ platform_rng2_calibration_start()

void platform_rng2_calibration_start | ( | void |  | ) |

Start RNG2 OSC calibration.

Return values

  | void

## ◆ platform_rng2_calibration_stop()

void platform_rng2_calibration_stop | ( | bool | wait | ) |

Stop RNG2 OSC calibration.

Parameters

  [in] | wait | : True will wait calibration register is cleared

Return values

  | void

## ◆ platform_sdk_init()

void platform_sdk_init | ( | void |  | ) |

platform sdk init function.

Return values

  | void

## ◆ pmu_calibration_handler()

void pmu_calibration_handler | ( | void * | p_arg | ) |

PMU calibration handler.

Parameters

  [in] | p_arg | : no args.

Return values

  | void

## ◆ pwr_mgmt_warm_boot()

void pwr_mgmt_warm_boot | ( | void |  | ) |

Power Management warm boot.

Return values

  | void

## ◆ sys_min_sleep_threshold_set()

void sys_min_sleep_threshold_set | ( | run_mode_t | run_mode,
|  | uint32_t | min_sleep_us
| ) |  |

Set Minimum System Sleep Time.

Parameters

  [in] | run_mode | : run mode.
  [in] | min_sleep_us | : Minimum Time Allowed For Sleep(unit: us).

Return values

  | void

## ◆ system_lp_counter_set()

void system_lp_counter_set | ( | uint8_t | cnt_a,
|  | uint8_t | cnt_b
| ) |  |

update the counter A and counter B.

Parameters

  [in] | cnt_a | : DCDC Stable Time.
  [in] | cnt_b | : Oscillator Stable Time.

Return values

  | void

## ◆ system_pmu_deinit()

void system_pmu_deinit | ( | void |  | ) |

PMU deinit function.

Return values

  | void

## ◆ system_pmu_init()

void system_pmu_init | ( | mcu_clock_type_t | clock_type | ) |

PMU init function.

Parameters

  [in] | clock_type | : clock type to be configured.

Return values

  | void

## ◆ warm_boot()

void warm_boot | ( | void |  | ) |

Warm boot process.

Return values

  | void

## ◆ warm_boot_first()

void warm_boot_first | ( | void |  | ) |

the first warm boot stage.

Return values

  | void

## ◆ warm_boot_get_exflash_readid_delay()

uint32_t warm_boot_get_exflash_readid_delay | ( | void |  | ) |

Get delay time between flash wakeup and read chip id in warm boot.

Return values

  | delay time: uinit :us

## ◆ warm_boot_second()

void warm_boot_second | ( | void |  | ) |

the second warm boot stage..

Return values

  | void

## ◆ warm_boot_set_exflash_readid_delay()

void warm_boot_set_exflash_readid_delay | ( | uint32_t | delay_us | ) |

Set delay time between flash wakeup and read chip id in warm boot. Please referrent the time of Flash Deep Power- down to Stand-by mode.

Parameters

  [in] | delay_us | uinit :us

Return values

  | void