Loading...
Searching...
No Matches
furi_hal_cortex.h File Reference

ARM Cortex HAL. More...

#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  FuriHalCortexTimer
 Cortex timer provides high precision low level expiring timer. More...
 

Enumerations

enum  FuriHalCortexComp { FuriHalCortexComp0 , FuriHalCortexComp1 , FuriHalCortexComp2 , FuriHalCortexComp3 }
 
enum  FuriHalCortexCompSize { FuriHalCortexCompSizeWord = 0b10 , FuriHalCortexCompSizeHalfWord = 0b01 , FuriHalCortexCompSizeByte = 0b00 }
 
enum  FuriHalCortexCompFunction { FuriHalCortexCompFunctionPC = 0b100 , FuriHalCortexCompFunctionRead = 0b101 , FuriHalCortexCompFunctionWrite = 0b110 , FuriHalCortexCompFunctionReadWrite = 0b110 }
 

Functions

void furi_hal_cortex_init_early (void)
 Early init stage for cortex.
 
void furi_hal_cortex_delay_us (uint32_t microseconds)
 Microseconds delay.
 
uint32_t furi_hal_cortex_instructions_per_microsecond (void)
 Get instructions per microsecond count.
 
FuriHalCortexTimer furi_hal_cortex_timer_get (uint32_t timeout_us)
 Get Timer.
 
bool furi_hal_cortex_timer_is_expired (FuriHalCortexTimer cortex_timer)
 Check if timer expired.
 
void furi_hal_cortex_timer_wait (FuriHalCortexTimer cortex_timer)
 Wait for timer expire.
 
void furi_hal_cortex_comp_enable (FuriHalCortexComp comp, FuriHalCortexCompFunction function, uint32_t value, uint32_t mask, FuriHalCortexCompSize size)
 Enable DWT comparator.
 
void furi_hal_cortex_comp_reset (FuriHalCortexComp comp)
 Reset DWT comparator.
 

Detailed Description

ARM Cortex HAL.

Function Documentation

◆ furi_hal_cortex_comp_enable()

void furi_hal_cortex_comp_enable ( FuriHalCortexComp comp,
FuriHalCortexCompFunction function,
uint32_t value,
uint32_t mask,
FuriHalCortexCompSize size )

Enable DWT comparator.

Allows to programmatically set instruction/data breakpoints.

More details on how it works can be found in armv7m official documentation: https://developer.arm.com/documentation/ddi0403/d/Debug-Architecture/ARMv7-M-Debug/The-Data-Watchpoint-and-Trace-unit/The-DWT-comparators https://developer.arm.com/documentation/ddi0403/d/Debug-Architecture/ARMv7-M-Debug/The-Data-Watchpoint-and-Trace-unit/Comparator-Function-registers&ndash;DWT-FUNCTIONn

Parameters
[in]compThe Comparator
[in]functionThe Comparator Function to use
[in]valueThe value
[in]maskThe mask
[in]sizeThe size

◆ furi_hal_cortex_comp_reset()

void furi_hal_cortex_comp_reset ( FuriHalCortexComp comp)

Reset DWT comparator.

Parameters
[in]compThe Comparator

◆ furi_hal_cortex_delay_us()

void furi_hal_cortex_delay_us ( uint32_t microseconds)

Microseconds delay.

Parameters
[in]microsecondsThe microseconds to wait

◆ furi_hal_cortex_instructions_per_microsecond()

uint32_t furi_hal_cortex_instructions_per_microsecond ( void )

Get instructions per microsecond count.

Returns
instructions per microsecond count

◆ furi_hal_cortex_timer_get()

FuriHalCortexTimer furi_hal_cortex_timer_get ( uint32_t timeout_us)

Get Timer.

Parameters
[in]timeout_usThe expire timeout in us
Returns
The FuriHalCortexTimer

◆ furi_hal_cortex_timer_is_expired()

bool furi_hal_cortex_timer_is_expired ( FuriHalCortexTimer cortex_timer)

Check if timer expired.

Parameters
[in]cortex_timerThe FuriHalCortexTimer
Returns
true if expired

◆ furi_hal_cortex_timer_wait()

void furi_hal_cortex_timer_wait ( FuriHalCortexTimer cortex_timer)

Wait for timer expire.

Parameters
[in]cortex_timerThe FuriHalCortexTimer