You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2021/10/26 17:04:21 UTC

[mynewt-core] 10/10: tinyusb/nrf5340: Allow for non-secure peripheral

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit f639e90be8b0886d0b1c4252e6279c90ee61a2c4
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Wed Oct 20 16:51:58 2021 +0200

    tinyusb/nrf5340: Allow for non-secure peripheral
    
    NRF_USBREGULATOR_S was always used now for non-secure
    build NRF_USBREGULATOR will map to NRF_USBREGULATOR_NS.
---
 hw/usb/tinyusb/nrf53/src/nrf53.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/hw/usb/tinyusb/nrf53/src/nrf53.c b/hw/usb/tinyusb/nrf53/src/nrf53.c
index 795fb07..a439b06 100644
--- a/hw/usb/tinyusb/nrf53/src/nrf53.c
+++ b/hw/usb/tinyusb/nrf53/src/nrf53.c
@@ -57,18 +57,18 @@ nrf_usbreg_event_get_and_clear(NRF_USBREG_Type *p_reg,
 static void
 USBREG_IRQHandler(void)
 {
-    if (nrf_usbreg_int_enable_check(NRF_USBREGULATOR_S, NRF_USBREG_INT_USBDETECTED) &&
-        (nrf_usbreg_event_get_and_clear(NRF_USBREGULATOR_S, NRF_USBREG_EVENT_USBDETECTED))) {
+    if (nrf_usbreg_int_enable_check(NRF_USBREGULATOR, NRF_USBREG_INT_USBDETECTED) &&
+        (nrf_usbreg_event_get_and_clear(NRF_USBREGULATOR, NRF_USBREG_EVENT_USBDETECTED))) {
         tusb_hal_nrf_power_event(USB_EVT_DETECTED);
     }
 
-    if (nrf_usbreg_int_enable_check(NRF_USBREGULATOR_S, NRF_USBREG_INT_USBREMOVED) &&
-        nrf_usbreg_event_get_and_clear(NRF_USBREGULATOR_S,NRF_USBREG_EVENT_USBREMOVED)) {
+    if (nrf_usbreg_int_enable_check(NRF_USBREGULATOR, NRF_USBREG_INT_USBREMOVED) &&
+        nrf_usbreg_event_get_and_clear(NRF_USBREGULATOR,NRF_USBREG_EVENT_USBREMOVED)) {
         tusb_hal_nrf_power_event(USB_EVT_REMOVED);
     }
 
-    if (nrf_usbreg_int_enable_check(NRF_USBREGULATOR_S, NRF_USBREG_INT_USBPWRRDY) &&
-        nrf_usbreg_event_get_and_clear(NRF_USBREGULATOR_S, NRF_USBREG_EVENT_USBPWRRDY)) {
+    if (nrf_usbreg_int_enable_check(NRF_USBREGULATOR, NRF_USBREG_INT_USBPWRRDY) &&
+        nrf_usbreg_event_get_and_clear(NRF_USBREGULATOR, NRF_USBREG_EVENT_USBPWRRDY)) {
         tusb_hal_nrf_power_event(USB_EVT_READY);
     }
 }
@@ -83,7 +83,7 @@ tinyusb_hardware_init(void)
     /* Setup Power IRQ to detect USB VBUS state (detected, ready, removed) */
     NVIC_SetVector(USBREGULATOR_IRQn, (uint32_t)USBREG_IRQHandler);
     NVIC_SetPriority(USBREGULATOR_IRQn, 7);
-    nrf_usbreg_int_enable(NRF_USBREGULATOR_S,
+    nrf_usbreg_int_enable(NRF_USBREGULATOR,
                           USBREG_INTEN_USBDETECTED_Msk |
                           USBREG_INTEN_USBREMOVED_Msk |
                           USBREG_INTEN_USBPWRRDY_Msk);
@@ -94,7 +94,7 @@ tinyusb_hardware_init(void)
      * USB power may already be ready at this time -> no event generated
      * We need to invoke the handler based on the status initially
      */
-    uint32_t usb_reg = NRF_USBREGULATOR_S->USBREGSTATUS;
+    uint32_t usb_reg = NRF_USBREGULATOR->USBREGSTATUS;
 
     if (usb_reg & USBREG_USBREGSTATUS_VBUSDETECT_Msk) {
         tusb_hal_nrf_power_event(USB_EVT_DETECTED);