1 /*
2  * Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company) or
3  * an affiliate of Cypress Semiconductor Corporation
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #include <whd.h>
9 #include <zephyr/device.h>
10 
11 /** Defines the amount of stack memory available for the wifi thread. */
12 #if !defined(CY_WIFI_THREAD_STACK_SIZE)
13 #define CY_WIFI_THREAD_STACK_SIZE (5120)
14 #endif
15 
16 /** Defines the priority of the thread that services wifi packets. Legal values are defined by the
17  *  RTOS being used.
18  */
19 #if !defined(CY_WIFI_THREAD_PRIORITY)
20 #define CY_WIFI_THREAD_PRIORITY (CY_RTOS_PRIORITY_HIGH)
21 #endif
22 
23 /** Defines the country this will operate in for wifi initialization parameters. See the
24  *  wifi-host-driver's whd_country_code_t for legal options.
25  */
26 #if !defined(CY_WIFI_COUNTRY)
27 #define CY_WIFI_COUNTRY (WHD_COUNTRY_AUSTRALIA)
28 #endif
29 
30 /** Defines the priority of the interrupt that handles out-of-band notifications from the wifi
31  *  chip. Legal values are defined by the MCU running this code.
32  */
33 #if !defined(CY_WIFI_OOB_INTR_PRIORITY)
34 #define CY_WIFI_OOB_INTR_PRIORITY (2)
35 #endif
36 
37 /** Defines whether to use the out-of-band pin to allow the WIFI chip to wake up the MCU. */
38 #if defined(CY_WIFI_HOST_WAKE_SW_FORCE)
39 #define CY_USE_OOB_INTR (CY_WIFI_HOST_WAKE_SW_FORCE)
40 #else
41 #define CY_USE_OOB_INTR (1u)
42 #endif /* defined(CY_WIFI_HOST_WAKE_SW_FORCE) */
43 
44 #define CY_WIFI_HOST_WAKE_IRQ_EVENT GPIO_INT_TRIG_LOW
45 #define DEFAULT_OOB_PIN             (0)
46 #define WLAN_POWER_UP_DELAY_MS      (250)
47 #define WLAN_CBUCK_DISCHARGE_MS     (10)
48 
49 extern whd_resource_source_t resource_ops;
50 
51 int airoc_wifi_power_on(const struct device *dev);
52