Prechádzať zdrojové kódy

update:完善rtos接口

alienwalker 4 rokov pred
rodič
commit
d777ba163e
1 zmenil súbory, kde vykonal 13 pridanie a 3 odobranie
  1. 13 3
      luat/include/luat_rtos.h

+ 13 - 3
luat/include/luat_rtos.h

@@ -5,9 +5,18 @@
 
 /* ----------------------------------- thread ----------------------------------- */
 typedef int (*thread_entry) (void*);
+typedef void (*task_entry) (void*);
 typedef struct luat_thread{
-    int id;
-    thread_entry entry;
+	union
+	{
+		int id;
+		void *handle;
+	};
+    union
+	{
+		thread_entry entry;
+		task_entry task_fun;
+	};
     const char *name;
     uint32_t stack_size;
     uint32_t* task_stk;
@@ -19,7 +28,8 @@ typedef struct luat_thread{
 LUAT_RET luat_thread_start(luat_thread_t* thread);
 LUAT_RET luat_thread_stop(luat_thread_t* thread);
 LUAT_RET luat_thread_delete(luat_thread_t* thread);
-
+LUAT_RET luat_send_event_to_task(luat_thread_t* thread, uint32_t id, uint32_t param1, uint32_t param2, uint32_t param3);
+LUAT_RET luat_wait_event_from_task(luat_thread_t* thread, uint32_t wait_event_id, void *out_event, CBFuncEx_t call_back, uint32_t ms);
 /* ----------------------------------- semaphore ----------------------------------- */
 typedef struct luat_sem{
     const char *name;