1 /* 2 * Copyright (c) 2024 HPMicro 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 */ 7 8 #include "hpm_tamp_drv.h" 9 tamp_init_ch_config(TAMP_Type * ptr,uint8_t ch,tamper_ch_config_t * config)10void tamp_init_ch_config(TAMP_Type *ptr, uint8_t ch, tamper_ch_config_t *config) 11 { 12 ch >>= 1u; 13 ptr->TAMP[ch].CONTROL = TAMP_TAMP_CONTROL_BYPASS_SET(config->filter_bypass) 14 | TAMP_TAMP_CONTROL_FILTER_SET(config->filter_len) 15 | TAMP_TAMP_CONTROL_VALUE_SET(config->expect_high_level) 16 | TAMP_TAMP_CONTROL_SPEED_SET(config->speed) 17 | TAMP_TAMP_CONTROL_RECOVER_SET(config->auto_recover) 18 | TAMP_TAMP_CONTROL_ACTIVE_SET(config->active_mode) 19 | TAMP_TAMP_CONTROL_ENABLE_SET(config->enable); 20 ptr->TAMP[ch].POLY = config->poly; 21 ptr->TAMP[ch].LFSR = config->lfsr; 22 } 23 tamp_get_default_ch_config(TAMP_Type * ptr,tamper_ch_config_t * config)24void tamp_get_default_ch_config(TAMP_Type *ptr, tamper_ch_config_t *config) 25 { 26 (void) ptr; 27 config->enable = false; 28 config->active_mode = false; 29 config->expect_high_level = false; 30 config->filter_bypass = false; 31 config->filter_len = filter_len_128_cycles; 32 config->speed = spd_1_time_per_sec; 33 config->auto_recover = false; 34 config->poly = 0; 35 config->lfsr = 0; 36 } 37