Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
19392: ztimer: Fix doc on ztimer_remove r=benpicco a=bergzand

### Contribution description

See the subject 


### Testing procedure

Read the modified docs


### Issues/PRs references

None

19398: gnrc_ipv6_static_addr: fix build with only static address r=benpicco a=benpicco



19399: drivers/usbdev_synopsys_dwc2: add ESP32x power management r=benpicco a=gschorcht

### Contribution description

This PR adds power management handling for ESP32x SoCs.

### Testing procedure

Use and ESP32-S2 or ESP32-S3 board and flash `tests/periph_pm` using the `stdio_cdc_acm`
```
USEMODULE=stdio_cdc_acm BOARD=esp32s3-devkit make -j8 -C tests/periph_pm flash
```
Connect the terminal to the board and execute command:
```
set_rtc 1 1
```
The console should continue to work after the 1-s light sleep.

### Issues/PRs references


Co-authored-by: Koen Zandberg <koen@bergzand.net>
Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
  • Loading branch information
4 people authored Mar 16, 2023
4 parents 97e8127 + fa0ab40 + a473ca9 + d388055 commit 1a787d4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
7 changes: 7 additions & 0 deletions drivers/usbdev_synopsys_dwc2/usbdev_synopsys_dwc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,8 @@ static void _sleep_periph(const dwc2_usb_otg_fshs_config_t *conf)
/* switch USB core clock source either to LFXO or LFRCO */
CMU_ClockSelectSet(cmuClock_USB, CLOCK_LFA);
pm_unblock(EFM32_PM_MODE_EM2);
#elif defined(MCU_ESP32)
pm_unblock(ESP_PM_LIGHT_SLEEP);
#endif
}

Expand All @@ -613,6 +615,8 @@ static void _wake_periph(const dwc2_usb_otg_fshs_config_t *conf)
#else
#error "EFM32 family not yet supported"
#endif
#elif defined(MCU_ESP32)
pm_block(ESP_PM_LIGHT_SLEEP);
#endif
*_pcgcctl_reg(conf) &= ~USB_OTG_PCGCCTL_STOPCLK;
_flush_rx_fifo(conf);
Expand Down Expand Up @@ -692,6 +696,9 @@ static void _usbdev_init(usbdev_t *dev)

#elif defined(MCU_ESP32)

pm_block(ESP_PM_DEEP_SLEEP);
pm_block(ESP_PM_LIGHT_SLEEP);

usb_phy_handle_t phy_hdl; /* only needed temporarily */

usb_phy_config_t phy_conf = {
Expand Down
2 changes: 1 addition & 1 deletion sys/include/ztimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ unsigned ztimer_is_set(const ztimer_clock_t *clock, const ztimer_t *timer);
/**
* @brief Remove a timer from a clock
*
* This will place @p timer in the timer targets queue for @p clock.
* This will remove @p timer from the timer targets queue for @p clock.
*
* This function does nothing if @p timer is not found in the timer queue of
* @p clock.
Expand Down
37 changes: 23 additions & 14 deletions sys/net/gnrc/network_layer/ipv6/static_addr/gnrc_ipv6_static_addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static void _config_downstream(gnrc_netif_t *downstream)

DEBUG("gnrc_ipv6_static_addr: interface %u selected as downstream\n", downstream->pid);

if (CONFIG_GNRC_IPV6_STATIC_PREFIX == NULL) {
if (static_prefix == NULL) {
return;
}

Expand Down Expand Up @@ -113,25 +113,34 @@ static void _config_downstream(gnrc_netif_t *downstream)

void auto_init_gnrc_ipv6_static_addr(void)
{
gnrc_netif_t *netif = NULL;
gnrc_netif_t *upstream = NULL;
gnrc_netif_t *downstream = NULL;

if (IS_ACTIVE(CONFIG_GNRC_IPV6_STATIC_ADDR_UPSTREAM)) {
upstream = gnrc_netif_get_by_pid(CONFIG_GNRC_IPV6_STATIC_ADDR_UPSTREAM);
}
if (gnrc_netif_highlander() || gnrc_netif_numof() == 1) {
upstream = gnrc_netif_iter(NULL);

if (IS_ACTIVE(CONFIG_GNRC_IPV6_STATIC_ADDR_DOWNSTREAM)) {
downstream = gnrc_netif_get_by_pid(CONFIG_GNRC_IPV6_STATIC_ADDR_DOWNSTREAM);
}
if (IS_ACTIVE(CONFIG_GNRC_IPV6_STATIC_ADDR_UPSTREAM)) {
assert(upstream->pid == CONFIG_GNRC_IPV6_STATIC_ADDR_UPSTREAM);
}
} else {

if (IS_ACTIVE(CONFIG_GNRC_IPV6_STATIC_ADDR_UPSTREAM)) {
upstream = gnrc_netif_get_by_pid(CONFIG_GNRC_IPV6_STATIC_ADDR_UPSTREAM);
}

if (IS_ACTIVE(CONFIG_GNRC_IPV6_STATIC_ADDR_DOWNSTREAM)) {
downstream = gnrc_netif_get_by_pid(CONFIG_GNRC_IPV6_STATIC_ADDR_DOWNSTREAM);
}

while ((netif = gnrc_netif_iter(netif))) {
bool is_wired = gnrc_netapi_get(netif->pid, NETOPT_IS_WIRED, 0, NULL, 0) == 1;
gnrc_netif_t *netif = NULL;
while ((netif = gnrc_netif_iter(netif))) {
bool is_wired = gnrc_netapi_get(netif->pid, NETOPT_IS_WIRED, 0, NULL, 0) == 1;

if (!upstream && is_wired) {
upstream = netif;
} else if (!downstream && !is_wired) {
downstream = netif;
if (!upstream && is_wired) {
upstream = netif;
} else if (!downstream && !is_wired) {
downstream = netif;
}
}
}

Expand Down

0 comments on commit 1a787d4

Please sign in to comment.