Ver Fonte

update:开放基于w5500的网络功能

alienwalker há 3 anos atrás
pai
commit
5b47609ccd

+ 2 - 2
application/include/luat_conf_bsp.h

@@ -65,13 +65,13 @@
 #define LUAT_USE_FATFS 1
 #define LUAT_USE_I2CTOOLS 1
 #define LUAT_USE_SOFTKB 1
-#ifdef __DEBUG__
+
 #define LUAT_USE_W5500  1
 #define LUAT_USE_DHCP  1
 #define LUAT_USE_DNS  1
 #define LUAT_USE_NETWORK 1
 #define LUAT_USE_TLS 1
-#endif
+
 //----------------------------
 // 高通字体, 需配合芯片使用
 #define LUAT_USE_GTFONT 1

+ 2 - 1
application/src/luat_timer_air105.c

@@ -53,12 +53,13 @@ static int32_t luat_timer_callback(void *pData, void *pParam)
     size_t timer_id = (size_t)pParam;
     luat_timer_t *timer = luat_timer_get(timer_id);
     if (timer == NULL)
-        return;
+        return 0;
     msg.handler = timer->func;
     msg.ptr = timer;
     msg.arg1 = timer_id;
     msg.arg2 = 0;
     luat_msgbus_put(&msg, 0);
+    return 0;
 }
 
 static int nextTimerSlot() {

+ 1 - 0
bsp/common/include/core_task.h

@@ -31,4 +31,5 @@ void Task_DelayTick(uint64_t Tick);
 void Task_DelayUS(uint32_t US);
 void Task_DelayMS(uint32_t MS);
 void Task_Exit(void);
+void Task_Debug(HANDLE TaskHandle);
 #endif

+ 22 - 3
bsp/common/src/core_task.c

@@ -118,7 +118,7 @@ void Task_SendEvent(HANDLE TaskHandle, uint32_t ID, uint32_t P1, uint32_t P2, ui
 {
 	if (!TaskHandle) return;
 	uint32_t Critical;
-	llist_head *Head = (llist_head *)vTaskGetPoint(TaskHandle, TASK_POINT_LIST_HEAD);
+	volatile llist_head *Head = (llist_head *)vTaskGetPoint(TaskHandle, TASK_POINT_LIST_HEAD);
 #ifdef __USE_SEMAPHORE__
 	SemaphoreHandle_t sem = (SemaphoreHandle_t)vTaskGetPoint(TaskHandle, TASK_POINT_EVENT_SEM);
 #endif
@@ -127,12 +127,13 @@ void Task_SendEvent(HANDLE TaskHandle, uint32_t ID, uint32_t P1, uint32_t P2, ui
 	Event->Param1 = P1;
 	Event->Param2 = P2;
 	Event->Param3 = P3;
+
 	Critical = OS_EnterCritical();
 	vTaskModifyPoint(TaskHandle, TASK_POINT_DEBUG, 1);
 	llist_add_tail(&Event->Node, Head);
 	if (vTaskGetPoint(TaskHandle, TASK_POINT_DEBUG) >= 1024)
 	{
-		DBG_Trace("%s wait too much msg!", vTaskInfo(TaskHandle, &ID, &P1, &P2));
+		DBG_Trace("%s wait too much msg! %u", vTaskInfo(TaskHandle, &ID, &P1, &P2), vTaskGetPoint(TaskHandle, TASK_POINT_DEBUG));
 		Core_PrintServiceStack();
 		__disable_irq();
 		while(1) {;}
@@ -181,19 +182,27 @@ int32_t Task_GetEvent(HANDLE TaskHandle, uint32_t TargetEventID, OS_EVENT *OutEv
 	}
 GET_NEW_EVENT:
 	Critical = OS_EnterCritical();
+
 	if (!llist_empty(Head))
 	{
 		Event = (Core_EventStruct *)Head->next;
 		llist_del(&Event->Node);
-		vTaskModifyPoint(TaskHandle, TASK_POINT_DEBUG, -1);
+		if (vTaskGetPoint(TaskHandle, TASK_POINT_DEBUG) > 0)
+		{
+			vTaskModifyPoint(TaskHandle, TASK_POINT_DEBUG, -1);
+		}
+
 	}
 	else
 	{
 		Event = NULL;
 	}
+
 	OS_ExitCritical(Critical);
+
 	if (Event)
 	{
+
 		OutEvent->ID = Event->ID;
 		OutEvent->Param1 = Event->Param1;
 		OutEvent->Param2 = Event->Param2;
@@ -314,4 +323,14 @@ void Task_DelayMS(uint32_t MS)
 	ToTick *= SYS_TIMER_1MS;
 	Task_DelayTick(ToTick);
 }
+
+void Task_Debug(HANDLE TaskHandle)
+{
+	if (!TaskHandle)
+	{
+		TaskHandle = vTaskGetCurrent();
+	}
+	volatile llist_head *Head = (llist_head *)vTaskGetPoint(TaskHandle, TASK_POINT_LIST_HEAD);
+	DBG("%x,%x,%x", Head, Head->next, Head->prev);
+}
 #endif

+ 6 - 0
xmake.lua

@@ -345,6 +345,12 @@ if with_luatos then
     -- usbapp
     add_includedirs(luatos.."components/usbapp",{public = true})
     add_files(luatos.."components/usbapp/*.c")
+    -- network
+    add_includedirs(luatos.."components/ethernet/common",{public = true})
+    add_includedirs(luatos.."components/ethernet/w5500",{public = true})
+    add_includedirs(luatos.."components/network/adapter",{public = true})
+    add_files(luatos.."components/ethernet/*/*.c")
+    add_files(luatos.."components/network/adapter/*.c")
 else
 
     add_files("Third_Party/vsprintf/*.c",{public = true})