LingaoM commented on code in PR #20108: URL: https://github.com/apache/nuttx/pull/20108#discussion_r3986732326
########## arch/sim/src/Makefile: ########## @@ -134,6 +134,40 @@ endif HOSTSRCS = sim_hostirq.c sim_hostmemory.c sim_hostmisc.c sim_hosttime.c sim_hostuart.c HOSTSRCS += sim_hostfs.c sim_errno.c +ifeq ($(CONFIG_SIM_BSIM_TIME),y) + HOSTSRCS += sim_bsimtime.c + BSIM_SKIP_PATH_CHECK_GOALS := clean distclean clean_context context + BSIM_CHECK_PATHS := + ifeq ($(MAKECMDGOALS),) + BSIM_CHECK_PATHS := y + else ifneq ($(filter-out $(BSIM_SKIP_PATH_CHECK_GOALS),$(MAKECMDGOALS)),) + BSIM_CHECK_PATHS := y + endif + ifeq ($(BSIM_CHECK_PATHS),y) Review Comment: That true, thanks. ########## arch/sim/src/sim/posix/sim_bsimtime.c: ########## @@ -0,0 +1,130 @@ +/**************************************************************************** + * arch/sim/src/sim/posix/sim_bsimtime.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <errno.h> +#include <stdbool.h> +#include <stdint.h> +#include <stdlib.h> + +#include "bs_pc_base.h" +#include "sim_internal.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define NSEC_PER_BSIM_USEC 1000ull + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static pb_dev_state_t g_bsim_dev; +static uint64_t g_now_nsec; +static bool g_connected; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static void bsimtime_disconnect_atexit(void) +{ + host_bsimtime_disconnect(); +} + +static void bsimtime_fail(const char *what) +{ + (void)what; + host_abort(1); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int host_bsimtime_init(const char *sim_id, const char *phy_id, + unsigned int dev_nbr) +{ + if (sim_id == NULL || phy_id == NULL) + { + errno = EINVAL; Review Comment: Done. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
