Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More CYW43 config tweaks #2033

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/rp2_common/pico_cyw43_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,32 @@ if (EXISTS ${PICO_CYW43_DRIVER_PATH}/${CYW43_DRIVER_TEST_FILE})
hardware_exception
)

if (CYW43_PIN_WL_DYNAMIC)
peterharperuk marked this conversation as resolved.
Show resolved Hide resolved
# PICO_CMAKE_CONFIG: CYW43_PIN_WL_DYNAMIC, flag to indicate if cyw43 SPI pins can be changed at runtime, type=bool, group=pico_cyw43_driver
target_compile_definitions(cyw43_driver_picow INTERFACE CYW43_PIN_WL_DYNAMIC=${CYW43_PIN_WL_DYNAMIC})
endif()
if (CYW43_DEFAULT_PIN_WL_REG_ON)
# PICO_CMAKE_CONFIG: CYW43_DEFAULT_PIN_WL_REG_ON, gpio pin to power up the cyw43 chip, type=int, default=23, group=pico_cyw43_driver
# PICO_CMAKE_CONFIG: CYW43_DEFAULT_PIN_WL_REG_ON, gpio pin to power up the cyw43 chip, type=int, group=pico_cyw43_driver
target_compile_definitions(cyw43_driver_picow INTERFACE CYW43_DEFAULT_PIN_WL_REG_ON=${CYW43_DEFAULT_PIN_WL_REG_ON})
endif()
if (CYW43_DEFAULT_PIN_WL_DATA_OUT)
# PICO_CMAKE_CONFIG: CYW43_DEFAULT_PIN_WL_DATA_OUT, gpio pin for spi data out to the cyw43 chip, type=int, default=24, group=pico_cyw43_driver
# PICO_CMAKE_CONFIG: CYW43_DEFAULT_PIN_WL_DATA_OUT, gpio pin for spi data out to the cyw43 chip, type=int, group=pico_cyw43_driver
target_compile_definitions(cyw43_driver_picow INTERFACE CYW43_DEFAULT_PIN_WL_DATA_OUT=${CYW43_DEFAULT_PIN_WL_DATA_OUT})
endif()
if (CYW43_DEFAULT_PIN_WL_DATA_IN)
# PICO_CMAKE_CONFIG: CYW43_DEFAULT_PIN_WL_DATA_IN, gpio pin for spi data in from the cyw43 chip, type=int, default=24, group=pico_cyw43_driver
# PICO_CMAKE_CONFIG: CYW43_DEFAULT_PIN_WL_DATA_IN, gpio pin for spi data in from the cyw43 chip, type=int, group=pico_cyw43_driver
target_compile_definitions(cyw43_driver_picow INTERFACE CYW43_DEFAULT_PIN_WL_DATA_IN=${CYW43_DEFAULT_PIN_WL_DATA_IN})
endif()
if (CYW43_DEFAULT_PIN_WL_HOST_WAKE)
# PICO_CMAKE_CONFIG: CYW43_DEFAULT_PIN_WL_HOST_WAKE, gpio (irq) pin for the irq line from the cyw43 chip, type=int, default=24, group=pico_cyw43_driver
# PICO_CMAKE_CONFIG: CYW43_DEFAULT_PIN_WL_HOST_WAKE, gpio (irq) pin for the irq line from the cyw43 chip, type=int, group=pico_cyw43_driver
target_compile_definitions(cyw43_driver_picow INTERFACE CYW43_DEFAULT_PIN_WL_HOST_WAKE=${CYW43_DEFAULT_PIN_WL_HOST_WAKE})
endif()
if (CYW43_DEFAULT_PIN_WL_CLOCK)
# PICO_CMAKE_CONFIG: CYW43_DEFAULT_PIN_WL_HOST_WAKE, gpio pin for the spi clock line to the cyw43 chip, type=int, default=29, group=pico_cyw43_driver
# PICO_CMAKE_CONFIG: CYW43_DEFAULT_PIN_WL_CLOCK, gpio pin for the spi clock line to the cyw43 chip, type=int, group=pico_cyw43_driver
target_compile_definitions(cyw43_driver_picow INTERFACE CYW43_DEFAULT_PIN_WL_CLOCK=${CYW43_DEFAULT_PIN_WL_CLOCK})
endif()
if (CYW43_DEFAULT_PIN_WL_CS)
# PICO_CMAKE_CONFIG: CYW43_DEFAULT_PIN_WL_CS, gpio pin for the spi chip select to the cyw43 chip, type=int, default=25, group=pico_cyw43_driver
# PICO_CMAKE_CONFIG: CYW43_DEFAULT_PIN_WL_CS, gpio pin for the spi chip select to the cyw43 chip, type=int, group=pico_cyw43_driver
target_compile_definitions(cyw43_driver_picow INTERFACE CYW43_DEFAULT_PIN_WL_CS=${CYW43_DEFAULT_PIN_WL_CS})
endif()
if (CYW43_PIO_CLOCK_DIV_INT)
Expand All @@ -89,7 +93,7 @@ if (EXISTS ${PICO_CYW43_DRIVER_PATH}/${CYW43_DRIVER_TEST_FILE})
target_compile_definitions(cyw43_driver_picow INTERFACE CYW43_PIO_CLOCK_DIV_FRAC8=${CYW43_PIO_CLOCK_DIV_FRAC8})
endif()
if (CYW43_PIO_CLOCK_DIV_DYNAMIC)
# PICO_CMAKE_CONFIG: CYW43_PIO_CLOCK_DIV_DYNAMIC, flag used to enable dynamic pio clock divider API, type=bool, default=false, group=pico_cyw43_driver
# PICO_CMAKE_CONFIG: CYW43_PIO_CLOCK_DIV_DYNAMIC, flag used to enable dynamic pio clock divider API, type=bool, default=0, group=pico_cyw43_driver
target_compile_definitions(cyw43_driver_picow INTERFACE CYW43_PIO_CLOCK_DIV_DYNAMIC=${CYW43_PIO_CLOCK_DIV_DYNAMIC})
endif()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void cyw43_driver_deinit(struct async_context *context);

// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_CLOCK, gpio pin for the spi clock line to the cyw43 chip, type=int, advanced=true, group=pico_cyw43_driver

// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_CS, gpio pin for the spi chip select to the cyw43 chip, type=int, dvanced=true, group=pico_cyw43_driver
// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_CS, gpio pin for the spi chip select to the cyw43 chip, type=int, advanced=true, group=pico_cyw43_driver

#if CYW43_PIO_CLOCK_DIV_DYNAMIC
/*! \brief Set the clock divisor for the cyw43 pio clock
Expand Down
10 changes: 8 additions & 2 deletions tools/extract_build_defines.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

BUILD_DEFINE_RE = re.compile(r'#\s+{}:\s+(\w+),\s+([^,]+)(?:,\s+(.*))?$'.format(BASE_BUILD_DEFINE_NAME))

ALLOWED_CONFIG_PROPERTIES = set(['type', 'default', 'min', 'max', 'group'])

CHIP_NAMES = ["rp2040", "rp2350"]

chips_all_configs = defaultdict(dict)
Expand All @@ -47,10 +49,14 @@



def ValidateAttrs(config_attrs, file_path, linenum):
def ValidateAttrs(config_name, config_attrs, file_path, linenum):
_type = config_attrs.get('type')

# Validate attrs
for key in config_attrs.keys():
if key not in ALLOWED_CONFIG_PROPERTIES:
raise Exception('{} at {}:{} has unexpected property "{}"'.format(config_name, file_path, linenum, key))

if _type == 'int':
_min = _max = _default = None
if config_attrs.get('min', None) is not None:
Expand Down Expand Up @@ -184,7 +190,7 @@ def ValidateAttrs(config_attrs, file_path, linenum):
file_path = os.path.join(scandir, config_obj['filename'])
linenum = config_obj['line_number']

ValidateAttrs(config_obj['attrs'], file_path, linenum)
ValidateAttrs(config_name, config_obj['attrs'], file_path, linenum)

# All settings in "host" should also be in "all"
for config_name, config_obj in chips_all_configs["host"].items():
Expand Down
12 changes: 9 additions & 3 deletions tools/extract_cmake_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

CMAKE_CONFIG_RE = re.compile(r'#\s+{}:\s+(\w+),\s+([^,]+)(?:,\s+(.*))?$'.format(BASE_CMAKE_CONFIG_NAME))

ALLOWED_CONFIG_PROPERTIES = set(['type', 'default', 'min', 'max', 'group', 'advanced', 'docref'])

CHIP_NAMES = ["rp2040", "rp2350"]

chips_all_configs = defaultdict(dict)
Expand All @@ -47,10 +49,14 @@



def ValidateAttrs(config_attrs, file_path, linenum):
def ValidateAttrs(config_name, config_attrs, file_path, linenum):
_type = config_attrs.get('type')

# Validate attrs
for key in config_attrs.keys():
if key not in ALLOWED_CONFIG_PROPERTIES:
raise Exception('{} at {}:{} has unexpected property "{}"'.format(config_name, file_path, linenum, key))

if _type == 'int':
_min = _max = _default = None
if config_attrs.get('min', None) is not None:
Expand Down Expand Up @@ -93,7 +99,7 @@ def ValidateAttrs(config_attrs, file_path, linenum):
_default = config_attrs.get('default', None)
if _default is not None:
if '/' not in _default:
if (_default.lower() != '0') and (config_attrs['default'].lower() != '1') and ( _default not in all_configs):
if (_default.lower() != '0') and (config_attrs['default'].lower() != '1') and (_default not in all_configs):
logger.info('{} at {}:{} has non-integer default value "{}"'.format(config_name, file_path, linenum, config_attrs['default']))

elif _type == 'string':
Expand Down Expand Up @@ -184,7 +190,7 @@ def ValidateAttrs(config_attrs, file_path, linenum):
file_path = os.path.join(scandir, config_obj['filename'])
linenum = config_obj['line_number']

ValidateAttrs(config_obj['attrs'], file_path, linenum)
ValidateAttrs(config_name, config_obj['attrs'], file_path, linenum)

# All settings in "host" should also be in "all"
for config_name, config_obj in chips_all_configs["host"].items():
Expand Down
10 changes: 8 additions & 2 deletions tools/extract_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
CONFIG_RE = re.compile(r'//\s+{}:\s+(\w+),\s+([^,]+)(?:,\s+(.*))?$'.format(BASE_CONFIG_NAME))
DEFINE_RE = re.compile(r'#define\s+(\w+)\s+(.+?)(\s*///.*)?$')

ALLOWED_CONFIG_PROPERTIES = set(['type', 'default', 'min', 'max', 'enumvalues', 'group', 'advanced', 'depends'])

CHIP_NAMES = ["rp2040", "rp2350"]

chips_all_configs = defaultdict(dict)
Expand All @@ -49,10 +51,14 @@



def ValidateAttrs(config_attrs, file_path, linenum):
def ValidateAttrs(config_name, config_attrs, file_path, linenum):
_type = config_attrs.get('type', 'int')

# Validate attrs
for key in config_attrs.keys():
if key not in ALLOWED_CONFIG_PROPERTIES:
raise Exception('{} at {}:{} has unexpected property "{}"'.format(config_name, file_path, linenum, key))

if _type == 'int':
assert 'enumvalues' not in config_attrs
_min = _max = _default = None
Expand Down Expand Up @@ -229,7 +235,7 @@ def ValidateAttrs(config_attrs, file_path, linenum):
file_path = os.path.join(scandir, config_obj['filename'])
linenum = config_obj['line_number']

ValidateAttrs(config_obj['attrs'], file_path, linenum)
ValidateAttrs(config_name, config_obj['attrs'], file_path, linenum)

# Check that default values match up
if 'default' in config_obj['attrs']:
Expand Down
Loading