5
5
6
6
#define DT_DRV_COMPAT nxp_dali
7
7
8
- #include <zephyr/drivers/dali.h> /* api */
8
+ #include <zephyr/drivers/dali.h> /* api */
9
9
#include <zephyr/drivers/dali/lpc11u6x.h> /* chip register definitions */
10
10
#include <zephyr/drivers/dali/std.h> /* constants from DALI standard */
11
11
@@ -104,7 +104,7 @@ struct dali_lpc11u6x_data {
104
104
struct k_work rx_work ;
105
105
enum rx_counter_event rx_event ;
106
106
struct k_msgq rx_queue ;
107
- char rx_buffer [CONFIG_MAX_FRAMES_IN_QUEUE * sizeof (struct dali_frame )];
107
+ char rx_buffer [CONFIG_DALI_MAX_FRAMES_IN_QUEUE * sizeof (struct dali_frame )];
108
108
uint32_t rx_data ;
109
109
uint32_t rx_timestamp ;
110
110
uint8_t rx_frame_length ;
@@ -1048,7 +1048,7 @@ static int init(const struct device *dev)
1048
1048
1049
1049
/* initialize receive queue */
1050
1050
k_msgq_init (& data -> rx_queue , data -> rx_buffer , sizeof (struct dali_frame ),
1051
- CONFIG_MAX_FRAMES_IN_QUEUE );
1051
+ CONFIG_DALI_MAX_FRAMES_IN_QUEUE );
1052
1052
1053
1053
/* initialize peripherals */
1054
1054
mcu_setup_peripheral_clock ();
@@ -1143,7 +1143,7 @@ static void dali_lpc11u6x_abort(const struct device *dev)
1143
1143
tx_slot_reset_all (data );
1144
1144
}
1145
1145
1146
- static const struct dali_driver_api dali_lpc11u6x_driver_api = {
1146
+ static DEVICE_API ( dali , dali_lpc11u6x_driver_api ) = {
1147
1147
.receive = dali_lpc11u6x_receive ,
1148
1148
.send = dali_lpc11u6x_send ,
1149
1149
.abort = dali_lpc11u6x_abort ,
@@ -1152,30 +1152,28 @@ static const struct dali_driver_api dali_lpc11u6x_driver_api = {
1152
1152
/* forward declaration of init */
1153
1153
static int init_dali_lpc11u6x (const struct device * dev );
1154
1154
1155
- /* clang-format off */
1156
- #define DALI_LPC11U6X_INST (id ) \
1157
- static struct dali_lpc11u6x_data dali_lpc11u6x_data_##id = {0}; \
1158
- static struct dali_lpc11u6x_config dali_lpc11u6x_config_##id = { \
1159
- .tx_rise_fall_delta_us = DT_INST_PROP_OR(id, tx_rise_fall_delta_us, 0), \
1160
- .rx_rise_fall_delta_us = DT_INST_PROP_OR(id, rx_rise_fall_delta_us, 0), \
1161
- .tx_rx_propagation_min_us = DT_INST_PROP_OR(id, tx_rx_propagation_min_us, 1), \
1162
- .tx_rx_propagation_max_us = DT_INST_PROP_OR(id, tx_rx_propagation_max_us, 100), \
1163
- }; \
1164
- DEVICE_DT_INST_DEFINE(id, init_dali_lpc11u6x, NULL, &dali_lpc11u6x_data_##id, \
1165
- &dali_lpc11u6x_config_##id, POST_KERNEL, \
1166
- CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &dali_lpc11u6x_driver_api); \
1167
- static int init_dali_lpc11u6x(const struct device *dev) \
1168
- { \
1169
- IRQ_CONNECT(DT_IRQ_BY_IDX(DT_DRV_INST(id), 0, irq), \
1170
- DT_IRQ_BY_IDX(DT_DRV_INST(id), 0, priority), tx_IRQHandler, \
1171
- DEVICE_DT_INST_GET(id), 0); \
1172
- irq_enable(DT_IRQ_BY_IDX(DT_DRV_INST(id), 0, irq)); \
1173
- IRQ_CONNECT(DT_IRQ_BY_IDX(DT_DRV_INST(id), 1, irq), \
1174
- DT_IRQ_BY_IDX(DT_DRV_INST(id), 1, priority), dali_rx_IRQHandler, \
1175
- DEVICE_DT_INST_GET(id), 0); \
1176
- irq_enable(DT_IRQ_BY_IDX(DT_DRV_INST(id), 1, irq)); \
1177
- return init(dev); \
1155
+ #define DALI_LPC11U6X_INST (id ) \
1156
+ static struct dali_lpc11u6x_data dali_lpc11u6x_data_##id = {0}; \
1157
+ static struct dali_lpc11u6x_config dali_lpc11u6x_config_##id = { \
1158
+ .tx_rise_fall_delta_us = DT_INST_PROP_OR(id, tx_rise_fall_delta_us, 0), \
1159
+ .rx_rise_fall_delta_us = DT_INST_PROP_OR(id, rx_rise_fall_delta_us, 0), \
1160
+ .tx_rx_propagation_min_us = DT_INST_PROP_OR(id, tx_rx_propagation_min_us, 1), \
1161
+ .tx_rx_propagation_max_us = DT_INST_PROP_OR(id, tx_rx_propagation_max_us, 100), \
1162
+ }; \
1163
+ DEVICE_DT_INST_DEFINE(id, init_dali_lpc11u6x, NULL, &dali_lpc11u6x_data_##id, \
1164
+ &dali_lpc11u6x_config_##id, POST_KERNEL, \
1165
+ CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &dali_lpc11u6x_driver_api); \
1166
+ static int init_dali_lpc11u6x(const struct device *dev) \
1167
+ { \
1168
+ IRQ_CONNECT(DT_IRQ_BY_IDX(DT_DRV_INST(id), 0, irq), \
1169
+ DT_IRQ_BY_IDX(DT_DRV_INST(id), 0, priority), tx_IRQHandler, \
1170
+ DEVICE_DT_INST_GET(id), 0); \
1171
+ irq_enable(DT_IRQ_BY_IDX(DT_DRV_INST(id), 0, irq)); \
1172
+ IRQ_CONNECT(DT_IRQ_BY_IDX(DT_DRV_INST(id), 1, irq), \
1173
+ DT_IRQ_BY_IDX(DT_DRV_INST(id), 1, priority), dali_rx_IRQHandler, \
1174
+ DEVICE_DT_INST_GET(id), 0); \
1175
+ irq_enable(DT_IRQ_BY_IDX(DT_DRV_INST(id), 1, irq)); \
1176
+ return init(dev); \
1178
1177
};
1179
- /* clang-format on */
1180
1178
1181
1179
DT_INST_FOREACH_STATUS_OKAY (DALI_LPC11U6X_INST );
0 commit comments