#include "errcode.h"
#include "common_def.h"
#include "wearable_log.h"
-
+#include "thread_init.h"
struct netif sl_netif;
#define UART_SLIP_CMD_MSG_READ_DATA 0x01
#define SLIP_CMD_TASK_MSG_COUNT 512
#define SLIP_CMD_TASK_SIZE (0x800*2)
#define SLIP_CMD_TASK_PRIO 4
-
-int slip_uart_init(void)
+void create_slip_uart_queue(void)
{
- #if 1
if (osal_msg_queue_create("uart_slip_cmd_queue", SLIP_CMD_TASK_MSG_COUNT, &g_slip_cmd_queue,
0, sizeof(slip_uart_cmd_t)) != ERRCODE_SUCC) {
LWIP_DEBUGF(SLIP_DEBUG, ("[slip][service] app create mail fail\n"));
- return ERRCODE_FAIL;
}
+}
+int slip_uart_init(void)
+{
+
- osal_task *task_handle = osal_kthread_create((osal_kthread_handler)uart_event_task, NULL,
- "uart_slip_service", SLIP_CMD_TASK_SIZE);
- if (task_handle == NULL) {
- osal_msg_queue_is_full(g_slip_cmd_queue);
- LWIP_DEBUGF(SLIP_DEBUG, ("create uart_slip service thread fail!\r\n"));
+ PRINT("slip_uart_init !\r\n");
+ app_task_definition_t taskcfg={0};
+ taskcfg.create_queue_handle = create_slip_uart_queue;
+ taskcfg.attr.name="uart_slip_service";
+ taskcfg.attr.priority = osPriorityNormal;
+ taskcfg.attr.stack_size = SLIP_CMD_TASK_SIZE;
+ taskcfg.func = uart_event_task;
+ taskcfg.use_mem = USE_DTCM_MEM;
+
+ errcode_t ret=uapi_create_osThread_custom(&taskcfg);
+ if(ret != ERRCODE_SUCC)
+ {
+ PRINT("create uart_slip_service failed %d!\r\n",ret);
return ERRCODE_FAIL;
}
-
- osal_kthread_set_priority(task_handle, SLIP_CMD_TASK_PRIO);
- #else
-
- user_netif_init();
-
- #endif
return ERRCODE_SUCC;
}