소스 검색

update: 使用AIR601固件标识,不再使用AIR103+WLAN宏进行判断

Wendal Chen 2 년 전
부모
커밋
2c7fe688ff
7개의 변경된 파일15개의 추가작업 그리고 17개의 파일을 삭제
  1. 0 4
      app/port/luat_adc_air101.c
  2. 7 0
      app/port/luat_conf_bsp.h
  3. 2 2
      app/port/luat_conf_bsp_air601.h
  4. 2 2
      app/port/luat_fs_air101.c
  5. 0 2
      app/port/luat_sdio_air101.c
  6. 1 5
      app/port/luat_spi_air101.c
  7. 3 2
      xmake.lua

+ 0 - 4
app/port/luat_adc_air101.c

@@ -17,14 +17,12 @@ int luat_adc_open(int ch, void *args)
     case 1:
         wm_adc_config(ch);
         break;
-// #ifdef AIR103
     case 2:
         wm_adc_config(ch);
         break;
     case 3:
         wm_adc_config(ch);
         break;
-// #endif
     case 10:
     case LUAT_ADC_CH_CPU:
         return 0; // 温度传感器
@@ -82,14 +80,12 @@ int luat_adc_close(int ch)
     case 1:
         tls_io_cfg_set(WM_IO_PA_04, WM_IO_OPTION5);
         break;
-// #ifdef AIR103
     case 2:
         tls_io_cfg_set(WM_IO_PA_03, WM_IO_OPTION5);
         break;
     case 3:
         tls_io_cfg_set(WM_IO_PA_02, WM_IO_OPTION5);
         break;
-// #endif
     case LUAT_ADC_CH_CPU:
         break; // 温度
     case LUAT_ADC_CH_VBAT:

+ 7 - 0
app/port/luat_conf_bsp.h

@@ -12,6 +12,7 @@
 
 
 // Air101 与 Air103 的Flash大小有差异,需要区分
+// 可选值, AIR101 AIR103 AIR601 分别对应3种模块
 #define AIR101
 
 // 启用64位虚拟机
@@ -238,6 +239,12 @@
 //<-- custom
 //------------------------------------------------------------------------------
 
+#ifdef AIR601
+#ifndef LUAT_USE_WLAN
+#define LUAT_USE_WLAN 1
+#endif
+#endif
+
 #if defined(LUAT_USE_WLAN) || defined(LUAT_USE_W5500)
 #ifndef LUAT_USE_NETWORK
 #define LUAT_USE_NETWORK

+ 2 - 2
app/port/luat_conf_bsp_air601.h

@@ -59,8 +59,8 @@
 
 #define LUAT_BSP_VERSION "V1021"
 
-// Air101 与 Air103 的Flash大小有差异,需要区分
-#define AIR103
+// Air601
+#define AIR601
 
 // 启用64位虚拟机
 // #define LUAT_CONF_VM_64bit

+ 2 - 2
app/port/luat_fs_air101.c

@@ -50,7 +50,7 @@ void lv_split_jpeg_init(void);
 
 int luat_fs_init(void) {
     //luat_timer_mdelay(1000);
-#ifdef AIR103
+#if (defined(AIR103) || defined(AIR601))
     luadb_addr =  0x0E0000 - (FLASH_FS_REGION_SIZE - 112) * 1024U;
 #else
     luadb_addr =  0x1E0000 - (FLASH_FS_REGION_SIZE - 112) * 1024U;
@@ -74,7 +74,7 @@ int luat_fs_init(void) {
     }
     // else {
         //LLOGI("Using LuaDB as script zone format %p", ptr);
-#ifdef AIR103
+#if (defined(AIR103) || defined(AIR601))
         lfs_addr = 0x0FC000 - (LUAT_FS_SIZE*1024);
         lfs_size_kb = LUAT_FS_SIZE;
 #else

+ 0 - 2
app/port/luat_sdio_air101.c

@@ -24,12 +24,10 @@ int luat_sdio_init(int id){
 		wm_sdio_host_config(0);
 		return 0;
 	}
-// #ifdef AIR103
 	else if (id == 1) {
 		wm_sdio_host_config(1);
 		return 0;
 	}
-// #endif
 	return -1;
 }
 

+ 1 - 5
app/port/luat_spi_air101.c

@@ -11,7 +11,7 @@
 #include "wm_dma.h"
 #include "wm_pmu.h"
 
-#define LUAT_LOG_TAG "luat.spi"
+#define LUAT_LOG_TAG "spi"
 #include "luat_log.h"
 #include "luat_timer.h"
 
@@ -49,7 +49,6 @@ int luat_spi_bus_setup(luat_spi_device_t* spi_dev){
         wm_spi_di_config(WM_IO_PB_03);
         wm_spi_do_config(WM_IO_PB_05);
     }
-    // #ifdef AIR103
     else if (bus_id == 1) { // 本质上是mode=1,不是spi1,该模式下psram可用
 	    wm_spi_ck_config(WM_IO_PB_15);
 	    wm_spi_di_config(WM_IO_PB_16);
@@ -67,7 +66,6 @@ int luat_spi_bus_setup(luat_spi_device_t* spi_dev){
         tls_open_peripheral_clock(TLS_PERIPHERAL_TYPE_SDIO_MASTER);
         return 0;
     }
-    // #endif
     else{
         LLOGD("spi_bus error");
         return -1;
@@ -95,7 +93,6 @@ int luat_spi_setup(luat_spi_t* spi) {
         wm_spi_di_config(WM_IO_PB_03);
         wm_spi_do_config(WM_IO_PB_05);
     }
-    // #ifdef AIR103
     else if (spi->id == 1) { // 本质上是mode=1,不是spi1,该模式下psram可用
         if (spi->cs == 0 || spi->cs == WM_IO_PB_14)
 	        wm_spi_cs_config(WM_IO_PB_14);
@@ -121,7 +118,6 @@ int luat_spi_setup(luat_spi_t* spi) {
         sdio_spi_init(spi->bandrate);
         return 0;
     }
-    // #endif
     else {
         return -1;
     }

+ 3 - 2
xmake.lua

@@ -421,10 +421,11 @@ target("air10x")
         local custom_data = io.readfile("$(projectdir)/app/port/luat_conf_bsp.h")
         local TARGET_CONF = custom_data:find("\r#define AIR101") or custom_data:find("\n#define AIR101")
         if TARGET_CONF == nil then TARGET_NAME = "AIR103" else TARGET_NAME = "AIR101" end
+        if custom_data:find("\r#define AIR601") or custom_data:find("\n#define AIR601") then
+            TARGET_NAME = "AIR601"
+        end
         local FDB_CONF = conf_data:find("\r#define LUAT_USE_FDB") or conf_data:find("\n#define LUAT_USE_FDB") or conf_data:find("\r#define LUAT_USE_FSKV") or conf_data:find("\n#define LUAT_USE_FSKV") 
         
-        local WLAN_CONF = conf_data:find("\r#define LUAT_USE_WLAN") or conf_data:find("\n#define LUAT_USE_WLAN")
-        if WLAN_CONF then TARGET_NAME = "AIR601" end
         local fs_size = AIR10X_FLASH_FS_REGION_SIZE or 112
         if FDB_CONF or fs_size > 112 then
             local ld_data = io.readfile("./ld/"..TARGET_NAME..".ld")