usrsock: used wd timer to process loop event

used wdt thread process event

Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
This commit is contained in:
yezhonghui 2025-04-14 13:59:23 +08:00 committed by Xiang Xiao
parent c594616e99
commit bbcf8fe30b
2 changed files with 10 additions and 4 deletions

View file

@ -224,10 +224,6 @@ static int sim_loop_task(int argc, char **argv)
sched_lock();
#ifdef CONFIG_SIM_NETUSRSOCK
host_usrsock_loop();
#endif
#ifdef CONFIG_SIM_SOUND
sim_audio_loop();
#endif

View file

@ -40,6 +40,7 @@
****************************************************************************/
#define SIM_USRSOCK_BUFSIZE (400 * 1024)
#define SIM_USRSOCK_PERIOD MSEC2TICK(CONFIG_SIM_LOOP_INTERVAL)
/****************************************************************************
* Private Types
@ -49,6 +50,7 @@ struct usrsock_s
{
uint8_t in[SIM_USRSOCK_BUFSIZE];
uint8_t out[SIM_USRSOCK_BUFSIZE];
struct work_s work;
};
/****************************************************************************
@ -391,6 +393,12 @@ static const usrsock_handler_t g_usrsock_handler[] =
[USRSOCK_REQUEST_SHUTDOWN] = usrsock_shutdown_handler,
};
static void sim_usrsock_work(void *arg)
{
work_queue(HPWORK, &g_usrsock.work, (void *)sim_usrsock_work,
NULL, SIM_USRSOCK_PERIOD);
}
/****************************************************************************
* Public Functions
****************************************************************************/
@ -402,6 +410,8 @@ int usrsock_event_callback(int16_t usockid, uint16_t events)
void usrsock_register(void)
{
work_queue(HPWORK, &g_usrsock.work, (void *)sim_usrsock_work,
NULL, SIM_USRSOCK_PERIOD);
}
/****************************************************************************