1 /* 2 * Copyright (c) 2019 - 2023, Nordic Semiconductor ASA 3 * All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are met: 9 * 10 * 1. Redistributions of source code must retain the above copyright notice, this 11 * list of conditions and the following disclaimer. 12 * 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * 3. Neither the name of the copyright holder nor the names of its 18 * contributors may be used to endorse or promote products derived from this 19 * software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 #ifndef NRFX_POWER_COMPAT_H__ 35 #define NRFX_POWER_COMPAT_H__ 36 37 /** 38 * POWER compatibility layer. 39 * 40 * The following definitions allow using of common code involving the POWER peripheral 41 * driver for different SoCs, regardless of whether certain regulator registers 42 * are located in the POWER peripheral or in separate peripherals like USBREG and REGULATORS. 43 */ 44 45 #if defined(REGULATORS_PRESENT) 46 #include <hal/nrf_regulators.h> 47 #endif 48 49 #if NRF_REGULATORS_HAS_POFCON 50 51 typedef nrf_regulators_pof_thr_t nrf_power_pof_thr_t; 52 #define NRF_POWER_POFTHR_V19 NRF_REGULATORS_POFTHR_V19 53 #define NRF_POWER_POFTHR_V20 NRF_REGULATORS_POFTHR_V20 54 #define NRF_POWER_POFTHR_V21 NRF_REGULATORS_POFTHR_V21 55 #define NRF_POWER_POFTHR_V22 NRF_REGULATORS_POFTHR_V22 56 #define NRF_POWER_POFTHR_V23 NRF_REGULATORS_POFTHR_V23 57 #define NRF_POWER_POFTHR_V24 NRF_REGULATORS_POFTHR_V24 58 #define NRF_POWER_POFTHR_V25 NRF_REGULATORS_POFTHR_V25 59 #define NRF_POWER_POFTHR_V26 NRF_REGULATORS_POFTHR_V26 60 #define NRF_POWER_POFTHR_V27 NRF_REGULATORS_POFTHR_V27 61 #define NRF_POWER_POFTHR_V28 NRF_REGULATORS_POFTHR_V28 62 63 typedef nrf_regulators_pof_thrvddh_t nrf_power_pof_thrvddh_t; 64 #define NRF_POWER_POFTHRVDDH_V27 NRF_REGULATORS_POFTHRVDDH_V27 65 #define NRF_POWER_POFTHRVDDH_V28 NRF_REGULATORS_POFTHRVDDH_V28 66 #define NRF_POWER_POFTHRVDDH_V29 NRF_REGULATORS_POFTHRVDDH_V29 67 #define NRF_POWER_POFTHRVDDH_V30 NRF_REGULATORS_POFTHRVDDH_V30 68 #define NRF_POWER_POFTHRVDDH_V31 NRF_REGULATORS_POFTHRVDDH_V31 69 #define NRF_POWER_POFTHRVDDH_V32 NRF_REGULATORS_POFTHRVDDH_V32 70 #define NRF_POWER_POFTHRVDDH_V33 NRF_REGULATORS_POFTHRVDDH_V33 71 #define NRF_POWER_POFTHRVDDH_V34 NRF_REGULATORS_POFTHRVDDH_V34 72 #define NRF_POWER_POFTHRVDDH_V35 NRF_REGULATORS_POFTHRVDDH_V35 73 #define NRF_POWER_POFTHRVDDH_V36 NRF_REGULATORS_POFTHRVDDH_V36 74 #define NRF_POWER_POFTHRVDDH_V37 NRF_REGULATORS_POFTHRVDDH_V37 75 #define NRF_POWER_POFTHRVDDH_V38 NRF_REGULATORS_POFTHRVDDH_V38 76 #define NRF_POWER_POFTHRVDDH_V39 NRF_REGULATORS_POFTHRVDDH_V39 77 #define NRF_POWER_POFTHRVDDH_V40 NRF_REGULATORS_POFTHRVDDH_V40 78 #define NRF_POWER_POFTHRVDDH_V41 NRF_REGULATORS_POFTHRVDDH_V41 79 #define NRF_POWER_POFTHRVDDH_V42 NRF_REGULATORS_POFTHRVDDH_V42 80 81 #endif // NRF_REGULATORS_HAS_POFCON 82 83 #if defined(USBREG_PRESENT) 84 #include "nrfx_usbreg.h" 85 86 typedef nrfx_usbreg_event_handler_t nrfx_power_usb_event_handler_t; 87 typedef nrfx_usbreg_config_t nrfx_power_usbevt_config_t; 88 89 typedef nrfx_usbreg_evt_t nrfx_power_usb_evt_t; 90 #define NRFX_POWER_USB_EVT_DETECTED NRFX_USBREG_EVT_DETECTED 91 #define NRFX_POWER_USB_EVT_REMOVED NRFX_USBREG_EVT_REMOVED 92 #define NRFX_POWER_USB_EVT_READY NRFX_USBREG_EVT_READY 93 94 typedef nrfx_usbreg_state_t nrfx_power_usb_state_t; 95 #define NRFX_POWER_USB_STATE_DISCONNECTED NRFX_USBREG_STATE_DISCONNECTED 96 #define NRFX_POWER_USB_STATE_CONNECTED NRFX_USBREG_STATE_CONNECTED 97 #define NRFX_POWER_USB_STATE_READY NRFX_USBREG_STATE_READY 98 99 #define nrfx_power_usb_handler_get nrfx_usbreg_handler_get 100 #define nrfx_power_usbevt_init nrfx_usbreg_init 101 #define nrfx_power_usbevt_enable nrfx_usbreg_enable 102 #define nrfx_power_usbevt_disable nrfx_usbreg_disable 103 #define nrfx_power_usbevt_uninit nrfx_usbreg_uninit 104 #define nrfx_power_usbstatus_get nrfx_usbreg_usbstatus_get 105 106 #endif // defined(USBREG_PRESENT) 107 108 #endif // NRFX_POWER_COMPAT_H__ 109