drivers: serial: ns16550: Remove hard-coded max instance count
Instead of having a hard-coded maximum instance count, introduce a Kconfig variable for it. The inclusion of the per-instance header files is solved by having them chain-include each other with a pre-processor condition that checks if the current header file is the last one or not. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
048dcea54b
commit
4fa0a9b4b2
4 changed files with 19 additions and 4 deletions
|
@ -42,7 +42,9 @@ zephyr_library_sources_ifdef(CONFIG_USERSPACE uart_handlers.c)
|
|||
|
||||
if(CONFIG_UART_NS16550)
|
||||
zephyr_library_sources(uart_ns16550.c)
|
||||
foreach(NUM RANGE 0 3)
|
||||
math(EXPR max_index "${CONFIG_UART_NS16550_MAX_INSTANCES} - 1")
|
||||
foreach(NUM RANGE 0 ${max_index})
|
||||
math(EXPR NEXT_NUM "${NUM} + 1")
|
||||
configure_file(
|
||||
uart_ns16550_port_x.h
|
||||
${PROJECT_BINARY_DIR}/include/generated/uart_ns16550_port_${NUM}.h
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue