modem: hl7800: remove NEWLIB_LIBC dependency

Zephyr LIBC minimal has definitions for struct tm.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
This commit is contained in:
Ryan Erickson 2021-11-08 21:11:33 -06:00 committed by Carles Cufí
commit 270608139f
2 changed files with 2 additions and 19 deletions

View file

@ -332,7 +332,6 @@ static const struct mdm_control_pinconfig pinconfig[] = {
#define MDM_ADDR_FAM_MAX_LEN sizeof("IPV4V6")
#ifdef CONFIG_NEWLIB_LIBC
/* The ? can be a + or - */
static const char TIME_STRING_FORMAT[] = "\"yy/MM/dd,hh:mm:ss?zz\"";
#define TIME_STRING_DIGIT_STRLEN 2
@ -351,7 +350,6 @@ static const char TIME_STRING_FORMAT[] = "\"yy/MM/dd,hh:mm:ss?zz\"";
#define TM_SEC_RANGE 0, 60 /* leap second */
#define QUARTER_HOUR_RANGE 0, 96
#define SECONDS_PER_QUARTER_HOUR (15 * 60)
#endif
#define SEND_AT_CMD_ONCE_EXPECT_OK(c) \
do { \
@ -541,10 +539,8 @@ struct hl7800_iface_ctx {
enum mdm_hl7800_network_state network_state;
enum net_operator_status operator_status;
void (*event_callback)(enum mdm_hl7800_event event, void *event_data);
#ifdef CONFIG_NEWLIB_LIBC
struct tm local_time;
int32_t local_time_offset;
#endif
bool local_time_valid;
bool configured;
@ -588,10 +584,8 @@ static void generate_fota_state_event(void);
static void generate_fota_count_event(void);
#endif
#ifdef CONFIG_NEWLIB_LIBC
static bool convert_time_string_to_struct(struct tm *tm, int32_t *offset,
char *time_string);
#endif
#ifdef CONFIG_MODEM_HL7800_LOW_POWER_MODE
static bool is_cmd_ready(void)
@ -1039,7 +1033,6 @@ error:
return ret;
}
#ifdef CONFIG_NEWLIB_LIBC
int32_t mdm_hl7800_get_local_time(struct tm *tm, int32_t *offset)
{
int ret;
@ -1060,7 +1053,6 @@ int32_t mdm_hl7800_get_local_time(struct tm *tm, int32_t *offset)
hl7800_unlock();
return ret;
}
#endif
int32_t mdm_hl7800_get_operator_index(void)
{
@ -3218,7 +3210,6 @@ done:
return true;
}
#ifdef CONFIG_NEWLIB_LIBC
/* Handler: +CCLK: "yy/MM/dd,hh:mm:ss±zz" */
static bool on_cmd_rtc_query(struct net_buf **buf, uint16_t len)
{
@ -3238,7 +3229,7 @@ static bool on_cmd_rtc_query(struct net_buf **buf, uint16_t len)
goto done;
}
if (len != str_len) {
LOG_WRN("Unexpected length for RTC string %d (expected:%d)",
LOG_WRN("Unexpected length for RTC string %d (expected:%zu)",
len, str_len);
} else {
net_buf_linearize(rtc_string, str_len, *buf, 0, str_len);
@ -3321,7 +3312,6 @@ static bool convert_time_string_to_struct(struct tm *tm, int32_t *offset,
}
return (fc == 0);
}
#endif
/* Handler: +CEREG: <stat>[,[<lac>],[<ci>],[<AcT>]
* [,[<cause_type>],[<reject_cause>] [,[<Active-Time>],[<Periodic-TAU>]]]]
@ -4187,9 +4177,7 @@ static void hl7800_rx(void)
CMD_HANDLER("AT+CIMI", atcmdinfo_imsi),
CMD_HANDLER("+CFUN: ", modem_functionality),
CMD_HANDLER("%MEAS: ", survey_status),
#ifdef CONFIG_NEWLIB_LIBC
CMD_HANDLER("+CCLK: ", rtc_query),
#endif
/* UNSOLICITED modem information */
/* mobile startup report */

View file

@ -17,9 +17,7 @@ extern "C" {
#include <zephyr/types.h>
#ifdef CONFIG_NEWLIB_LIBC
#include <time.h>
#endif
/* The size includes the NUL character, the strlen doesn't */
#define MDM_HL7800_REVISION_MAX_SIZE 29
@ -355,17 +353,14 @@ void mdm_hl7800_register_event_callback(mdm_hl7800_event_callback_t cb);
*/
void mdm_hl7800_generate_status_events(void);
#ifdef CONFIG_NEWLIB_LIBC
/**
* @brief Get the local time from the modem's real time clock.
*
* @param tm time structure
* @param offset The amount the local time is offset from GMT/UTC in seconds.
*
* @param 0 if successful
* @return int32_t 0 if successful
*/
int32_t mdm_hl7800_get_local_time(struct tm *tm, int32_t *offset);
#endif
#ifdef CONFIG_MODEM_HL7800_FW_UPDATE
/**