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