HPM SDK
HPMicro Software Development Kit
hpm_sdm_drv.h File Reference
#include "hpm_common.h"
#include "hpm_sdm_regs.h"
#include "hpm_soc_ip_feature.h"

Go to the source code of this file.

Data Structures

struct  sdm_control_t
 
struct  sdm_channel_common_config_t
 
struct  sdm_comparator_config_t
 
struct  sdm_filter_config_t
 
struct  sdm_output_config_t
 

Macros

#define SAMPLING_MODE_MASK   (0x7U)
 
#define CHN_SAMPLING_MODE_SHIFT(ch)   ((ch) * 3U + SDM_CTRL_CHMD_SHIFT)
 
#define CHN_SAMPLING_MODE_MASK(ch)   (SAMPLING_MODE_MASK << CHN_SAMPLING_MODE_SHIFT(ch))
 
#define CH0_EN_MASK   (0x1U << SDM_CTRL_CH_EN_SHIFT)
 
#define CHN_EN_MASK(ch)   (CH0_EN_MASK << (ch))
 
#define CHN_ERR_MASK(ch)   (SDM_INT_EN_CH0ERR_MASK << (ch))
 
#define CHN_DRY_MASK(ch)   (SDM_INT_EN_CH0DRY_MASK << (ch))
 

Enumerations

enum  sdm_sampling_mode_t {
  sdm_sampling_rising_clk_edge = 0 , sdm_sampling_every_clk_edge = 1 , sdm_sampling_manchester_mode = 2 , sdm_sampling_falling_clk_edge = 3 ,
  sdm_sampling_rising_two_clk_edge = 4 , sdm_sampling_falling_two_clk_edge = 5
}
 
enum  sdm_filter_type_t { sdm_filter_sinc1 = 0 , sdm_filter_sinc2 = 1 , sdm_filter_sinc3 = 2 , sdm_filter_fast_sinc2 = 3 }
 
enum  sdm_comparator_event_t {
  sdm_comparator_no_event = 0 , sdm_comparator_event_out_high_threshold = SDM_CH_SCST_CMPH_MASK , sdm_comparator_event_out_low_threshold = SDM_CH_SCST_CMPL_MASK , sdm_comparator_event_hz = SDM_CH_SCST_HZ_MASK ,
  sdm_comparator_event_invalid_clk = SDM_CH_SCST_MF_MASK
}
 
enum  sdm_channel_int_status_mask_t {
  sdm_chn0_error_mask = SDM_INT_EN_CH0ERR_MASK , sdm_chn1_error_mask = SDM_INT_EN_CH1ERR_MASK , sdm_chn2_error_mask = SDM_INT_EN_CH2ERR_MASK , sdm_chn3_error_mask = SDM_INT_EN_CH3ERR_MASK ,
  sdm_chn0_data_ready_mask = SDM_INT_EN_CH0DRY_MASK , sdm_chn1_data_ready_mask = SDM_INT_EN_CH1DRY_MASK , sdm_chn2_data_ready_mask = SDM_INT_EN_CH2DRY_MASK , sdm_chn3_data_ready_mask = SDM_INT_EN_CH3DRY_MASK
}
 
enum  sdm_channel_enable_mask_t { sdm_chn0_enable_mask = 1U << SDM_CTRL_CH_EN_SHIFT , sdm_chn1_enable_mask = 1U << (SDM_CTRL_CH_EN_SHIFT + 1U) , sdm_chn2_enable_mask = 1U << (SDM_CTRL_CH_EN_SHIFT + 2U) , sdm_chn3_enable_mask = 1U << (SDM_CTRL_CH_EN_SHIFT + 3U) }
 

Functions

static void sdm_enable_module_interrupt (SDM_Type *ptr, bool enable)
 sdm enable module interrupt More...
 
static void sdm_enable_channel (SDM_Type *ptr, uint8_t ch_index, bool enable)
 sdm enable channel More...
 
static void sdm_enable_channel_filter (SDM_Type *ptr, uint8_t ch_index, bool enable)
 sdm enable channel sample data function More...
 
static void sdm_enable_channel_comparator (SDM_Type *ptr, uint8_t ch_index, bool enable)
 sdm enable channel amplitude detect function More...
 
static void sdm_enable_channel_by_mask (SDM_Type *ptr, uint32_t ch_mask)
 sdm enable channel by mask More...
 
