Lines Matching refs:idx

727 #define GECKO_UART_IRQ_HANDLER_DECL(idx)				       \  argument
728 static void uart_gecko_config_func_##idx(const struct device *dev)
729 #define GECKO_UART_IRQ_HANDLER_FUNC(idx) \ argument
730 .irq_config_func = uart_gecko_config_func_##idx,
731 #define GECKO_UART_IRQ_HANDLER(idx) \ argument
732 static void uart_gecko_config_func_##idx(const struct device *dev) \
734 IRQ_CONNECT(DT_INST_IRQ_BY_NAME(idx, rx, irq), \
735 DT_INST_IRQ_BY_NAME(idx, rx, priority), \
736 uart_gecko_isr, DEVICE_DT_INST_GET(idx), 0); \
737 IRQ_CONNECT(DT_INST_IRQ_BY_NAME(idx, tx, irq), \
738 DT_INST_IRQ_BY_NAME(idx, tx, priority), \
739 uart_gecko_isr, DEVICE_DT_INST_GET(idx), 0); \
741 irq_enable(DT_INST_IRQ_BY_NAME(idx, rx, irq)); \
742 irq_enable(DT_INST_IRQ_BY_NAME(idx, tx, irq)); \
745 #define GECKO_UART_IRQ_HANDLER_DECL(idx) argument
746 #define GECKO_UART_IRQ_HANDLER_FUNC(idx) argument
747 #define GECKO_UART_IRQ_HANDLER(idx) argument
751 #define GECKO_UART_RX_TX_PIN_LOCATIONS(idx) \ argument
752 .loc_rx = DT_INST_PROP_BY_IDX(idx, location_rx, 0), \
753 .loc_tx = DT_INST_PROP_BY_IDX(idx, location_tx, 0),
754 #define VALIDATE_GECKO_UART_RX_TX_PIN_LOCATIONS(idx) argument
756 #define GECKO_UART_RX_TX_PIN_LOCATIONS(idx) \ argument
757 .loc = DT_INST_PROP_BY_IDX(idx, location_rx, 0),
758 #define VALIDATE_GECKO_UART_RX_TX_PIN_LOCATIONS(idx) \ argument
759 BUILD_ASSERT(DT_INST_PROP_BY_IDX(idx, location_rx, 0) == \
760 DT_INST_PROP_BY_IDX(idx, location_tx, 0), \
764 #define PIN_UART_RXD(idx) \ argument
766 DT_INST_PROP_BY_IDX(idx, location_rx, 1), \
767 DT_INST_PROP_BY_IDX(idx, location_rx, 2), \
770 #define PIN_UART_TXD(idx) \ argument
772 DT_INST_PROP_BY_IDX(idx, location_tx, 1), \
773 DT_INST_PROP_BY_IDX(idx, location_tx, 2), \
777 #define GECKO_UART_RX_TX_PINS(idx) \ argument
778 .pin_rx = PIN_UART_RXD(idx), \
779 .pin_tx = PIN_UART_TXD(idx),
784 #define GECKO_UART_RTS_CTS_PIN_LOCATIONS(idx) \ argument
785 .loc_rts = COND_CODE_1(DT_INST_PROP(idx, hw_flow_control), \
786 (DT_INST_PROP_BY_IDX(idx, location_rts, 0)), \
788 .loc_cts = COND_CODE_1(DT_INST_PROP(idx, hw_flow_control), \
789 (DT_INST_PROP_BY_IDX(idx, location_cts, 0)), \
791 #define VALIDATE_GECKO_UART_RTS_CTS_PIN_LOCATIONS(idx) \ argument
792 COND_CODE_1(DT_INST_PROP(idx, hw_flow_control), \
793 (BUILD_ASSERT(DT_INST_NODE_HAS_PROP(idx, location_rts) && \
794 DT_INST_NODE_HAS_PROP(idx, location_cts), \
799 #define GECKO_UART_RTS_CTS_PIN_LOCATIONS(idx) argument
800 #define VALIDATE_GECKO_UART_RTS_CTS_PIN_LOCATIONS(idx) argument
803 #define PIN_UART_RTS(idx) \ argument
804 COND_CODE_1(DT_INST_PROP(idx, hw_flow_control), \
806 DT_INST_PROP_BY_IDX(idx, location_rts, 1), \
807 DT_INST_PROP_BY_IDX(idx, location_rts, 2), \
812 #define PIN_UART_CTS(idx) \ argument
813 COND_CODE_1(DT_INST_PROP(idx, hw_flow_control), \
815 DT_INST_PROP_BY_IDX(idx, location_cts, 1), \
816 DT_INST_PROP_BY_IDX(idx, location_cts, 2), \
821 #define GECKO_UART_RTS_CTS_PINS(idx) \ argument
822 .pin_rts = PIN_UART_RTS(idx), \
823 .pin_cts = PIN_UART_CTS(idx),
827 #define GECKO_UART_RTS_CTS_PIN_LOCATIONS(idx) argument
828 #define VALIDATE_GECKO_UART_RTS_CTS_PIN_LOCATIONS(idx) argument
829 #define GECKO_UART_RTS_CTS_PINS(idx) argument
833 #define GECKO_UART_INIT(idx) \ argument
834 VALIDATE_GECKO_UART_RX_TX_PIN_LOCATIONS(idx); \
835 VALIDATE_GECKO_UART_RTS_CTS_PIN_LOCATIONS(idx); \
837 GECKO_UART_IRQ_HANDLER_DECL(idx); \
838 PM_DEVICE_DT_INST_DEFINE(idx, uart_gecko_pm_action); \
840 static struct uart_config uart_cfg_##idx = { \
841 .baudrate = DT_INST_PROP(idx, current_speed), \
842 .parity = DT_INST_ENUM_IDX(idx, parity), \
843 .stop_bits = DT_INST_ENUM_IDX(idx, stop_bits), \
844 .data_bits = DT_INST_ENUM_IDX(idx, data_bits), \
845 .flow_ctrl = DT_INST_PROP(idx, hw_flow_control) \
850 static const struct uart_gecko_config uart_gecko_cfg_##idx = { \
851 .base = (USART_TypeDef *)DT_INST_REG_ADDR(idx), \
852 GET_GECKO_UART_CLOCK(idx) \
853 GECKO_UART_RX_TX_PINS(idx) \
854 GECKO_UART_RTS_CTS_PINS(idx) \
855 GECKO_UART_RX_TX_PIN_LOCATIONS(idx) \
856 GECKO_UART_RTS_CTS_PIN_LOCATIONS(idx) \
857 GECKO_UART_IRQ_HANDLER_FUNC(idx) \
861 static struct uart_gecko_data uart_gecko_data_##idx = { \
862 .uart_cfg = &uart_cfg_##idx, \
865 DEVICE_DT_INST_DEFINE(idx, uart_gecko_init, PM_DEVICE_DT_INST_GET(idx), \
866 &uart_gecko_data_##idx, &uart_gecko_cfg_##idx, \
870 GECKO_UART_IRQ_HANDLER(idx)
878 #define GECKO_USART_IRQ_HANDLER_DECL(idx) \ argument
879 static void usart_gecko_config_func_##idx(const struct device *dev)
880 #define GECKO_USART_IRQ_HANDLER_FUNC(idx) \ argument
881 .irq_config_func = usart_gecko_config_func_##idx,
882 #define GECKO_USART_IRQ_HANDLER(idx) \ argument
883 static void usart_gecko_config_func_##idx(const struct device *dev) \
885 IRQ_CONNECT(DT_INST_IRQ_BY_NAME(idx, rx, irq), \
886 DT_INST_IRQ_BY_NAME(idx, rx, priority), \
887 uart_gecko_isr, DEVICE_DT_INST_GET(idx), 0); \
888 IRQ_CONNECT(DT_INST_IRQ_BY_NAME(idx, tx, irq), \
889 DT_INST_IRQ_BY_NAME(idx, tx, priority), \
890 uart_gecko_isr, DEVICE_DT_INST_GET(idx), 0); \
892 irq_enable(DT_INST_IRQ_BY_NAME(idx, rx, irq)); \
893 irq_enable(DT_INST_IRQ_BY_NAME(idx, tx, irq)); \
896 #define GECKO_USART_IRQ_HANDLER_DECL(idx)
897 #define GECKO_USART_IRQ_HANDLER_FUNC(idx)
898 #define GECKO_USART_IRQ_HANDLER(idx)
902 #define GECKO_USART_INIT(idx) \ argument
903 PINCTRL_DT_INST_DEFINE(idx); \
904 GECKO_USART_IRQ_HANDLER_DECL(idx); \
905 PM_DEVICE_DT_INST_DEFINE(idx, uart_gecko_pm_action); \
907 static struct uart_config uart_cfg_##idx = { \
908 .baudrate = DT_INST_PROP(idx, current_speed), \
909 .parity = DT_INST_ENUM_IDX(idx, parity), \
910 .stop_bits = DT_INST_ENUM_IDX(idx, stop_bits), \
911 .data_bits = DT_INST_ENUM_IDX(idx, data_bits), \
912 .flow_ctrl = DT_INST_PROP(idx, hw_flow_control) \
917 static const struct uart_gecko_config usart_gecko_cfg_##idx = { \
918 .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(idx), \
919 .base = (USART_TypeDef *)DT_INST_REG_ADDR(idx), \
920 GET_GECKO_USART_CLOCK(idx) \
921 GECKO_USART_IRQ_HANDLER_FUNC(idx) \
924 static struct uart_gecko_data usart_gecko_data_##idx = { \
925 .uart_cfg = &uart_cfg_##idx, \
928 DEVICE_DT_INST_DEFINE(idx, uart_gecko_init, PM_DEVICE_DT_INST_GET(idx), \
929 &usart_gecko_data_##idx, \
930 &usart_gecko_cfg_##idx, PRE_KERNEL_1, \
934 GECKO_USART_IRQ_HANDLER(idx)
936 #define GECKO_USART_INIT(idx) \
937 VALIDATE_GECKO_UART_RX_TX_PIN_LOCATIONS(idx); \
938 VALIDATE_GECKO_UART_RTS_CTS_PIN_LOCATIONS(idx); \
940 GECKO_USART_IRQ_HANDLER_DECL(idx); \
941 PM_DEVICE_DT_INST_DEFINE(idx, uart_gecko_pm_action); \
943 static struct uart_config uart_cfg_##idx = { \
944 .baudrate = DT_INST_PROP(idx, current_speed), \
945 .parity = DT_INST_ENUM_IDX(idx, parity), \
946 .stop_bits = DT_INST_ENUM_IDX(idx, stop_bits), \
947 .data_bits = DT_INST_ENUM_IDX(idx, data_bits), \
948 .flow_ctrl = DT_INST_PROP(idx, hw_flow_control) \
953 static const struct uart_gecko_config usart_gecko_cfg_##idx = { \
954 .base = (USART_TypeDef *)DT_INST_REG_ADDR(idx), \
955 GET_GECKO_USART_CLOCK(idx) \
956 GECKO_UART_RX_TX_PINS(idx) \
957 GECKO_UART_RTS_CTS_PINS(idx) \
958 GECKO_UART_RX_TX_PIN_LOCATIONS(idx) \
959 GECKO_UART_RTS_CTS_PIN_LOCATIONS(idx) \
960 GECKO_USART_IRQ_HANDLER_FUNC(idx) \
963 static struct uart_gecko_data usart_gecko_data_##idx = { \
964 .uart_cfg = &uart_cfg_##idx, \
967 DEVICE_DT_INST_DEFINE(idx, uart_gecko_init, PM_DEVICE_DT_INST_GET(idx), \
968 &usart_gecko_data_##idx, \
969 &usart_gecko_cfg_##idx, PRE_KERNEL_1, \
973 GECKO_USART_IRQ_HANDLER(idx)