change ch438 on nuttx

This commit is contained in:
wgzAIIT 2022-05-09 17:29:49 +08:00
parent de273145c3
commit ee132df28a
3 changed files with 375 additions and 424 deletions

View File

@ -184,12 +184,7 @@ int imxrt_bringup(void)
#endif #endif
#ifdef CONFIG_BSP_USING_CH438 #ifdef CONFIG_BSP_USING_CH438
ret = board_ch438_initialize(); board_ch438_initialize();
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize ch438 Driver: %d\n", ret);
}
#endif #endif
UNUSED(ret); UNUSED(ret);

View File

@ -546,7 +546,8 @@ static size_t ImxrtCh438ReadData(uint8_t ext_uart_no)
static void Ch438InitDefault(void) static void Ch438InitDefault(void)
{ {
int ret, i; int ret = 0;
int i;
/* Initialize the mutex */ /* Initialize the mutex */
@ -699,84 +700,39 @@ static int ch438_register(FAR const char *devpath, uint8_t port)
* ch438 initialize * ch438 initialize
* *
****************************************************************************/ ****************************************************************************/
int board_ch438_initialize(void) void board_ch438_initialize(void)
{ {
int ret = 0;
Ch438InitDefault(); Ch438InitDefault();
#ifdef CONFIG_CH438_EXTUART0 #ifdef CONFIG_CH438_EXTUART0
ret = ch438_register("/dev/extuart_dev0", 0); ch438_register("/dev/extuart_dev0", 0);
if (ret < 0)
{
ch438err("Failed to register /dev/extuart_dev0: %d\n", ret);
goto __exit;
}
#endif #endif
#ifdef CONFIG_CH438_EXTUART1 #ifdef CONFIG_CH438_EXTUART1
ret = ch438_register("/dev/extuart_dev1", 1); ch438_register("/dev/extuart_dev1", 1);
if (ret < 0)
{
ch438err("Failed to register /dev/extuart_dev1: %d\n", ret);
goto __exit;
}
#endif #endif
#ifdef CONFIG_CH438_EXTUART2 #ifdef CONFIG_CH438_EXTUART2
ret = ch438_register("/dev/extuart_dev2", 2); ch438_register("/dev/extuart_dev2", 2);
if (ret < 0)
{
ch438err("Failed to register /dev/extuart_dev2: %d\n", ret);
goto __exit;
}
#endif #endif
#ifdef CONFIG_CH438_EXTUART3 #ifdef CONFIG_CH438_EXTUART3
ret = ch438_register("/dev/extuart_dev3", 3); ch438_register("/dev/extuart_dev3", 3);
if (ret < 0)
{
ch438err("Failed to register /dev/extuart_dev3: %d\n", ret);
goto __exit;
}
#endif #endif
#ifdef CONFIG_CH438_EXTUART4 #ifdef CONFIG_CH438_EXTUART4
ret = ch438_register("/dev/extuart_dev4", 4); ch438_register("/dev/extuart_dev4", 4);
if (ret < 0)
{
ch438err("Failed to register /dev/extuart_dev4: %d\n", ret);
goto __exit;
}
#endif #endif
#ifdef CONFIG_CH438_EXTUART5 #ifdef CONFIG_CH438_EXTUART5
ret = ch438_register("/dev/extuart_dev5", 5); ch438_register("/dev/extuart_dev5", 5);
if (ret < 0)
{
ch438err("Failed to register /dev/extuart_dev5: %d\n", ret);
goto __exit;
}
#endif #endif
#ifdef CONFIG_CH438_EXTUART6 #ifdef CONFIG_CH438_EXTUART6
ret = ch438_register("/dev/extuart_dev6", 6); ch438_register("/dev/extuart_dev6", 6);
if (ret < 0)
{
ch438err("Failed to register /dev/extuart_dev6: %d\n", ret);
goto __exit;
}
#endif #endif
#ifdef CONFIG_CH438_EXTUART7 #ifdef CONFIG_CH438_EXTUART7
ret = ch438_register("/dev/extuart_dev7", 7); ch438_register("/dev/extuart_dev7", 7);
if (ret < 0)
{
ch438err("Failed to register /dev/extuart_dev7: %d\n", ret);
goto __exit;
}
#endif #endif
__exit:
return ret;
} }

View File

@ -356,7 +356,7 @@
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_BSP_USING_CH438 #ifdef CONFIG_BSP_USING_CH438
int board_ch438_initialize(void); void board_ch438_initialize(void);
#endif #endif
#endif /* __BOARDS_ARM_IMXRT_XIDATONG_SRC_IMXRT_CH438_H */ #endif /* __BOARDS_ARM_IMXRT_XIDATONG_SRC_IMXRT_CH438_H */