WFI with interrupt-driven wakeup for USB and W6300
This commit is contained in:
@@ -71,11 +71,15 @@ void pio_init() {
|
||||
gpio_put(pin, false);
|
||||
}
|
||||
gpio_init(PIN_CS);
|
||||
// CHECK START
|
||||
gpio_set_dir(PIN_CS, GPIO_OUT);
|
||||
gpio_put(PIN_CS, true);
|
||||
gpio_init(PIN_INT);
|
||||
gpio_set_dir(PIN_INT, GPIO_IN);
|
||||
gpio_set_pulls(PIN_INT, false, false);
|
||||
gpio_pull_up(PIN_INT);
|
||||
gpio_set_irq_enabled_with_callback(PIN_INT, GPIO_IRQ_EDGE_FALL, true,
|
||||
[](uint, uint32_t){});
|
||||
// CHECK END
|
||||
|
||||
pio_hw_t *pios[2] = {pio0, pio1};
|
||||
uint pio_index = 1;
|
||||
@@ -822,11 +826,15 @@ inline uint16_t get_sn_rx_wr(uint8_t sn) { return ((uint16_t)reg_read(REG_SN_RX_
|
||||
static critical_section_t g_cris_sec;
|
||||
|
||||
void cris_enter() {
|
||||
critical_section_enter_blocking(&g_cris_sec);
|
||||
// CHECK START
|
||||
// critical_section_enter_blocking(&g_cris_sec);
|
||||
// CHECK END
|
||||
}
|
||||
|
||||
void cris_exit() {
|
||||
critical_section_exit(&g_cris_sec);
|
||||
// CHECK START
|
||||
// critical_section_exit(&g_cris_sec);
|
||||
// CHECK END
|
||||
}
|
||||
|
||||
static uint8_t make_opcode(uint32_t addr, uint8_t rw) {
|
||||
@@ -1647,6 +1655,11 @@ void init_net(const net_info& info) {
|
||||
set_net_info(info);
|
||||
}
|
||||
|
||||
void enable_interrupt_pin() {
|
||||
chip_unlock();
|
||||
set_sycr1(get_sycr1() | SYCR1_IEN);
|
||||
}
|
||||
|
||||
std::expected<void, sock_error> set_socket_io_mode(socket_id sid, sock_io_mode mode) {
|
||||
uint8_t sn = static_cast<uint8_t>(sid);
|
||||
if (sn >= sock_count) FAIL(sock_num);
|
||||
|
||||
@@ -195,6 +195,7 @@ int8_t init_buffers(std::span<const uint8_t> txsize, std::span<const uint8_t> rx
|
||||
void clear_interrupt(intr_kind intr);
|
||||
intr_kind get_interrupt();
|
||||
void set_interrupt_mask(intr_kind intr);
|
||||
void enable_interrupt_pin();
|
||||
intr_kind get_interrupt_mask();
|
||||
|
||||
int8_t get_phy_link();
|
||||
|
||||
Reference in New Issue
Block a user