Re: Code cleanup for dts.fixup #defines


Andy Gross
 


On 23 August 2018 at 14:12, Diego Sueiro <diego.sueiro@...> wrote:
Andy,

This is an excellent idea.  The only downside (upside?) is having to standardize on all of the subsystem driver labels.  And it still doesn't solve the device specific properties unless we were to extend this idea to automatically generate generic labels for all device specific properties by adding a #define to point the generic label + property to the device compatible + address value.  Then you'd have to build up the platform data structures to contain this stuff.

Actually, the dts extraction already deals with the driver properties listed in the yaml file.

For example, the nxp,imx-uart.yaml, has the following #defines automatically generated for the uart-2 alias:
<build>/zephyr/include/generated/generated_dts_board.h:
#define CONFIG_UART_CONSOLE_ON_DEV_NAME         "UART_2"
#define NXP_IMX_UART_30890000_BASE_ADDRESS      0x30890000
#define NXP_IMX_UART_30890000_CURRENT_SPEED     115200
#define NXP_IMX_UART_30890000_IRQ_0             27
#define NXP_IMX_UART_30890000_IRQ_0_PRIORITY    3
#define NXP_IMX_UART_30890000_LABEL             "UART_2"
#define NXP_IMX_UART_30890000_MODEM_MODE        64
#define NXP_IMX_UART_30890000_RDC               15
#define NXP_IMX_UART_30890000_SIZE              65536
#define UART_2_BASE_ADDRESS                     NXP_IMX_UART_30890000_BASE_ADDRESS
#define UART_2_CURRENT_SPEED                    NXP_IMX_UART_30890000_CURRENT_SPEED
#define UART_2_IRQ                              NXP_IMX_UART_30890000_IRQ_0
#define UART_2_IRQ_PRIORITY                     NXP_IMX_UART_30890000_IRQ_0_PRIORITY
#define UART_2_LABEL                            NXP_IMX_UART_30890000_LABEL
#define UART_2_MODEM_MODE                       NXP_IMX_UART_30890000_MODEM_MODE
#define UART_2_RDC                              NXP_IMX_UART_30890000_RDC
#define UART_2_SIZE                             NXP_IMX_UART_30890000_SIZE

Note that RDC and MODEM_MODE are custom properties for the imx uart driver.

Ah, right.  Yeah this looks quite nice then.

Join devel@lists.zephyrproject.org to automatically receive all group messages.