Browse Source

add:shell接收改掉先提交一下

Dozingfiretruck 4 years ago
parent
commit
6d680d4889
1 changed files with 26 additions and 2 deletions
  1. 26 2
      app/port/luat_shell_air101.c

+ 26 - 2
app/port/luat_shell_air101.c

@@ -18,6 +18,8 @@ void luat_shell_write(char* buff, size_t len) {
 void luat_shell_notify_recv(void) {
 void luat_shell_notify_recv(void) {
 }
 }
 
 
+static tls_os_queue_t *shell_queue = NULL;
+
 static int16_t luat_shell_uart_cb(uint16_t len, void* user_data){
 static int16_t luat_shell_uart_cb(uint16_t len, void* user_data){
 	int uartid = (int)user_data;
 	int uartid = (int)user_data;
 	char buff[512] = {0};
 	char buff[512] = {0};
@@ -27,14 +29,36 @@ static int16_t luat_shell_uart_cb(uint16_t len, void* user_data){
 		while (l > 0) {
 		while (l > 0) {
 			l = luat_uart_read(0, buff, 512);
 			l = luat_uart_read(0, buff, 512);
 			//printf("uart read buff %d %s\n", l, buff);
 			//printf("uart read buff %d %s\n", l, buff);
-			if (l > 0)
-				luat_shell_push(buff, l);
+			if (l > 0){
+				// luat_shell_push(buff, l);
+				tls_os_queue_send(shell_queue, (void *)buff, sizeof(rtos_msg_t));
+			}
 		}
 		}
 	}
 	}
     return 0;
     return 0;
 }
 }
 
 
+extern void luat_cmux_read(unsigned char* buff,size_t len);
+static void luat_shell(void *sdata){
+	void* msg;
+	while (1) {
+		tls_os_queue_receive(shell_queue, (void **) &msg, 0, 0);
+		// printf("uart read buff %s\n", (char*)msg);
+		luat_shell_push((char*)msg, strlen(msg));
+	}
+}
+
+#define    TASK_START_STK_SIZE         2048
+static OS_STK __attribute__((aligned(4))) 			TaskStartStk[TASK_START_STK_SIZE] = {0};
 void luat_shell_poweron(int _drv) {
 void luat_shell_poweron(int _drv) {
     tls_uart_rx_callback_register(0, luat_shell_uart_cb, NULL);
     tls_uart_rx_callback_register(0, luat_shell_uart_cb, NULL);
+	tls_os_queue_create(&shell_queue, 2048);
+	tls_os_task_create(NULL, NULL,
+				luat_shell,
+				NULL,
+				(void *)TaskStartStk,          /* task's stack start address */
+				TASK_START_STK_SIZE * sizeof(u32), /* task's stack size, unit:byte */
+				31,
+				0);
 }
 }