|
20 | 20 | #define SEND_BUFFER_UNUSED 0
|
21 | 21 | #define SEND_BUFFER_RESERVED 1
|
22 | 22 |
|
| 23 | +static struct k_work_q icmsg_work_queue; |
| 24 | +K_THREAD_STACK_DEFINE(icmsg_work_queue_stack, CONFIG_IPC_SERVICE_ICMSG_WORK_QUEUE_STACK_SIZE); |
| 25 | + |
23 | 26 | static const uint8_t magic[] = {0x45, 0x6d, 0x31, 0x6c, 0x31, 0x4b,
|
24 | 27 | 0x30, 0x72, 0x6e, 0x33, 0x6c, 0x69, 0x34};
|
25 | 28 | BUILD_ASSERT(sizeof(magic) <= RX_BUF_SIZE);
|
@@ -59,7 +62,7 @@ static void notify_process(struct k_work *item)
|
59 | 62 | if (state != ICMSG_STATE_READY) {
|
60 | 63 | int ret;
|
61 | 64 |
|
62 |
| - ret = k_work_reschedule(dwork, BOND_NOTIFY_REPEAT_TO); |
| 65 | + ret = k_work_reschedule_for_queue(&icmsg_work_queue, dwork, BOND_NOTIFY_REPEAT_TO); |
63 | 66 | __ASSERT_NO_MSG(ret >= 0);
|
64 | 67 | (void)ret;
|
65 | 68 | }
|
@@ -127,7 +130,7 @@ static bool is_rx_data_available(struct icmsg_data_t *dev_data)
|
127 | 130 |
|
128 | 131 | static void submit_mbox_work(struct icmsg_data_t *dev_data)
|
129 | 132 | {
|
130 |
| - if (k_work_submit(&dev_data->mbox_work) < 0) { |
| 133 | + if (k_work_submit_to_queue(&icmsg_work_queue, &dev_data->mbox_work) < 0) { |
131 | 134 | /* The mbox processing work is never canceled.
|
132 | 135 | * The negative error code should never be seen.
|
133 | 136 | */
|
@@ -211,6 +214,10 @@ static int mbox_init(const struct icmsg_config_t *conf,
|
211 | 214 | {
|
212 | 215 | int err;
|
213 | 216 |
|
| 217 | + k_work_queue_start(&icmsg_work_queue, icmsg_work_queue_stack, |
| 218 | + K_THREAD_STACK_SIZEOF(icmsg_work_queue_stack), |
| 219 | + CONFIG_SYSTEM_WORKQUEUE_PRIORITY, NULL); |
| 220 | + |
214 | 221 | k_work_init(&dev_data->mbox_work, mbox_callback_process);
|
215 | 222 | k_work_init_delayable(&dev_data->notify_work, notify_process);
|
216 | 223 |
|
@@ -263,7 +270,7 @@ int icmsg_open(const struct icmsg_config_t *conf,
|
263 | 270 | return ret;
|
264 | 271 | }
|
265 | 272 |
|
266 |
| - ret = k_work_schedule(&dev_data->notify_work, K_NO_WAIT); |
| 273 | + ret = k_work_schedule_for_queue(&icmsg_work_queue, &dev_data->notify_work, K_NO_WAIT); |
267 | 274 | if (ret < 0) {
|
268 | 275 | return ret;
|
269 | 276 | }
|
|
0 commit comments