Skip to content

Commit

Permalink
Rename CYW43_USE_PARTITION_FIRMWARE->CYW43_USE_FIRMWARE_PARTITION and…
Browse files Browse the repository at this point in the history
… CYW43_WIFI_FW_PARTITION_ID->CYW43_FIRMWARE_PARTITION_ID
  • Loading branch information
will-v-pi committed Nov 22, 2024
1 parent 1e7e0c7 commit f2511a9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/rp2_common/pico_cyw43_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ if (EXISTS ${PICO_CYW43_DRIVER_PATH}/${CYW43_DRIVER_TEST_FILE})
if (PICO_PLATFORM STREQUAL "rp2040")
message(FATAL_ERROR "RP2040 does not support storing wi-fi firmware in partitions")
endif()
target_compile_definitions(${TARGET} PRIVATE CYW43_USE_PARTITION_FIRMWARE=1)
target_compile_definitions(${TARGET} PRIVATE CYW43_USE_FIRMWARE_PARTITION=1)
pico_embed_pt_in_binary(${TARGET} ${PICO_CYW43_DRIVER_CURRENT_PATH}/wifi_pt.json)

find_package (Python3 REQUIRED COMPONENTS Interpreter)
Expand Down
11 changes: 3 additions & 8 deletions src/rp2_common/pico_cyw43_driver/cyw43_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,12 @@

static async_context_t *cyw43_async_context = NULL;

#if CYW43_USE_PARTITION_FIRMWARE
#if CYW43_USE_FIRMWARE_PARTITION
#include "pico/bootrom.h"
#include "hardware/flash.h"
#include "boot/picobin.h"
#include <stdlib.h>

// PICO_CONFIG: CYW43_WIFI_FW_PARTITION_ID, ID of Wi-Fi firmware partition, type=int, default=0x776966696669726d (wififirm), group=pico_cyw43_driver
#ifndef CYW43_WIFI_FW_PARTITION_ID
#define CYW43_WIFI_FW_PARTITION_ID 0x776966696669726d // wififirm
#endif

int32_t cyw43_wifi_fw_len;
int32_t cyw43_clm_len;
uintptr_t fw_data;
Expand Down Expand Up @@ -120,7 +115,7 @@ static void cyw43_sleep_timeout_reached(async_context_t *context, __unused async
}

bool cyw43_driver_init(async_context_t *context) {
#if CYW43_USE_PARTITION_FIRMWARE
#if CYW43_USE_FIRMWARE_PARTITION
uint32_t buffer[(16 * 4) + 1] = {}; // maximum of 16 partitions, each with maximum of 4 words returned, plus 1
int ret = rom_get_partition_table_info(buffer, count_of(buffer), PT_INFO_PARTITION_LOCATION_AND_FLAGS | PT_INFO_PARTITION_ID);

Expand All @@ -138,7 +133,7 @@ bool cyw43_driver_init(async_context_t *context) {
uint64_t id = 0;
id |= buffer[i++];
id |= ((uint64_t)(buffer[i++]) << 32ull);
if (id == CYW43_WIFI_FW_PARTITION_ID) {
if (id == CYW43_FIRMWARE_PARTITION_ID) {
picked_p = p;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ extern "C" {
#endif

#ifndef CYW43_CHIPSET_FIRMWARE_INCLUDE_FILE
#if CYW43_USE_PARTITION_FIRMWARE
#if CYW43_USE_FIRMWARE_PARTITION
#define CYW43_CHIPSET_FIRMWARE_INCLUDE_FILE "cyw43_partition_firmware.h"
#else
#if CYW43_ENABLE_BLUETOOTH
Expand Down
7 changes: 7 additions & 0 deletions src/rp2_common/pico_cyw43_driver/include/pico/cyw43_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
#include "cyw43_configport.h"
#endif

#if CYW43_USE_FIRMWARE_PARTITION
// PICO_CONFIG: CYW43_FIRMWARE_PARTITION_ID, ID of Wi-Fi firmware partition, type=int, default=0x776966696669726d (wififirm), group=pico_cyw43_driver
#ifndef CYW43_FIRMWARE_PARTITION_ID
#define CYW43_FIRMWARE_PARTITION_ID 0x776966696669726d // wififirm
#endif
#endif

#ifdef __cplusplus
extern "C" {
#endif
Expand Down

0 comments on commit f2511a9

Please sign in to comment.