HPM SDK
HPMicro Software Development Kit
HALL driver APIs

HALL driver APIs. More...

Macros

#define HALL_EVENT_WDOG_FLAG_MASK   (1U << 31)
 
#define HALL_EVENT_PHUPT_FLAG_MASK   (1U << 30)
 
#define HALL_EVENT_PHPRE_FLAG_MASK   (1U << 29)
 
#define HALL_EVENT_PHDLYEN_FLAG_MASK   (1U << 28)
 
#define HALL_EVENT_U_FLAG_MASK   (1U << 23)
 
#define HALL_EVENT_V_FLAG_MASK   (1U << 22)
 
#define HALL_EVENT_W_FLAG_MASK   (1U << 21)
 
#define HALL_UVW_STAT_MASK   (HALL_COUNT_U_USTAT_MASK | HALL_COUNT_U_VSTAT_MASK | HALL_COUNT_U_WSTAT_MASK)
 
#define HALL_U_STAT_MASK   HALL_COUNT_U_USTAT_MASK
 
#define HALL_V_STAT_MASK   HALL_COUNT_U_VSTAT_MASK
 
#define HALL_W_STAT_MASK   HALL_COUNT_U_WSTAT_MASK
 

Typedefs

typedef enum hall_count_delay_start hall_count_delay_start_t
 select delay start time More...
 
typedef enum hall_rotate_direction hall_rotate_direction_t
 return value of motor movement direction More...
 
typedef enum hall_counter_type hall_counter_type_t
 counter type config More...
 

Enumerations

enum  hall_count_delay_start { hall_count_delay_start_after_uvw_toggle = 0 , hall_count_delay_start_after_pre_trigger = 1 }
 select delay start time More...
 
enum  hall_rotate_direction { hall_rotate_direction_forward = 0 , hall_rotate_direction_reversed = 1 }
 return value of motor movement direction More...
 
enum  hall_counter_type { hall_counter_type_w = 0 , hall_counter_type_v = 1 , hall_counter_type_u = 2 , hall_counter_type_timer = 3 }
 counter type config More...
 

Functions

static void hall_wdog_enable (HALL_Type *hall_x, uint32_t timeout)
 enable the watchdog More...
 
static void hall_wdog_disable (HALL_Type *hall_x)
 disable the watchdog More...
 
static void hall_phase_config (HALL_Type *hall_x, uint32_t delay_count, hall_count_delay_start_t delay_start)
 delay a certain number of clock cycles after receiving a trigger event More...
 
static void hall_pre_uvw_transition_config (HALL_Type *hall_x, uint32_t counter)
 early trigger configuration More...
 
static void hall_trigger_output_event_enable (HALL_Type *hall_x, uint32_t event_mask)
 enable trigger event mask More...
 
static void hall_trigger_output_event_disable (HALL_Type *hall_x, uint32_t event_mask)
 disable trigger event mask More...
 
static void hall_load_read_trigger_event_enable (HALL_Type *hall_x, uint32_t event_mask)
 enable hardware read event More...
 
static void hall_load_read_trigger_event_disable (HALL_Type *hall_x, uint32_t event_mask)
 disable hardware read event More...
 
static void hall_clear_status (HALL_Type *hall_x, uint32_t mask)
 clear status register More...
 
static uint32_t hall_get_status (HALL_Type *hall_x)
 get status register More...
 
static void hall_irq_enable (HALL_Type *hall_x, uint32_t mask)
 enable irq More...
 
static void hall_irq_disable (HALL_Type *hall_x, uint32_t mask)
 disable irq More...
 
static void hall_dma_request_enable (HALL_Type *hall_x, uint32_t mask)
 enable dma request More...
 
static void hall_dma_request_disable (HALL_Type *hall_x, uint32_t mask)
 disable dma request More...
 
static hall_rotate_direction_t hall_get_rotate_direction (HALL_Type *hall_x)
 get rotate direction More...
 
static uint32_t hall_get_current_uvw_stat (HALL_Type *hall_x)
 get three bits indicate UVW state More...
 
