From 4e8660a21fb4ca1cd814df8ab7a9583221c63ae3 Mon Sep 17 00:00:00 2001 From: Deomid Ryabkov Date: Wed, 24 Apr 2019 19:34:25 +0100 Subject: [PATCH] RS14100 fixes CL: none PUBLISHED_FROM=4d5d68f92d6c082b5b0c25ed8935fc097939001f --- mongoose.h | 70 ++++++++++++++++++++++++- src/common/platform.h | 6 ++- src/common/platforms/platform_rs14100.h | 61 +++++++++++++++++++++ src/mg_modules.mk | 1 + 4 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 src/common/platforms/platform_rs14100.h diff --git a/mongoose.h b/mongoose.h index 8d9823d8..28d62855 100644 --- a/mongoose.h +++ b/mongoose.h @@ -58,8 +58,9 @@ #define CS_P_NRF51 12 #define CS_P_NRF52 10 #define CS_P_PIC32 11 +#define CS_P_RS14100 18 #define CS_P_STM32 16 -/* Next id: 18 */ +/* Next id: 19 */ /* If not specified explicitly, we guess platform by defines. */ #ifndef CS_PLATFORM @@ -91,6 +92,8 @@ #elif defined(TARGET_IS_TM4C129_RA0) || defined(TARGET_IS_TM4C129_RA1) || \ defined(TARGET_IS_TM4C129_RA2) #define CS_PLATFORM CS_P_TM4C129 +#elif defined(RS14100) +#define CS_PLATFORM CS_P_RS14100 #elif defined(STM32) #define CS_PLATFORM CS_P_STM32 #endif @@ -125,6 +128,7 @@ /* Amalgamated: #include "common/platforms/platform_nxp_lpc.h" */ /* Amalgamated: #include "common/platforms/platform_nxp_kinetis.h" */ /* Amalgamated: #include "common/platforms/platform_pic32.h" */ +/* Amalgamated: #include "common/platforms/platform_rs14100.h" */ /* Amalgamated: #include "common/platforms/platform_stm32.h" */ #if CS_PLATFORM == CS_P_CUSTOM #include @@ -1910,6 +1914,70 @@ char *inet_ntoa(struct in_addr in); #endif /* CS_COMMON_PLATFORMS_PLATFORM_PIC32_H_ */ #ifdef MG_MODULE_LINES +#line 1 "common/platforms/platform_rs14100.h" +#endif +/* + * Copyright (c) 2014-2019 Cesanta Software Limited + * All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the ""License""); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an ""AS IS"" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef CS_COMMON_PLATFORMS_PLATFORM_RS14100_H_ +#define CS_COMMON_PLATFORMS_PLATFORM_RS14100_H_ +#if CS_PLATFORM == CS_P_RS14100 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef MGOS_HAVE_VFS_COMMON +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define to64(x) strtoll(x, NULL, 10) +#define INT64_FMT "lld" +#define SIZE_T_FMT "u" +typedef struct stat cs_stat_t; +#define DIRSEP '/' + +#ifndef CS_ENABLE_STDIO +#define CS_ENABLE_STDIO 1 +#endif + +#ifndef MG_ENABLE_FILESYSTEM +#define MG_ENABLE_FILESYSTEM 1 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* CS_PLATFORM == CS_P_RS14100 */ +#endif /* CS_COMMON_PLATFORMS_PLATFORM_RS14100_H_ */ +#ifdef MG_MODULE_LINES #line 1 "common/platforms/platform_stm32.h" #endif /* diff --git a/src/common/platform.h b/src/common/platform.h index a6f218ce..af91973f 100644 --- a/src/common/platform.h +++ b/src/common/platform.h @@ -22,8 +22,9 @@ #define CS_P_NRF51 12 #define CS_P_NRF52 10 #define CS_P_PIC32 11 +#define CS_P_RS14100 18 #define CS_P_STM32 16 -/* Next id: 18 */ +/* Next id: 19 */ /* If not specified explicitly, we guess platform by defines. */ #ifndef CS_PLATFORM @@ -55,6 +56,8 @@ #elif defined(TARGET_IS_TM4C129_RA0) || defined(TARGET_IS_TM4C129_RA1) || \ defined(TARGET_IS_TM4C129_RA2) #define CS_PLATFORM CS_P_TM4C129 +#elif defined(RS14100) +#define CS_PLATFORM CS_P_RS14100 #elif defined(STM32) #define CS_PLATFORM CS_P_STM32 #endif @@ -89,6 +92,7 @@ #include "common/platforms/platform_nxp_lpc.h" #include "common/platforms/platform_nxp_kinetis.h" #include "common/platforms/platform_pic32.h" +#include "common/platforms/platform_rs14100.h" #include "common/platforms/platform_stm32.h" #if CS_PLATFORM == CS_P_CUSTOM #include diff --git a/src/common/platforms/platform_rs14100.h b/src/common/platforms/platform_rs14100.h new file mode 100644 index 00000000..5e9618e5 --- /dev/null +++ b/src/common/platforms/platform_rs14100.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2014-2019 Cesanta Software Limited + * All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the ""License""); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an ""AS IS"" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef CS_COMMON_PLATFORMS_PLATFORM_RS14100_H_ +#define CS_COMMON_PLATFORMS_PLATFORM_RS14100_H_ +#if CS_PLATFORM == CS_P_RS14100 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef MGOS_HAVE_VFS_COMMON +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define to64(x) strtoll(x, NULL, 10) +#define INT64_FMT "lld" +#define SIZE_T_FMT "u" +typedef struct stat cs_stat_t; +#define DIRSEP '/' + +#ifndef CS_ENABLE_STDIO +#define CS_ENABLE_STDIO 1 +#endif + +#ifndef MG_ENABLE_FILESYSTEM +#define MG_ENABLE_FILESYSTEM 1 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* CS_PLATFORM == CS_P_RS14100 */ +#endif /* CS_COMMON_PLATFORMS_PLATFORM_RS14100_H_ */ diff --git a/src/mg_modules.mk b/src/mg_modules.mk index b53c53b1..e0e51bc7 100644 --- a/src/mg_modules.mk +++ b/src/mg_modules.mk @@ -19,6 +19,7 @@ HEADERS = mg_common.h \ $(COMMON)/platforms/platform_nxp_lpc.h \ $(COMMON)/platforms/platform_nxp_kinetis.h \ $(COMMON)/platforms/platform_pic32.h \ + $(COMMON)/platforms/platform_rs14100.h \ $(COMMON)/platforms/platform_stm32.h \ $(COMMON)/platforms/lwip/mg_lwip.h \ $(COMMON)/cs_md5.h \