From b9fd4bdb7e3703a1223b3b7a7ddd0d72e7159485 Mon Sep 17 00:00:00 2001 From: bluew Date: Sat, 3 Jul 2021 22:11:22 +0200 Subject: [PATCH] hal: Add apb_soc_v4 --- include/hal/apb_soc/apb_soc_v4.h | 156 +++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 include/hal/apb_soc/apb_soc_v4.h diff --git a/include/hal/apb_soc/apb_soc_v4.h b/include/hal/apb_soc/apb_soc_v4.h new file mode 100644 index 0000000..c8dc12d --- /dev/null +++ b/include/hal/apb_soc/apb_soc_v4.h @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2018 ETH Zurich and University of Bologna + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __HAL_APB_SOC_APB_SOC_V4_H__ +#define __HAL_APB_SOC_APB_SOC_V4_H__ + +#include "archi/pulp.h" +#include "hal/pulp_io.h" + +static inline void apb_soc_bootaddr_set(unsigned int value) { + pulp_write32(ARCHI_APB_SOC_CTRL_ADDR + APB_SOC_BOOTADDR_OFFSET, value); +} + +static inline unsigned int apb_soc_bootaddr_get() { + return pulp_read32(ARCHI_APB_SOC_CTRL_ADDR + APB_SOC_BOOTADDR_OFFSET); +} + +static inline int apb_soc_busy_get() { + return pulp_read32(ARCHI_APB_SOC_CTRL_ADDR + APB_SOC_BUSY_OFFSET); +} + +static inline void apb_soc_cluster_isolate_set(int isolate) { + pulp_write32(ARCHI_APB_SOC_CTRL_ADDR + APB_SOC_CLUSTER_ISOLATE_OFFSET, isolate); +} + +static inline void apb_soc_status_set(unsigned int value) { + pulp_write32(ARCHI_APB_SOC_CTRL_ADDR + APB_SOC_CORESTATUS_OFFSET, value | (1<> APB_SOC_PADS_CONFIG_BOOTSEL_BIT) & 1; +} + +#endif