static uint32_t hall_get_current_count (HALL_Type *hall_x, hall_counter_type_t type)
 get current count U or V or W More...
 
static uint32_t hall_get_count_on_read_event (HALL_Type *hall_x, hall_counter_type_t type)
 get count when read event generated More...
 
static uint32_t hall_get_count_on_snap0_event (HALL_Type *hall_x, hall_counter_type_t type)
 get count when snap0 event generated More...
 
static uint32_t hall_get_count_on_snap1_event (HALL_Type *hall_x, hall_counter_type_t type)
 get count when snap1 event generated More...
 
static uint32_t hall_get_u_history0 (HALL_Type *hall_x)
 get the history count of u when u signal transition from 0 to 1 More...
 
static uint32_t hall_get_u_history1 (HALL_Type *hall_x)
 get the history count of u when u signal transition from 1 to 0 More...
 
static uint32_t hall_get_v_history0 (HALL_Type *hall_x)
 get the history count of v when v signal transition from 0 to 1 More...
 
static uint32_t hall_get_v_history1 (HALL_Type *hall_x)
 get the history count of v when v signal transition from 1 to 0 More...
 
static uint32_t hall_get_w_history0 (HALL_Type *hall_x)
 get the history count of w when w signal transition from 0 to 1 More...
 
static uint32_t hall_get_w_history1 (HALL_Type *hall_x)
 get the history count of w when w signal transition from 1 to 0 More...
 
static void hall_load_count_to_read_registers (HALL_Type *hall_x)
 load ucnt, vcnt, wcnt and tmrcnt into their read registers. Hardware auto-clear; More...
 
static void hall_snap_enable (HALL_Type *hall_x)
 enable hall snap More...
 
static void hall_snap_disable (HALL_Type *hall_x)
 disable hall snap More...
 
static void hall_counter_reset_assert (HALL_Type *hall_x)
 reset all counter and related snapshots assert More...
 
static void hall_counter_reset_release (HALL_Type *hall_x)
 reset all counter and related snapshots release More...
 

Detailed Description

HALL driver APIs.

Macro Definition Documentation

◆ HALL_EVENT_PHDLYEN_FLAG_MASK

#define HALL_EVENT_PHDLYEN_FLAG_MASK   (1U << 28)

#include <drivers/inc/hpm_hall_drv.h>

phdly flag

◆ HALL_EVENT_PHPRE_FLAG_MASK

#define HALL_EVENT_PHPRE_FLAG_MASK   (1U << 29)

#include <drivers/inc/hpm_hall_drv.h>

phpre flag

◆ HALL_EVENT_PHUPT_FLAG_MASK

#define HALL_EVENT_PHUPT_FLAG_MASK   (1U << 30)

#include <drivers/inc/hpm_hall_drv.h>

phupt flag

◆ HALL_EVENT_U_FLAG_MASK

#define HALL_EVENT_U_FLAG_MASK   (1U << 23)

#include <drivers/inc/hpm_hall_drv.h>

u flag

◆ HALL_EVENT_V_FLAG_MASK

#define HALL_EVENT_V_FLAG_MASK   (1U << 22)

#include <drivers/inc/hpm_hall_drv.h>

v flag

◆ HALL_EVENT_W_FLAG_MASK

#define HALL_EVENT_W_FLAG_MASK   (1U << 21)

#include <drivers/inc/hpm_hall_drv.h>

w flag

◆ HALL_EVENT_WDOG_FLAG_MASK

#define HALL_EVENT_WDOG_FLAG_MASK   (1U << 31)

#include <drivers/inc/hpm_hall_drv.h>

wdg flag

◆ HALL_U_STAT_MASK

#define HALL_U_STAT_MASK   HALL_COUNT_U_USTAT_MASK

◆ HALL_UVW_STAT_MASK

◆ HALL_V_STAT_MASK

#define HALL_V_STAT_MASK   HALL_COUNT_U_VSTAT_MASK

