Workqueue usage


Yunqing Kou <yunqing.kou@...>
 

Hi ,

        I have a question for work queue usage, below is my sample code, I don’t know where the problem is, anyone can help me? thanks.

 

typedef struct

{

    struct k_work work;

struct k_work_q work_q;

int  data;

} pon_wq_t;

 

pon_wq_t    pon_ploam_wq;

#define MY_STACK_SIZE 512

#define MY_PRIORITY -2

K_THREAD_STACK_DEFINE(my_stack_area, MY_STACK_SIZE);

 

plm_wq_init(){

    k_work_queue_init(&pon_ploam_wq.work_q);

    k_work_init(&(pon_ploam_wq.work), aal_ploam_wq_proc);

    k_thread_name_set(&pon_ploam_wq.work_q.thread, "ploam_workq");

    k_work_queue_start(&pon_ploam_wq.work_q, my_stack_area, K_THREAD_STACK_SIZEOF(my_stack_area), MY_PRIORITY, NULL);

}

 

plm_isr(ca_uint32_t plm_int){

  pon_ploam_wq.data = plm_int;

ret = k_work_submit(&pon_ploam_wq.work);

//ret = k_work_submit_to_queue(&pon_ploam_wq.work_q, &pon_ploam_wq.work);

 

}

 

void aal_plm_wq_proc(struct k_work *q_work)

{

    aal_xgpon_ploam_kmsg_t   *msg;

    ca_status_t              ret =  CA_E_OK;

    pon_wq_t         *wq = CONTAINER_OF(q_work, pon_wq_t, work);

 

    ca_printf("%s: data %d \r\n",__func__, wq->data);

}

 

Issues:

 

1.      If use k_work_submit, only two or three interrupts can be put into system work queue and aal_plm_wq_proc can be called. But the interrupts are generated continuously.

2.      If use k_work_submit_to_queue, interrupts can be put into the defined work queue continuously, but aal_plm_wq_proc is never called.

 

my zephyr version:

Zephyr version: 2.7.0

 

Best Regards,

Corey

 

发件人: Yunqing Kou
发送时间: 2022616 10:59
收件人: devel@...
主题: 回复: [Zephyr-devel] Welcome to devel@...

 

Hi,

        Glad to join this group. Thanks.

 

Best Regards,

Corey

 

发件人: Group Notification <devel+owner@...>
发送时间: 2022616 10:53
收件人: Yunqing Kou <yunqing.kou@...>
主题: [Zephyr-devel] Welcome to devel@...

 

Hello,

Welcome to the devel@... group at Zephyr Project. Please take a moment to review this message.

To learn more about the devel@... group, please visit https://lists.zephyrproject.org/g/devel

To start sending messages to members of this group, simply send email to devel@...

If you do not wish to belong to devel@..., you may unsubscribe by sending an email to devel+unsubscribe@...

To see and modify all of your groups, go to https://lists.zephyrproject.org

 

Regards,

The Zephyr-devel@... Moderator

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