g0b1vetx-board/Comm/networkthread.c
2023-05-03 18:18:03 +08:00

78 lines
1.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "main.h"
#include "os-app.h"
#include <stdio.h>
#include <rtthread.h>
#include <net-app.h>
ALIGN(RT_ALIGN_SIZE)
static char thread_stack[4096];
static struct rt_thread netapp_thread;
static enum {
netDrvInit = 0, // 初始化网络驱动
netDrvJoin = 1, // 等待网络注册成功
netDrvSend = 2, // 发送数据
netDrvRecv = 3, // 读取数据
netDrvIdle = 4, // 读取数据
}eDrvStatus;
static netWorkInterface_t interface;
static void thread_entry(void * argument)
{
eDrvStatus = netDrvInit;
rt_kprintf("%s was start!\r\n",__FILE__);
// 注册网络驱动
// 注册网络驱动
while (1)
{
switch (eDrvStatus)
{
case netDrvInit:
break;
case netDrvJoin:
break;
case netDrvSend:
break;
case netDrvRecv:
break;
case netDrvIdle:
break;
default :
break;
}
rt_thread_delay(10);
}
}
void NET_APPThreadStart(void )
{
/* 创建线程1名称是thread1入口是thread1_entry*/
rt_thread_init(&netapp_thread, "netapp_thread",
thread_entry, RT_NULL,
&thread_stack[0],
sizeof(thread_stack),
NET_APP_THREAD_PRIORITY, NET_APP_THREAD_TIMESLICE);
rt_thread_startup(&netapp_thread);
return ;
}