◆ HALL_W_STAT_MASK

#define HALL_W_STAT_MASK   HALL_COUNT_U_WSTAT_MASK

Typedef Documentation

◆ hall_count_delay_start_t

#include <drivers/inc/hpm_hall_drv.h>

select delay start time

◆ hall_counter_type_t

#include <drivers/inc/hpm_hall_drv.h>

counter type config

◆ hall_rotate_direction_t

#include <drivers/inc/hpm_hall_drv.h>

return value of motor movement direction

Enumeration Type Documentation

◆ hall_count_delay_start

#include <drivers/inc/hpm_hall_drv.h>

select delay start time

Enumerator
hall_count_delay_start_after_uvw_toggle 

start counting delay after u,v,w toggle

hall_count_delay_start_after_pre_trigger 

start counting delay after pre-trigger

◆ hall_counter_type

#include <drivers/inc/hpm_hall_drv.h>

counter type config

Enumerator
hall_counter_type_w 

type w

hall_counter_type_v 

type v

hall_counter_type_u 

type u

hall_counter_type_timer 

type timer

◆ hall_rotate_direction

#include <drivers/inc/hpm_hall_drv.h>

return value of motor movement direction

Enumerator
hall_rotate_direction_forward 

direction forward

hall_rotate_direction_reversed 

direction reversed

Function Documentation

◆ hall_clear_status()

static void hall_clear_status ( HALL_Type hall_x,
uint32_t  mask 
)
inlinestatic

◆ hall_counter_reset_assert()

static void hall_counter_reset_assert ( HALL_Type hall_x)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

reset all counter and related snapshots assert

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)

◆ hall_counter_reset_release()

static void hall_counter_reset_release ( HALL_Type hall_x)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

reset all counter and related snapshots release

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)

◆ hall_dma_request_disable()

static void hall_dma_request_disable ( HALL_Type hall_x,
uint32_t  mask 
)
inlinestatic

◆ hall_dma_request_enable()

static void hall_dma_request_enable ( HALL_Type hall_x,
uint32_t  mask 
)
inlinestatic

◆ hall_get_count_on_read_event()

static uint32_t hall_get_count_on_read_event ( HALL_Type hall_x,
hall_counter_type_t  type 
)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

get count when read event generated

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
[in]typehall_counter_type_t
Return values
countvalue

◆ hall_get_count_on_snap0_event()

static uint32_t hall_get_count_on_snap0_event ( HALL_Type hall_x,
hall_counter_type_t  type 
)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

get count when snap0 event generated

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
[in]typehall_counter_type_t
Return values
countvalue

◆ hall_get_count_on_snap1_event()

static uint32_t hall_get_count_on_snap1_event ( HALL_Type hall_x,
hall_counter_type_t  type 
)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

get count when snap1 event generated

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
[in]typehall_counter_type_t
Return values
countvalue

◆ hall_get_current_count()

static uint32_t hall_get_current_count ( HALL_Type hall_x,
hall_counter_type_t  type 
)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

get current count U or V or W

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
[in]typehall_counter_type_t
Return values
countvalue

◆ hall_get_current_uvw_stat()

static uint32_t hall_get_current_uvw_stat ( HALL_Type hall_x)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

get three bits indicate UVW state

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
Return values
threebits UVW state

◆ hall_get_rotate_direction()

static hall_rotate_direction_t hall_get_rotate_direction ( HALL_Type hall_x)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

get rotate direction

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
Return values
hall_rotate_direction_t

◆ hall_get_status()

static uint32_t hall_get_status ( HALL_Type hall_x)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

get status register

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
Return values
uint32_tvalue:
HALL_EVENT_WDOG_FLAG_MASKif watchdog counter timeout
HALL_EVENT_PHUPT_FLAG_MASKif U/V/W Flip any input signal
HALL_EVENT_PHPRE_FLAG_MASKif early trigger events occur
HALL_EVENT_PHDLYEN_FLAG_MASKif time delay events occur
HALL_EVENT_U_FLAG_MASKif U signal flip
HALL_EVENT_V_FLAG_MASKif V signal flip
HALL_EVENT_W_FLAG_MASKif W signal flip

