bf0_hal.h

This file contains all the functions prototypes for the HAL module driver.

Author

Sifli software development team

Unnamed Group

MAKE_REG_VAL(val, mask, offset)
GET_REG_VAL(reg, mask, offset)
SYSCFG_BOOT_NORMAL

Normal boot

SYSCFG_BOOT_UART

Boot with UART loop for DFU

Defines

SYSCFG_SWD_HCPU

SWD interface connect to HCPU

SYSCFG_SWD_LCPU

SWD interface connect to LCPU

SYSCFG_SWD_BCPU

SWD interface connect to BCPU

__HAL_SYSCFG_GET_BOOT_MODE()

Get Current boot mode.

返回值:

The – boot mode as configured by user

__HAL_SYSCFG_SET_SWD(COREID)

Set SWD interface.

参数:
__HAL_SYSCFG_SET_SECURITY()

Set Security Key control.

__HAL_SYSCFG_CLEAR_SECURITY()

Clear Security Key control.

__HAL_SYSCFG_GET_SID()

Get serial ID

__HAL_SYSCFG_GET_CID()

Get Chip ID

__HAL_SYSCFG_GET_PID()

Get Package ID

__HAL_SYSCFG_GET_REVID()

Get Revision ID

__HAL_SYSCFG_Enable_USB()

Enable USB module

__HAL_SYSCFG_USB_DM_PD()

Pull Down USB DM pin, host only

__HAL_SYSCFG_Enable_WDT_REBOOT(enable)
__HAL_SYSCFG_Enable_Assert_Trigger(enable)
__HAL_SYSCFG_Trigger_Assert()
__HAL_SYSCFG_Get_Trigger_Assert_Flag()
__HAL_SYSCFG_HPBG_EN()
__HAL_SYSCFG_HPBG_VDDPSW_EN()
SystemFixClock
__HAL_ROM_USED
HAL_ALIGN(size, align)
HAL_ALIGN_DOWN(size, align)
HAL_MIN(a, b)
HAL_MAX(a, b)
HAL_ABS(x)
HAL_CHIP_REV_ID_A3

CHIP ID for A3.

HAL_CHIP_REV_ID_A4
HAL_LXT_ENABLED()
HAL_LXT_DISABLED()
HAL_ASSERT(expr)

Functions

HAL_StatusTypeDef HAL_Init(void)

Configure the Flash prefetch, the Instruction and Data caches, the time base source, NVIC and any required global low level hardware by calling the HAL_PreInit() callback function to be optionally defined in user file.

备注

HAL_Init() function is called at the beginning of program after reset and before the clock configuration.

备注

In the default implementation the System Timer (Systick) is used as source of time base. The Systick configuration is based on MSI clock, as MSI is the clock used after a system Reset and the NVIC configuration is set to Priority group 4. Once done, time base tick starts incrementing: the tick variable counter is incremented each 1ms in the SysTick_Handler() interrupt handler.

返回值:

HAL – status

void HAL_PreInit(void)

Before HAL_Init is called, board specific initialization.

返回值:

None

void HAL_PostMspInit(void)

It’s called after HAL_PreInit in HAL_Init.

返回值:

None

HAL_StatusTypeDef HAL_DeInit(void)

De-initialize common part of the HAL and stop the source of time base.

备注

This function is optional.

返回值:

HAL – status

void HAL_MspDeInit(void)

DeInitialize the MSP.

返回值:

None

HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)

This function configures the source of the time base: The time source is configured to have 1ms time base with a dedicated Tick interrupt priority.

备注

This function is called automatically at the beginning of program after reset by HAL_Init() or at any time when clock is reconfigured by HAL_RCC_ClockConfig().

备注

In the default implementation, SysTick timer is the source of time base. It is used to generate interrupts at regular time intervals. Care must be taken if HAL_Delay() is called from a peripheral ISR process, The SysTick interrupt must have higher priority (numerically lower) than the peripheral interrupt. Otherwise the caller ISR process will be blocked. The function is declared as __weak to be overwritten in case of other implementation in user file.

参数:
  • TickPriority – Tick interrupt priority.

返回值:

HAL – status

void HAL_IncTick(void)

This function is called to increment a global variable “uwTick” used as application time base.

备注

In the default implementation, this variable is incremented each 1ms in SysTick ISR.

备注

This function is declared as __weak to be overwritten in case of other implementations in user file.

返回值:

None

void HAL_Delay(uint32_t Delay)

This function provides minimum delay (in milliseconds) based on variable incremented.

备注

In the default implementation , SysTick timer is the source of time base. It is used to generate interrupts at regular time intervals where uwTick is incremented.

备注

This function is declared as __weak to be overwritten in case of other implementations in user file.

参数:
  • Delay – specifies the delay time length, in milliseconds.

返回值:

None

void HAL_Delay_us(uint32_t us)
void HAL_Delay_us_ (1 uint32_t us)
uint32_t HAL_GetTick(void)

Provide a tick value in millisecond.

备注

This function is declared as __weak to be overwritten in case of other implementations in user file.

返回值:

tick – value

void HAL_SuspendTick(void)

Suspend Tick increment.

备注

In the default implementation , SysTick timer is the source of time base. It is used to generate interrupts at regular time intervals. Once HAL_SuspendTick() is called, the SysTick interrupt will be disabled and so Tick increment is suspended.

备注

This function is declared as __weak to be overwritten in case of other implementations in user file.

返回值:

None

void HAL_ResumeTick(void)

Resume Tick increment.

备注

In the default implementation , SysTick timer is the source of time base. It is used to generate interrupts at regular time intervals. Once HAL_ResumeTick() is called, the SysTick interrupt will be enabled and so Tick increment is resumed.

备注

This function is declared as __weak to be overwritten in case of other implementations in user file.

返回值:

None

void HAL_AssertFailed(char *file, uint32_t line)

The assert failure printing. If BSP_USING_FULL_ASSERT is defined, the asser_failed function need to be implemented.

参数:
  • file – file name of source code for the failed assert

  • line – code line number for the failed assert

返回值:

None

void HAL_sw_breakpoint(void)

Debug function to stop current thread execution.

返回值:

None

uint32_t HAL_DisableInterrupt(void)
void HAL_EnableInterrupt(uint32_t mask)
uint32_t HAL_GetLXTEnabled(void)
uint32_t HAL_GetElapsedTick(uint32_t prev_tick, uint32_t curr_tick)