static void sdm_set_channel_sampling_mode (SDM_Type *ptr, uint8_t ch_index, sdm_sampling_mode_t mode)
 sdm set channel sampling mode More...
 
static void sdm_enable_channel_interrupt (SDM_Type *ptr, uint32_t mask)
 sdm enable channel interrupt More...
 
static uint32_t sdm_get_status (SDM_Type *ptr)
 sdm get status register value More...
 
static bool sdm_get_channel_data_ready_status (SDM_Type *ptr, uint8_t ch)
 get channel data ready status More...
 
static bool sdm_get_channel_data_error_status (SDM_Type *ptr, uint8_t ch)
 get channel error status More...
 
static void sdm_set_ch_fifo_threshold (SDM_Type *ptr, uint8_t ch, uint8_t threshold)
 sdm set channel's fifo threshold More...
 
static uint8_t sdm_get_ch_fifo_threshold (SDM_Type *ptr, uint8_t ch)
 sdm get channel fifo threshold More...
 
static uint32_t sdm_get_channel_filter_status (SDM_Type *ptr, uint8_t ch)
 sdm get channel filter status More...
 
static void sdm_clean_channel_filter_status (SDM_Type *ptr, uint8_t ch, uint32_t mask)
 sdm clean channel sample data status More...
 
static uint8_t sdm_get_channel_fifo_data_count (SDM_Type *ptr, uint8_t ch)
 sdm get channel data count in fifo More...
 
static int32_t sdm_get_channel_fifo_data (SDM_Type *ptr, uint8_t ch)
 sdm get channel filter output data in fifo More...
 
static uint8_t sdm_get_channel_clock_cycle_count (SDM_Type *ptr, uint8_t ch)
 sdm get channel input clock cycle count More...
 
static uint16_t sdm_get_channel_comparator_data (SDM_Type *ptr, uint8_t ch)
 sdm get channel comparator data More...
 
static void sdm_set_channel_comparator_high_threshold (SDM_Type *ptr, uint8_t ch, uint16_t value)
 sdm set channel comparator high threshold More...
 
static void sdm_set_channel_comparator_zero_crossing_threshold (SDM_Type *ptr, uint8_t ch, uint16_t value)
 sdm set channel comparator zero crossing threshold More...
 
static void sdm_set_channel_comparator_low_threshold (SDM_Type *ptr, uint8_t ch, uint16_t value)
 sdm set channel comparator low threshold More...
 
static uint32_t sdm_get_channel_comparator_status (SDM_Type *ptr, uint8_t ch)
 sdm get channel comparator status register value More...
 
static void sdm_clean_channel_comparator_status (SDM_Type *ptr, uint8_t ch, uint32_t mask)
 sdm clean channel amplitude detect status More...
 
void sdm_get_default_module_control (SDM_Type *ptr, sdm_control_t *control)
 sdm get default module control More...
 
void sdm_init_module (SDM_Type *ptr, sdm_control_t *control)
 sdm init module More...
 
void sdm_get_channel_common_setting (SDM_Type *ptr, sdm_channel_common_config_t *config)
 sdm get channel common setting More...
 
void sdm_config_channel_common_setting (SDM_Type *ptr, uint8_t ch_index, sdm_channel_common_config_t *config)
 sdm config channel's common setting More...
 
void sdm_get_channel_default_filter_config (SDM_Type *ptr, sdm_filter_config_t *filter_config)
 sdm get channel default filter config More...
 
void sdm_config_channel_filter (SDM_Type *ptr, uint8_t ch_index, sdm_filter_config_t *filter_config)
 sdm config channel filter More...
 
void sdm_get_channel_default_comparator_config (SDM_Type *ptr, sdm_comparator_config_t *cmp_config)
 sdm get channel default comparator config More...
 
void sdm_config_channel_comparator (SDM_Type *ptr, uint8_t ch_index, sdm_comparator_config_t *cmp_config)
 sdm config channel comparator More...
 
hpm_stat_t sdm_receive_one_filter_data (SDM_Type *ptr, uint8_t ch_index, bool using_fifo, int8_t *data, uint8_t data_len_in_bytes)
 sdm receive one filter data More...
 
hpm_stat_t sdm_receive_filter_data (SDM_Type *ptr, uint8_t ch_index, bool using_fifo, int8_t *data, uint32_t count, uint8_t data_len_in_bytes)
 sdm receive filter data More...