◆ hall_get_u_history0()

static uint32_t hall_get_u_history0 ( HALL_Type hall_x)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

get the history count of u when u signal transition from 0 to 1

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
Return values
countvalue

◆ hall_get_u_history1()

static uint32_t hall_get_u_history1 ( HALL_Type hall_x)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

get the history count of u when u signal transition from 1 to 0

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
Return values
countvalue

◆ hall_get_v_history0()

static uint32_t hall_get_v_history0 ( HALL_Type hall_x)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

get the history count of v when v signal transition from 0 to 1

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
Return values
countvalue

◆ hall_get_v_history1()

static uint32_t hall_get_v_history1 ( HALL_Type hall_x)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

get the history count of v when v signal transition from 1 to 0

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
Return values
countvalue

◆ hall_get_w_history0()

static uint32_t hall_get_w_history0 ( HALL_Type hall_x)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

get the history count of w when w signal transition from 0 to 1

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
Return values
countvalue

◆ hall_get_w_history1()

static uint32_t hall_get_w_history1 ( HALL_Type hall_x)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

get the history count of w when w signal transition from 1 to 0

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
Return values
countvalue

◆ hall_irq_disable()

static void hall_irq_disable ( HALL_Type hall_x,
uint32_t  mask 
)
inlinestatic

◆ hall_irq_enable()

static void hall_irq_enable ( HALL_Type hall_x,
uint32_t  mask 
)
inlinestatic

◆ hall_load_count_to_read_registers()

static void hall_load_count_to_read_registers ( HALL_Type hall_x)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

load ucnt, vcnt, wcnt and tmrcnt into their read registers. Hardware auto-clear;

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)

◆ hall_load_read_trigger_event_disable()

static void hall_load_read_trigger_event_disable ( HALL_Type hall_x,
uint32_t  event_mask 
)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

disable hardware read event

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
[in]event_maskread registers flag

◆ hall_load_read_trigger_event_enable()

static void hall_load_read_trigger_event_enable ( HALL_Type hall_x,
uint32_t  event_mask 
)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

enable hardware read event

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
[in]event_maskread registers flag

◆ hall_phase_config()

static void hall_phase_config ( HALL_Type hall_x,
uint32_t  delay_count,
hall_count_delay_start_t  delay_start 
)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

delay a certain number of clock cycles after receiving a trigger event

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
[in]delay_countdelay clock cycles number
[in]delay_startselect the trigger moment

◆ hall_pre_uvw_transition_config()

static void hall_pre_uvw_transition_config ( HALL_Type hall_x,
uint32_t  counter 
)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

early trigger configuration

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
[in]counterthe clock cycle number

◆ hall_snap_disable()

static void hall_snap_disable ( HALL_Type hall_x)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

disable hall snap

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)

◆ hall_snap_enable()

static void hall_snap_enable ( HALL_Type hall_x)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

enable hall snap

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)

◆ hall_trigger_output_event_disable()

static void hall_trigger_output_event_disable ( HALL_Type hall_x,
uint32_t  event_mask 
)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

disable trigger event mask

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
[in]event_maskevent mask to bo checked

◆ hall_trigger_output_event_enable()

static void hall_trigger_output_event_enable ( HALL_Type hall_x,
uint32_t  event_mask 
)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

enable trigger event mask

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
[in]event_maskevent mask to be checked

◆ hall_wdog_disable()

static void hall_wdog_disable ( HALL_Type hall_x)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

disable the watchdog

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)

◆ hall_wdog_enable()

static void hall_wdog_enable ( HALL_Type hall_x,
uint32_t  timeout 
)
inlinestatic

#include <drivers/inc/hpm_hall_drv.h>

enable the watchdog

Parameters
[in]hall_xHALL base address HPM_HALLx(x=0..n)
[in]timeoutwatch dog timeout value , unit is HALL system clock