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