sim: move driver/arch initialize to sim_bringup

Change-Id: Ia41cc3978cc26294ca72be10cdedeb6efc8aea7a
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong 2021-04-27 22:48:30 +08:00 committed by Xiang Xiao
parent 0114318da6
commit 2969cf7a66
2 changed files with 38 additions and 27 deletions

View File

@ -24,12 +24,8 @@
#include <nuttx/config.h>
#include <nuttx/board.h>
#include <nuttx/sensors/wtgahrs2.h>
#include <nuttx/rc/lirc_dev.h>
#include <nuttx/rc/dummy.h>
#include "sim.h"
#include "up_internal.h"
/****************************************************************************
* Public Functions
@ -67,26 +63,6 @@ int board_app_initialize(uintptr_t arg)
sim_bringup();
#endif
#ifdef CONFIG_RPTUN
up_rptun_init();
#endif
#ifdef CONFIG_SIM_WTGAHRS2_UARTN
#if CONFIG_SIM_WTGAHRS2_UARTN == 0
wtgahrs2_initialize(CONFIG_SIM_UART0_NAME, 0);
#elif CONFIG_SIM_WTGAHRS2_UARTN == 1
wtgahrs2_initialize(CONFIG_SIM_UART1_NAME, 1);
#elif CONFIG_SIM_WTGAHRS2_UARTN == 2
wtgahrs2_initialize(CONFIG_SIM_UART2_NAME, 2);
#elif CONFIG_SIM_WTGAHRS2_UARTN == 3
wtgahrs2_initialize(CONFIG_SIM_UART3_NAME, 3);
#endif
#endif
#ifdef CONFIG_RC_DUMMY
rc_dummy_initialize(0);
#endif
return 0;
}
#endif /* CONFIG_LIB_BOARDCTL */

View File

@ -34,14 +34,18 @@
#include <nuttx/mtd/mtd.h>
#include <nuttx/fs/fs.h>
#include <nuttx/fs/nxffs.h>
#include <nuttx/video/fb.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/rc/lirc_dev.h>
#include <nuttx/rc/dummy.h>
#include <nuttx/sensors/fakesensor.h>
#include <nuttx/sensors/mpu60x0.h>
#include <nuttx/sensors/wtgahrs2.h>
#include <nuttx/timers/oneshot.h>
#include <nuttx/video/fb.h>
#include <nuttx/wireless/pktradio.h>
#include <nuttx/wireless/bluetooth/bt_null.h>
#include <nuttx/wireless/bluetooth/bt_uart_shim.h>
#include <nuttx/wireless/ieee802154/ieee802154_loopback.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/sensors/mpu60x0.h>
#ifdef CONFIG_LCD_DEV
#include <nuttx/lcd/lcd_dev.h>
@ -420,5 +424,36 @@ int sim_bringup(void)
}
#endif
#ifdef CONFIG_RPTUN
up_rptun_init();
#endif
#ifdef CONFIG_SIM_WTGAHRS2_UARTN
#if CONFIG_SIM_WTGAHRS2_UARTN == 0
wtgahrs2_initialize(CONFIG_SIM_UART0_NAME, 0);
#elif CONFIG_SIM_WTGAHRS2_UARTN == 1
wtgahrs2_initialize(CONFIG_SIM_UART1_NAME, 1);
#elif CONFIG_SIM_WTGAHRS2_UARTN == 2
wtgahrs2_initialize(CONFIG_SIM_UART2_NAME, 2);
#elif CONFIG_SIM_WTGAHRS2_UARTN == 3
wtgahrs2_initialize(CONFIG_SIM_UART3_NAME, 3);
#endif
#endif
#ifdef CONFIG_SENSORS_FAKESENSOR
fakesensor_init(SENSOR_TYPE_ACCELEROMETER,
"/data/boards/sim/sim/sim/src/csv/accel.csv", 0, 50);
fakesensor_init(SENSOR_TYPE_MAGNETIC_FIELD,
"/data/boards/sim/sim/sim/src/csv/mag.csv", 0, 50);
fakesensor_init(SENSOR_TYPE_GYROSCOPE,
"/data/boards/sim/sim/sim/src/csv/gyro.csv", 0, 50);
#endif
#ifdef CONFIG_RC_DUMMY
rc_dummy_initialize(0);
#endif
return ret;
}