Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
92b15395
Commit
92b15395
authored
Oct 28, 2016
by
Deomid Ryabkov
Committed by
Cesanta Bot
Oct 28, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CS_P_NXP_LPC - platform def for NXP LPC MCUs
PUBLISHED_FROM=d6ed793313a98545d5a89faafc8526b658ffff66
parent
7411ff1f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
13 deletions
+109
-13
mongoose.c
mongoose.c
+24
-8
mongoose.h
mongoose.h
+85
-5
No files found.
mongoose.c
View file @
92b15395
...
@@ -723,7 +723,8 @@ typedef int cs_dirent_dummy;
...
@@ -723,7 +723,8 @@ typedef int cs_dirent_dummy;
*/
*/
#if !(defined(__ARMCC_VERSION) || defined(__ICCARM__)) && \
#if !(defined(__ARMCC_VERSION) || defined(__ICCARM__)) && \
(!defined(CS_PLATFORM) || \
(!defined(CS_PLATFORM) || \
(CS_PLATFORM != CS_P_CC3200 && CS_PLATFORM != CS_P_MSP432))
(CS_PLATFORM != CS_P_CC3200 && CS_PLATFORM != CS_P_MSP432 && \
CS_PLATFORM != CS_P_NXP_LPC))
#include <sys/time.h>
#include <sys/time.h>
#endif
#endif
#else
#else
...
@@ -1722,10 +1723,7 @@ const char *c_strnstr(const char *s, const char *find, size_t slen) {
...
@@ -1722,10 +1723,7 @@ const char *c_strnstr(const char *s, const char *find, size_t slen) {
return
NULL
;
return
NULL
;
}
}
/*
#if CS_ENABLE_STRDUP
* ARM C Compiler doesn't have strdup, so we provide it
*/
#if defined(__ARMCC_VERSION)
char
*
strdup
(
const
char
*
src
)
{
char
*
strdup
(
const
char
*
src
)
{
size_t
len
=
strlen
(
src
)
+
1
;
size_t
len
=
strlen
(
src
)
+
1
;
char
*
ret
=
malloc
(
len
);
char
*
ret
=
malloc
(
len
);
...
@@ -1766,6 +1764,24 @@ void cs_from_hex(char *to, const char *p, size_t len) {
...
@@ -1766,6 +1764,24 @@ void cs_from_hex(char *to, const char *p, size_t len) {
*
to
=
'\0'
;
*
to
=
'\0'
;
}
}
#if CS_ENABLE_TO64
int64_t
cs_to64
(
const
char
*
s
)
{
int64_t
result
=
0
;
int64_t
neg
=
1
;
while
(
*
s
&&
isspace
((
unsigned
char
)
*
s
))
s
++
;
if
(
*
s
==
'-'
)
{
neg
=
-
1
;
s
++
;
}
while
(
isdigit
((
unsigned
char
)
*
s
))
{
result
*=
10
;
result
+=
(
*
s
-
'0'
);
s
++
;
}
return
result
*
neg
;
}
#endif
#endif
/* EXCLUDE_COMMON */
#endif
/* EXCLUDE_COMMON */
#ifdef MG_MODULE_LINES
#ifdef MG_MODULE_LINES
#line 1 "mongoose/src/net.c"
#line 1 "mongoose/src/net.c"
...
@@ -11528,7 +11544,7 @@ void sl_restart_cb(struct mg_mgr *mgr) {
...
@@ -11528,7 +11544,7 @@ void sl_restart_cb(struct mg_mgr *mgr) {
#if MG_NET_IF == MG_NET_IF_LWIP_LOW_LEVEL
#if MG_NET_IF == MG_NET_IF_LWIP_LOW_LEVEL
#include <
inttypes
.h>
#include <
stdint
.h>
struct
mg_lwip_conn_state
{
struct
mg_lwip_conn_state
{
union
{
union
{
...
...
mongoose.h
View file @
92b15395
...
@@ -50,16 +50,16 @@
...
@@ -50,16 +50,16 @@
#define CS_P_CC3100 6
#define CS_P_CC3100 6
#define CS_P_MBED 7
#define CS_P_MBED 7
#define CS_P_WINCE 8
#define CS_P_WINCE 8
#define CS_P_NXP_LPC 13
#define CS_P_NXP_KINETIS 9
#define CS_P_NXP_KINETIS 9
#define CS_P_NRF51 12
#define CS_P_NRF52 10
#define CS_P_NRF52 10
#define CS_P_PIC32_HARMONY 11
#define CS_P_PIC32_HARMONY 11
#define CS_P_NRF51 12
/* If not specified explicitly, we guess platform by defines. */
/* If not specified explicitly, we guess platform by defines. */
#ifndef CS_PLATFORM
#ifndef CS_PLATFORM
#if defined(TARGET_IS_MSP432P4XX) || defined(__MSP432P401R__)
#if defined(TARGET_IS_MSP432P4XX) || defined(__MSP432P401R__)
#define CS_PLATFORM CS_P_MSP432
#define CS_PLATFORM CS_P_MSP432
#elif defined(cc3200)
#elif defined(cc3200)
#define CS_PLATFORM CS_P_CC3200
#define CS_PLATFORM CS_P_CC3200
...
@@ -71,6 +71,8 @@
...
@@ -71,6 +71,8 @@
#define CS_PLATFORM CS_P_WINDOWS
#define CS_PLATFORM CS_P_WINDOWS
#elif defined(__MBED__)
#elif defined(__MBED__)
#define CS_PLATFORM CS_P_MBED
#define CS_PLATFORM CS_P_MBED
#elif defined(__USE_LPCOPEN)
#define CS_PLATFORM CS_P_NXP_LPC
#elif defined(FRDM_K64F) || defined(FREEDOM)
#elif defined(FRDM_K64F) || defined(FREEDOM)
#define CS_PLATFORM CS_P_NXP_KINETIS
#define CS_PLATFORM CS_P_NXP_KINETIS
#elif defined(PIC32)
#elif defined(PIC32)
...
@@ -96,6 +98,7 @@
...
@@ -96,6 +98,7 @@
/* Amalgamated: #include "common/platforms/platform_mbed.h" */
/* Amalgamated: #include "common/platforms/platform_mbed.h" */
/* Amalgamated: #include "common/platforms/platform_nrf52.h" */
/* Amalgamated: #include "common/platforms/platform_nrf52.h" */
/* Amalgamated: #include "common/platforms/platform_wince.h" */
/* Amalgamated: #include "common/platforms/platform_wince.h" */
/* Amalgamated: #include "common/platforms/platform_nxp_lpc.h" */
/* Amalgamated: #include "common/platforms/platform_nxp_kinetis.h" */
/* Amalgamated: #include "common/platforms/platform_nxp_kinetis.h" */
/* Amalgamated: #include "common/platforms/platform_pic32_harmony.h" */
/* Amalgamated: #include "common/platforms/platform_pic32_harmony.h" */
...
@@ -871,6 +874,10 @@ int gettimeofday(struct timeval *tp, void *tzp);
...
@@ -871,6 +874,10 @@ int gettimeofday(struct timeval *tp, void *tzp);
#define INT64_FMT PRId64
#define INT64_FMT PRId64
#define SIZE_T_FMT "u"
#define SIZE_T_FMT "u"
/*
* ARM C Compiler doesn't have strdup, so we provide it
*/
#define CS_ENABLE_STRDUP defined(__ARMCC_VERSION)
#endif
/* CS_PLATFORM == CS_P_NRF51 */
#endif
/* CS_PLATFORM == CS_P_NRF51 */
#endif
/* CS_COMMON_PLATFORMS_PLATFORM_NRF51_H_ */
#endif
/* CS_COMMON_PLATFORMS_PLATFORM_NRF51_H_ */
...
@@ -911,6 +918,11 @@ int gettimeofday(struct timeval *tp, void *tzp);
...
@@ -911,6 +918,11 @@ int gettimeofday(struct timeval *tp, void *tzp);
#define INT64_FMT PRId64
#define INT64_FMT PRId64
#define SIZE_T_FMT "u"
#define SIZE_T_FMT "u"
/*
* ARM C Compiler doesn't have strdup, so we provide it
*/
#define CS_ENABLE_STRDUP defined(__ARMCC_VERSION)
#endif
/* CS_PLATFORM == CS_P_NRF52 */
#endif
/* CS_PLATFORM == CS_P_NRF52 */
#endif
/* CS_COMMON_PLATFORMS_PLATFORM_NRF52_H_ */
#endif
/* CS_COMMON_PLATFORMS_PLATFORM_NRF52_H_ */
#ifdef MG_MODULE_LINES
#ifdef MG_MODULE_LINES
...
@@ -1203,6 +1215,61 @@ const char *strerror();
...
@@ -1203,6 +1215,61 @@ const char *strerror();
#endif
/* CS_PLATFORM == CS_P_WINCE */
#endif
/* CS_PLATFORM == CS_P_WINCE */
#endif
/* CS_COMMON_PLATFORMS_PLATFORM_WINCE_H_ */
#endif
/* CS_COMMON_PLATFORMS_PLATFORM_WINCE_H_ */
#ifdef MG_MODULE_LINES
#ifdef MG_MODULE_LINES
#line 1 "common/platforms/platform_nxp_lpc.h"
#endif
/*
* Copyright (c) 2014-2016 Cesanta Software Limited
* All rights reserved
*/
#ifndef CS_COMMON_PLATFORMS_PLATFORM_NXP_LPC_H_
#define CS_COMMON_PLATFORMS_PLATFORM_NXP_LPC_H_
#if CS_PLATFORM == CS_P_NXP_LPC
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#define SIZE_T_FMT "u"
typedef
struct
stat
cs_stat_t
;
#define INT64_FMT "lld"
#define INT64_X_FMT "llx"
#define __cdecl
#define MG_LWIP 1
#define MG_NET_IF MG_NET_IF_LWIP_LOW_LEVEL
/*
* LPCXpress comes with 3 C library implementations: Newlib, NewlibNano and Redlib.
* See https://community.nxp.com/message/630860 for more details.
*
* Redlib is the default and lacks certain things, so we provide them.
*/
#ifdef __REDLIB_INTERFACE_VERSION__
/* Let LWIP define timeval for us. */
#define LWIP_TIMEVAL_PRIVATE 1
#define va_copy(d, s) __builtin_va_copy(d, s)
#define CS_ENABLE_TO64 1
#define to64(x) cs_to64(x)
#define CS_ENABLE_STRDUP 1
#else
#include <sys/time.h>
#define LWIP_TIMEVAL_PRIVATE 0
#define to64(x) strtoll(x, NULL, 10)
#endif
#endif
/* CS_PLATFORM == CS_P_NXP_LPC */
#endif
/* CS_COMMON_PLATFORMS_PLATFORM_NXP_LPC_H_ */
#ifdef MG_MODULE_LINES
#line 1 "common/platforms/platform_nxp_kinetis.h"
#line 1 "common/platforms/platform_nxp_kinetis.h"
#endif
#endif
/*
/*
...
@@ -1634,6 +1701,14 @@ int cs_base64_decode(const unsigned char *s, int len, char *dst);
...
@@ -1634,6 +1701,14 @@ int cs_base64_decode(const unsigned char *s, int len, char *dst);
#include <stdarg.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdlib.h>
#ifndef CS_ENABLE_STRDUP
#define CS_ENABLE_STRDUP 0
#endif
#ifndef CS_ENABLE_TO64
#define CS_ENABLE_TO64 0
#endif
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
#endif
...
@@ -1660,11 +1735,16 @@ void cs_to_hex(char *to, const unsigned char *p, size_t len);
...
@@ -1660,11 +1735,16 @@ void cs_to_hex(char *to, const unsigned char *p, size_t len);
*/
*/
void
cs_from_hex
(
char
*
to
,
const
char
*
p
,
size_t
len
);
void
cs_from_hex
(
char
*
to
,
const
char
*
p
,
size_t
len
);
#if CS_ENABLE_STRDUP
char
*
strdup
(
const
char
*
src
);
#endif
#if CS_ENABLE_TO64
#include <stdint.h>
/*
/*
*
ARM C Compiler doesn't have strdup, so we provide it
*
Simple string -> int64 conversion routine.
*/
*/
#if defined(__ARMCC_VERSION)
int64_t
cs_to64
(
const
char
*
s
);
char
*
strdup
(
const
char
*
src
);
#endif
#endif
#ifdef __cplusplus
#ifdef __cplusplus
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment