1 /** 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * 15 * Description: Provides hal tsensor \n 16 * 17 * History: \n 18 * 2023-03-06, Create file. \n 19 */ 20 #include "common_def.h" 21 #include "hal_tsensor.h" 22 23 hal_tsensor_funcs_t *g_hal_tsensor_funcs = NULL; 24 uintptr_t g_hal_tsensor_regs = 0; 25 hal_tsensor_regs_init(void)26errcode_t hal_tsensor_regs_init(void) 27 { 28 if (tsensor_port_base_addr_get() == 0) { 29 return ERRCODE_TSENSOR_REG_ADDR_INVALID; 30 } 31 32 g_hal_tsensor_regs = tsensor_port_base_addr_get(); 33 34 return ERRCODE_SUCC; 35 } 36 hal_tsensor_regs_deinit(void)37void hal_tsensor_regs_deinit(void) 38 { 39 g_hal_tsensor_regs = 0; 40 } 41 hal_tsensor_register_funcs(hal_tsensor_funcs_t * funcs)42errcode_t hal_tsensor_register_funcs(hal_tsensor_funcs_t *funcs) 43 { 44 if (funcs == NULL) { 45 return ERRCODE_INVALID_PARAM; 46 } 47 48 g_hal_tsensor_funcs = funcs; 49 50 return ERRCODE_SUCC; 51 } 52 hal_tsensor_unregister_funcs(void)53errcode_t hal_tsensor_unregister_funcs(void) 54 { 55 g_hal_tsensor_funcs = NULL; 56 return ERRCODE_SUCC; 57 } 58 hal_tsensor_get_funcs(void)59hal_tsensor_funcs_t *hal_tsensor_get_funcs(void) 60 { 61 return g_hal_tsensor_funcs; 62 }