Loading...
Searching...
No Matches
cyw43_config.h
1/*
2 * This file is part of the cyw43-driver
3 *
4 * Copyright (C) 2019-2022 George Robotics Pty Ltd
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 * 3. Any redistribution, use, or modification in source or binary form is done
15 * solely for personal benefit and not for any commercial purpose or for
16 * monetary gain.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE LICENSOR AND COPYRIGHT OWNER "AS IS" AND ANY
19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL THE LICENSOR OR COPYRIGHT OWNER BE LIABLE FOR
22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * This software is also available for use with certain devices under different
30 * terms, as set out in the top level LICENSE file. For commercial licensing
31 * options please email contact@georgerobotics.com.au.
32 */
33
38
39// Import port-specific configuration file.
40#ifdef CYW43_CONFIG_FILE
41#include CYW43_CONFIG_FILE
42#else
43#include <cyw43_configport.h>
44#endif
45
46// Bus configuration.
47
48#ifndef CYW43_USE_SPI
49#define CYW43_USE_SPI (0)
50#endif
51
52#ifndef CYW43_CLEAR_SDIO_INT
53#define CYW43_CLEAR_SDIO_INT (0)
54#endif
55
56#ifndef CYW43_INCLUDE_LEGACY_F1_OVERFLOW_WORKAROUND_VARIABLES
57#define CYW43_INCLUDE_LEGACY_F1_OVERFLOW_WORKAROUND_VARIABLES (0)
58#endif
59
60// The following pins can be defined, depending on the configuration:
61// - CYW43_PIN_RFSW_VDD - RF-switch power (active high)
62// - CYW43_PIN_RFSW_SELECT - RF-switch select
63// - CYW43_PIN_WL_REG_ON - WL power on (active high)
64// - CYW43_PIN_WL_HOST_WAKE - for SDIO or SPI transport
65// - CYW43_PIN_WL_IRQ - the gSPI IRQ line
66// - CYW43_PIN_WL_SDIO_1 - for SDIO transport
67// - CYW43_PIN_BT_REG_ON - BT power on (active high)
68// - CYW43_PIN_BT_HOST_WAKE - for BT HCI UART transport
69// - CYW43_PIN_BT_DEV_WAKE - for BT HCI UART transport
70// - CYW43_PIN_BT_CTS - for BT HCI UART transport, used to wait for CTS to go low
71
72// Legacy pin configuration CYW43_PIN_WL_RFSW_VDD is renamed to CYW43_PIN_RFSW_VDD.
73#ifdef CYW43_PIN_WL_RFSW_VDD
74#define CYW43_PIN_RFSW_VDD CYW43_PIN_WL_RFSW_VDD
75#endif
76
77// Firmware configuration.
78
79// Whether Bluetooth support is enabled.
80// This option uses the WiFi SPI/SDIO interface as the Bluetooth transport.
81#ifndef CYW43_ENABLE_BLUETOOTH
82#define CYW43_ENABLE_BLUETOOTH (0)
83#endif
84
85// Whether Bluetooth support is enabled.
86// This option uses a UART as the Bluetooth transport.
87#ifndef CYW43_ENABLE_BLUETOOTH_OVER_UART
88#define CYW43_ENABLE_BLUETOOTH_OVER_UART (0)
89#endif
90
91// This include should define:
92// - CYW43_WIFI_FW_LEN
93// - CYW43_CLM_LEN
94// - const uintptr_t fw_data
95#ifndef CYW43_CHIPSET_FIRMWARE_INCLUDE_FILE
96#if CYW43_ENABLE_BLUETOOTH
97#define CYW43_CHIPSET_FIRMWARE_INCLUDE_FILE "firmware/wb43439A0_7_95_49_00_combined.h"
98#else
99#define CYW43_CHIPSET_FIRMWARE_INCLUDE_FILE "firmware/w43439A0_7_95_49_00_combined.h"
100#endif
101#endif
102
103// This include should define a wifi_nvram_4343[] variable.
104#ifndef CYW43_WIFI_NVRAM_INCLUDE_FILE
105#define CYW43_WIFI_NVRAM_INCLUDE_FILE "firmware/wifi_nvram_43439.h"
106#endif
107
108// This should be defined by the port if needed, to override the default
109// alignment, or add more attributes, for the firmware and NVRAM resources.
110#ifndef CYW43_RESOURCE_ATTRIBUTE
111#define CYW43_RESOURCE_ATTRIBUTE __attribute__((aligned(4)))
112#endif
113
114// Whether the download of resources should be verified.
115#ifndef CYW43_RESOURCE_VERIFY_DOWNLOAD
116#define CYW43_RESOURCE_VERIFY_DOWNLOAD (0)
117#endif
118
119// Timing and timeout configuration.
120
121#ifndef CYW43_IOCTL_TIMEOUT_US
122#define CYW43_IOCTL_TIMEOUT_US (500000)
123#endif
124
125#ifndef CYW43_SLEEP_MAX
126#define CYW43_SLEEP_MAX (50)
127#endif
128
129// Called while waiting for an incoming character on the BT HCI UART.
130#ifndef CYW43_HAL_UART_READCHAR_BLOCKING_WAIT
131#define CYW43_HAL_UART_READCHAR_BLOCKING_WAIT cyw43_delay_us(10)
132#endif
133
134// Miscellaneous configuration.
135
136// No other options right now for TCP/IP stack.
137#ifndef CYW43_LWIP
138#define CYW43_LWIP (1)
139#endif
140
141#ifndef CYW43_NETUTILS
142#define CYW43_NETUTILS (0)
143#endif
144
145#ifndef CYW43_USE_OTP_MAC
146#define CYW43_USE_OTP_MAC (0)
147#endif
148
149#ifndef CYW43_GPIO
150#define CYW43_GPIO (0)
151#endif
152
153#ifndef CYW43_PRINTF
154#include <stdio.h>
155#define CYW43_PRINTF(...) printf(__VA_ARGS__)
156#endif
157
158#ifndef CYW43_VDEBUG
159#define CYW43_VDEBUG(...) (void)0
160#define CYW43_VERBOSE_DEBUG 0
161#endif
162
163#ifndef CYW43_DEBUG
164#ifdef NDEBUG
165#define CYW43_DEBUG(...) (void)0
166#else
167#define CYW43_DEBUG(...) CYW43_PRINTF(__VA_ARGS__)
168#endif
169#endif
170
171#ifndef CYW43_INFO
172#define CYW43_INFO(...) CYW43_PRINTF(__VA_ARGS__)
173#endif
174
175#ifndef CYW43_WARN
176#define CYW43_WARN(...) CYW43_PRINTF("[CYW43] " __VA_ARGS__)
177#endif
178
179#ifndef CYW43_FAIL_FAST_CHECK
180#define CYW43_FAIL_FAST_CHECK(res) (res)
181#endif
182
183// This should be defined by the port if needed, to let background processes
184// run during long blocking operations such as WiFi initialisation.
185#ifndef CYW43_EVENT_POLL_HOOK
186#define CYW43_EVENT_POLL_HOOK
187#endif
188
189#ifndef CYW43_DEFAULT_IP_STA_ADDRESS
190#define CYW43_DEFAULT_IP_STA_ADDRESS LWIP_MAKEU32(0, 0, 0, 0)
191#endif
192
193#ifndef CYW43_DEFAULT_IP_AP_ADDRESS
194#define CYW43_DEFAULT_IP_AP_ADDRESS LWIP_MAKEU32(192, 168, 4, 1)
195#endif
196
197#ifndef CYW43_DEFAULT_IP_MASK
198#define CYW43_DEFAULT_IP_MASK LWIP_MAKEU32(255, 255, 255, 0)
199#endif
200
201#ifndef CYW43_DEFAULT_IP_STA_GATEWAY
202#define CYW43_DEFAULT_IP_STA_GATEWAY LWIP_MAKEU32(192, 168, 0, 1)
203#endif
204
205#ifndef CYW43_DEFAULT_IP_AP_GATEWAY
206#define CYW43_DEFAULT_IP_AP_GATEWAY LWIP_MAKEU32(192, 168, 4, 1)
207#endif
208
209#ifndef CYW43_DEFAULT_IP_DNS
210#define CYW43_DEFAULT_IP_DNS LWIP_MAKEU32(8, 8, 8, 8)
211#endif
212
213// Hook for any additional TCP/IP initialization than needs to be done.
214// Called after the netif specified by `itf` has been set up.
215#ifndef CYW43_CB_TCPIP_INIT_EXTRA
216#define CYW43_CB_TCPIP_INIT_EXTRA(self, itf) do { } while (0)
217#endif
218
219// Hook for any additional TCP/IP deinitialization than needs to be done.
220// Called before the netif specified by `itf` is removed.
221#ifndef CYW43_CB_TCPIP_DEINIT_EXTRA
222#define CYW43_CB_TCPIP_DEINIT_EXTRA(self, itf) do { } while (0)
223#endif