arch/sim: Change sim_host_ prefix to host_
to align with the other similar function style Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
4e24ef23f4
commit
79c8b7d3fd
@ -63,7 +63,7 @@ struct sockaddr_hci
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_bthcisock_avail
|
||||
* Name: host_bthcisock_avail
|
||||
*
|
||||
* Description:
|
||||
* Monitor the host user channel to see if I/O is possible on socket.
|
||||
@ -76,7 +76,7 @@ struct sockaddr_hci
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int sim_host_bthcisock_avail(int fd)
|
||||
int host_bthcisock_avail(int fd)
|
||||
{
|
||||
struct timeval tv;
|
||||
fd_set fdset;
|
||||
@ -100,7 +100,7 @@ int sim_host_bthcisock_avail(int fd)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_bthcisock_send
|
||||
* Name: host_bthcisock_send
|
||||
*
|
||||
* Description:
|
||||
* Send a Bluetooth packet out via the host user socket.
|
||||
@ -116,7 +116,7 @@ int sim_host_bthcisock_avail(int fd)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int sim_host_bthcisock_send(int fd, const void *data, size_t len)
|
||||
int host_bthcisock_send(int fd, const void *data, size_t len)
|
||||
{
|
||||
while (write(fd, data, len) < 0)
|
||||
{
|
||||
@ -132,7 +132,7 @@ int sim_host_bthcisock_send(int fd, const void *data, size_t len)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_bthcisock_receive
|
||||
* Name: host_bthcisock_receive
|
||||
*
|
||||
* Description:
|
||||
* Read from the Host HCI socket interface.
|
||||
@ -148,7 +148,7 @@ int sim_host_bthcisock_send(int fd, const void *data, size_t len)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int sim_host_bthcisock_receive(int fd, void *data, size_t len)
|
||||
int host_bthcisock_receive(int fd, void *data, size_t len)
|
||||
{
|
||||
int err;
|
||||
|
||||
@ -167,7 +167,7 @@ int sim_host_bthcisock_receive(int fd, void *data, size_t len)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_bthcisock_open
|
||||
* Name: host_bthcisock_open
|
||||
*
|
||||
* Description:
|
||||
* Open a User Channel HCI socket on the Host for the given device.
|
||||
@ -183,7 +183,7 @@ int sim_host_bthcisock_receive(int fd, void *data, size_t len)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int sim_host_bthcisock_open(int dev_idx)
|
||||
int host_bthcisock_open(int dev_idx)
|
||||
{
|
||||
int err;
|
||||
struct sockaddr_hci addr;
|
||||
@ -218,7 +218,7 @@ int sim_host_bthcisock_open(int dev_idx)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_bthcisock_close
|
||||
* Name: host_bthcisock_close
|
||||
*
|
||||
* Description:
|
||||
* Close a User Channel HCI socket on the Host for the given device idx.
|
||||
@ -232,7 +232,7 @@ int sim_host_bthcisock_open(int dev_idx)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int sim_host_bthcisock_close(int fd)
|
||||
int host_bthcisock_close(int fd)
|
||||
{
|
||||
return close(fd);
|
||||
}
|
||||
|
@ -52,14 +52,14 @@ static atomic_int g_uordblks;
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_allocheap
|
||||
* Name: host_allocheap
|
||||
*
|
||||
* Description:
|
||||
* Allocate executable memory for heap.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void *sim_host_allocheap(size_t sz)
|
||||
void *host_allocheap(size_t sz)
|
||||
{
|
||||
void *p;
|
||||
|
||||
@ -81,7 +81,7 @@ void *sim_host_allocheap(size_t sz)
|
||||
return p;
|
||||
}
|
||||
|
||||
void *sim_host_allocshmem(const char *name, size_t size, int master)
|
||||
void *host_allocshmem(const char *name, size_t size, int master)
|
||||
{
|
||||
void *mem;
|
||||
int oflag;
|
||||
@ -124,12 +124,12 @@ void *sim_host_allocshmem(const char *name, size_t size, int master)
|
||||
return mem;
|
||||
}
|
||||
|
||||
void sim_host_freeshmem(void *mem)
|
||||
void host_freeshmem(void *mem)
|
||||
{
|
||||
munmap(mem, 0);
|
||||
}
|
||||
|
||||
size_t sim_host_mallocsize(void *mem)
|
||||
size_t host_mallocsize(void *mem)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
return malloc_size(mem);
|
||||
@ -138,7 +138,7 @@ size_t sim_host_mallocsize(void *mem)
|
||||
#endif
|
||||
}
|
||||
|
||||
void *sim_host_memalign(size_t alignment, size_t size)
|
||||
void *host_memalign(size_t alignment, size_t size)
|
||||
{
|
||||
void *p;
|
||||
int error;
|
||||
@ -149,14 +149,14 @@ void *sim_host_memalign(size_t alignment, size_t size)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size = sim_host_mallocsize(p);
|
||||
size = host_mallocsize(p);
|
||||
g_aordblks += 1;
|
||||
g_uordblks += size;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void sim_host_free(void *mem)
|
||||
void host_free(void *mem)
|
||||
{
|
||||
size_t size;
|
||||
|
||||
@ -165,42 +165,42 @@ void sim_host_free(void *mem)
|
||||
return;
|
||||
}
|
||||
|
||||
size = sim_host_mallocsize(mem);
|
||||
size = host_mallocsize(mem);
|
||||
g_aordblks -= 1;
|
||||
g_uordblks -= size;
|
||||
free(mem);
|
||||
}
|
||||
|
||||
void *sim_host_realloc(void *oldmem, size_t size)
|
||||
void *host_realloc(void *oldmem, size_t size)
|
||||
{
|
||||
size_t oldsize;
|
||||
void *mem;
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
sim_host_free(oldmem);
|
||||
host_free(oldmem);
|
||||
return NULL;
|
||||
}
|
||||
else if (oldmem == NULL)
|
||||
{
|
||||
return sim_host_memalign(sizeof(void *), size);
|
||||
return host_memalign(sizeof(void *), size);
|
||||
}
|
||||
|
||||
oldsize = sim_host_mallocsize(oldmem);
|
||||
oldsize = host_mallocsize(oldmem);
|
||||
mem = realloc(oldmem, size);
|
||||
if (mem == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size = sim_host_mallocsize(mem);
|
||||
size = host_mallocsize(mem);
|
||||
g_uordblks -= oldsize;
|
||||
g_uordblks += size;
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
void sim_host_mallinfo(int *aordblks, int *uordblks)
|
||||
void host_mallinfo(int *aordblks, int *uordblks)
|
||||
{
|
||||
*aordblks = g_aordblks;
|
||||
*uordblks = g_uordblks;
|
||||
|
@ -39,7 +39,7 @@ void __gcov_dump(void);
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_abort
|
||||
* Name: host_abort
|
||||
*
|
||||
* Description:
|
||||
* Abort the simulation
|
||||
@ -48,7 +48,7 @@ void __gcov_dump(void);
|
||||
* status - Exit status to set
|
||||
****************************************************************************/
|
||||
|
||||
void sim_host_abort(int status)
|
||||
void host_abort(int status)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_COVERAGE
|
||||
/* Dump gcov data. */
|
||||
@ -61,7 +61,7 @@ void sim_host_abort(int status)
|
||||
exit(status);
|
||||
}
|
||||
|
||||
int sim_host_backtrace(void** array, int size)
|
||||
int host_backtrace(void** array, int size)
|
||||
{
|
||||
#ifdef CONFIG_WINDOWS_CYGWIN
|
||||
return 0;
|
||||
|
@ -99,12 +99,12 @@ static void *sim_idle_trampoline(void *arg)
|
||||
|
||||
pthread_mutex_unlock(&cpuinfo->cpu_init_lock);
|
||||
|
||||
/* sim_host_cpu_started() is logically a part of this function but
|
||||
/* host_cpu_started() is logically a part of this function but
|
||||
* needs to be inserted in the path because in needs to access NuttX
|
||||
* domain definition.
|
||||
*/
|
||||
|
||||
sim_host_cpu_started();
|
||||
host_cpu_started();
|
||||
|
||||
/* The idle Loop */
|
||||
|
||||
@ -113,7 +113,7 @@ static void *sim_idle_trampoline(void *arg)
|
||||
/* Wait a bit so that the timing is close to the correct rate. */
|
||||
|
||||
now += 1000 * CONFIG_USEC_PER_TICK;
|
||||
sim_host_sleepuntil(now);
|
||||
host_sleepuntil(now);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -124,7 +124,7 @@ static void *sim_idle_trampoline(void *arg)
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_cpu0_start
|
||||
* Name: host_cpu0_start
|
||||
*
|
||||
* Description:
|
||||
* Create the pthread-specific data key and set the indication of CPU0
|
||||
@ -138,7 +138,7 @@ static void *sim_idle_trampoline(void *arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void sim_host_cpu0_start(void)
|
||||
void host_cpu0_start(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -210,7 +210,7 @@ int up_cpu_index(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int sim_host_cpu_start(int cpu, void *stack, size_t size)
|
||||
int host_cpu_start(int cpu, void *stack, size_t size)
|
||||
{
|
||||
struct sim_cpuinfo_s cpuinfo;
|
||||
pthread_attr_t attr;
|
||||
@ -256,10 +256,10 @@ errout_with_cond:
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_send_ipi(int cpu)
|
||||
* Name: host_send_ipi(int cpu)
|
||||
****************************************************************************/
|
||||
|
||||
void sim_host_send_ipi(int cpu)
|
||||
void host_send_ipi(int cpu)
|
||||
{
|
||||
pthread_kill(g_cpu_thread[cpu], SIGUSR1);
|
||||
}
|
||||
|
@ -37,10 +37,10 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_gettime
|
||||
* Name: host_gettime
|
||||
****************************************************************************/
|
||||
|
||||
uint64_t sim_host_gettime(bool rtc)
|
||||
uint64_t host_gettime(bool rtc)
|
||||
{
|
||||
static uint64_t start;
|
||||
struct timespec tp;
|
||||
@ -63,23 +63,23 @@ uint64_t sim_host_gettime(bool rtc)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_sleep
|
||||
* Name: host_sleep
|
||||
****************************************************************************/
|
||||
|
||||
void sim_host_sleep(uint64_t nsec)
|
||||
void host_sleep(uint64_t nsec)
|
||||
{
|
||||
usleep((nsec + 999) / 1000);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_sleepuntil
|
||||
* Name: host_sleepuntil
|
||||
****************************************************************************/
|
||||
|
||||
void sim_host_sleepuntil(uint64_t nsec)
|
||||
void host_sleepuntil(uint64_t nsec)
|
||||
{
|
||||
uint64_t now;
|
||||
|
||||
now = sim_host_gettime(false);
|
||||
now = host_gettime(false);
|
||||
if (nsec > now + 1000)
|
||||
{
|
||||
usleep((nsec - now) / 1000);
|
||||
@ -87,7 +87,7 @@ void sim_host_sleepuntil(uint64_t nsec)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_settimer
|
||||
* Name: host_settimer
|
||||
*
|
||||
* Description:
|
||||
* Set up a timer to send periodic signals.
|
||||
@ -100,7 +100,7 @@ void sim_host_sleepuntil(uint64_t nsec)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int sim_host_settimer(int *irq)
|
||||
int host_settimer(int *irq)
|
||||
{
|
||||
struct itimerval it;
|
||||
|
||||
|
@ -123,6 +123,6 @@ void up_assert(const char *filename, int lineno)
|
||||
{
|
||||
/* Exit the simulation */
|
||||
|
||||
sim_host_abort(EXIT_FAILURE);
|
||||
host_abort(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ int up_backtrace(struct tcb_s *tcb, void **buffer, int size, int skip)
|
||||
|
||||
if (tcb == running_task())
|
||||
{
|
||||
ret = sim_host_backtrace(buf, skip + size);
|
||||
ret = host_backtrace(buf, skip + size);
|
||||
}
|
||||
|
||||
if (ret <= skip)
|
||||
|
@ -110,7 +110,7 @@ static int bthcisock_send(struct bt_driver_s *drv,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = sim_host_bthcisock_send(dev->fd, hdr, len + H4_HEADER_SIZE);
|
||||
ret = host_bthcisock_send(dev->fd, hdr, len + H4_HEADER_SIZE);
|
||||
|
||||
return ret < 0 ? ret : len;
|
||||
}
|
||||
@ -119,7 +119,7 @@ static void bthcisock_close(struct bt_driver_s *drv)
|
||||
{
|
||||
struct bthcisock_s *dev = (struct bthcisock_s *)drv;
|
||||
|
||||
sim_host_bthcisock_close(dev->fd);
|
||||
host_bthcisock_close(dev->fd);
|
||||
dev->fd = -1;
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ static int bthcisock_receive(struct bt_driver_s *drv)
|
||||
enum bt_buf_type_e type;
|
||||
int ret;
|
||||
|
||||
ret = sim_host_bthcisock_receive(dev->fd, data, sizeof(data));
|
||||
ret = host_bthcisock_receive(dev->fd, data, sizeof(data));
|
||||
if (ret <= 0)
|
||||
{
|
||||
return ret;
|
||||
@ -163,7 +163,7 @@ static int bthcisock_open(struct bt_driver_s *drv)
|
||||
struct bthcisock_s *dev = (struct bthcisock_s *)drv;
|
||||
int fd;
|
||||
|
||||
fd = sim_host_bthcisock_open(dev->id);
|
||||
fd = host_bthcisock_open(dev->id);
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
@ -317,7 +317,7 @@ int sim_bthcisock_loop(void)
|
||||
for (entry = sq_peek(&g_bthcisock_list); entry; entry = sq_next(entry))
|
||||
{
|
||||
dev = container_of(entry, struct bthcisock_s, link);
|
||||
if (sim_host_bthcisock_avail(dev->fd))
|
||||
if (host_bthcisock_avail(dev->fd))
|
||||
{
|
||||
bthcisock_receive(&dev->drv);
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ int main(int argc, char **argv, char **envp)
|
||||
#ifdef CONFIG_SMP
|
||||
/* Start the CPU0 emulation. This should not return. */
|
||||
|
||||
sim_host_cpu0_start();
|
||||
host_cpu0_start();
|
||||
#endif
|
||||
/* Start the NuttX emulation. This should not return. */
|
||||
|
||||
@ -154,7 +154,7 @@ int board_power_off(int status)
|
||||
{
|
||||
/* Abort simulator */
|
||||
|
||||
sim_host_abort(status);
|
||||
host_abort(status);
|
||||
|
||||
/* Does not really return */
|
||||
|
||||
|
@ -141,7 +141,7 @@ struct mm_heap_s *mm_initialize(const char *name,
|
||||
{
|
||||
struct mm_heap_s *heap;
|
||||
|
||||
heap = sim_host_memalign(sizeof(void *), sizeof(*heap));
|
||||
heap = host_memalign(sizeof(void *), sizeof(*heap));
|
||||
DEBUGASSERT(heap);
|
||||
|
||||
memset(heap, 0, sizeof(struct mm_heap_s));
|
||||
@ -228,7 +228,7 @@ void mm_free(struct mm_heap_s *heap, void *mem)
|
||||
}
|
||||
else
|
||||
{
|
||||
sim_host_free(mem);
|
||||
host_free(mem);
|
||||
}
|
||||
}
|
||||
|
||||
@ -259,7 +259,7 @@ void *mm_realloc(struct mm_heap_s *heap, void *oldmem,
|
||||
size_t size)
|
||||
{
|
||||
mm_free_delaylist(heap);
|
||||
return sim_host_realloc(oldmem, size);
|
||||
return host_realloc(oldmem, size);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -320,7 +320,7 @@ void *mm_memalign(struct mm_heap_s *heap, size_t alignment,
|
||||
size_t size)
|
||||
{
|
||||
mm_free_delaylist(heap);
|
||||
return sim_host_memalign(alignment, size);
|
||||
return host_memalign(alignment, size);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -384,7 +384,7 @@ void mm_extend(struct mm_heap_s *heap, void *mem, size_t size,
|
||||
int mm_mallinfo(struct mm_heap_s *heap, struct mallinfo *info)
|
||||
{
|
||||
memset(info, 0, sizeof(struct mallinfo));
|
||||
sim_host_mallinfo(&info->aordblks, &info->uordblks);
|
||||
host_mallinfo(&info->aordblks, &info->uordblks);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -422,7 +422,7 @@ void mm_checkcorruption(struct mm_heap_s *heap)
|
||||
|
||||
size_t mm_malloc_size(void *mem)
|
||||
{
|
||||
return sim_host_mallocsize(mem);
|
||||
return host_mallocsize(mem);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -455,7 +455,7 @@ void up_allocate_heap(void **heap_start, size_t *heap_size)
|
||||
* ARCH_HAVE_TEXT_HEAP mechanism can be an alternative.
|
||||
*/
|
||||
|
||||
uint8_t *sim_heap = sim_host_allocheap(SIM_HEAP_SIZE);
|
||||
uint8_t *sim_heap = host_allocheap(SIM_HEAP_SIZE);
|
||||
|
||||
*heap_start = sim_heap;
|
||||
*heap_size = SIM_HEAP_SIZE;
|
||||
|
@ -32,10 +32,10 @@
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
int sim_host_bthcisock_open(int dev_idx);
|
||||
int sim_host_bthcisock_send(int fd, const void *data, size_t len);
|
||||
int sim_host_bthcisock_receive(int fd, void *data, size_t len);
|
||||
int sim_host_bthcisock_avail(int fd);
|
||||
int sim_host_bthcisock_close(int fd);
|
||||
int host_bthcisock_open(int dev_idx);
|
||||
int host_bthcisock_send(int fd, const void *data, size_t len);
|
||||
int host_bthcisock_receive(int fd, void *data, size_t len);
|
||||
int host_bthcisock_avail(int fd);
|
||||
int host_bthcisock_close(int fd);
|
||||
|
||||
#endif /* __ARCH_SIM_SRC_SIM_HOSTHCISOCKET_H */
|
||||
|
@ -149,27 +149,27 @@ void *sim_doirq(int irq, void *regs);
|
||||
|
||||
/* sim_hostmisc.c ***********************************************************/
|
||||
|
||||
void sim_host_abort(int status);
|
||||
int sim_host_backtrace(void** array, int size);
|
||||
void host_abort(int status);
|
||||
int host_backtrace(void** array, int size);
|
||||
|
||||
/* sim_hostmemory.c *********************************************************/
|
||||
|
||||
void *sim_host_allocheap(size_t sz);
|
||||
void *sim_host_allocshmem(const char *name, size_t size, int master);
|
||||
void sim_host_freeshmem(void *mem);
|
||||
void *host_allocheap(size_t sz);
|
||||
void *host_allocshmem(const char *name, size_t size, int master);
|
||||
void host_freeshmem(void *mem);
|
||||
|
||||
size_t sim_host_mallocsize(void *mem);
|
||||
void *sim_host_memalign(size_t alignment, size_t size);
|
||||
void sim_host_free(void *mem);
|
||||
void *sim_host_realloc(void *oldmem, size_t size);
|
||||
void sim_host_mallinfo(int *aordblks, int *uordblks);
|
||||
size_t host_mallocsize(void *mem);
|
||||
void *host_memalign(size_t alignment, size_t size);
|
||||
void host_free(void *mem);
|
||||
void *host_realloc(void *oldmem, size_t size);
|
||||
void host_mallinfo(int *aordblks, int *uordblks);
|
||||
|
||||
/* sim_hosttime.c ***********************************************************/
|
||||
|
||||
uint64_t sim_host_gettime(bool rtc);
|
||||
void sim_host_sleep(uint64_t nsec);
|
||||
void sim_host_sleepuntil(uint64_t nsec);
|
||||
int sim_host_settimer(int *irq);
|
||||
uint64_t host_gettime(bool rtc);
|
||||
void host_sleep(uint64_t nsec);
|
||||
void host_sleepuntil(uint64_t nsec);
|
||||
int host_settimer(int *irq);
|
||||
|
||||
/* sim_sigdeliver.c *********************************************************/
|
||||
|
||||
@ -178,15 +178,15 @@ void sim_sigdeliver(void);
|
||||
/* sim_hostsmp.c ************************************************************/
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
void sim_host_cpu0_start(void);
|
||||
int sim_host_cpu_start(int cpu, void *stack, size_t size);
|
||||
void sim_host_send_ipi(int cpu);
|
||||
void host_cpu0_start(void);
|
||||
int host_cpu_start(int cpu, void *stack, size_t size);
|
||||
void host_send_ipi(int cpu);
|
||||
#endif
|
||||
|
||||
/* sim_smpsignal.c **********************************************************/
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
void sim_host_cpu_started(void);
|
||||
void host_cpu_started(void);
|
||||
int sim_init_ipi(int irq);
|
||||
#endif
|
||||
|
||||
|
@ -114,7 +114,7 @@ static inline void sim_timer_current(struct timespec *ts)
|
||||
uint64_t nsec;
|
||||
time_t sec;
|
||||
|
||||
nsec = sim_host_gettime(false);
|
||||
nsec = host_gettime(false);
|
||||
sec = nsec / NSEC_PER_SEC;
|
||||
nsec -= sec * NSEC_PER_SEC;
|
||||
|
||||
@ -410,7 +410,7 @@ void up_timer_initialize(void)
|
||||
#ifdef CONFIG_SIM_WALLTIME_SIGNAL
|
||||
int host_alarm_irq;
|
||||
|
||||
sim_host_settimer(&host_alarm_irq);
|
||||
host_settimer(&host_alarm_irq);
|
||||
|
||||
/* Enable the alarm handler and attach the interrupt to the NuttX logic */
|
||||
|
||||
@ -442,7 +442,7 @@ void sim_timer_update(void)
|
||||
/* Wait a bit so that the timing is close to the correct rate. */
|
||||
|
||||
until += NSEC_PER_TICK;
|
||||
sim_host_sleepuntil(until);
|
||||
host_sleepuntil(until);
|
||||
|
||||
#ifdef CONFIG_SIM_WALLTIME_SLEEP
|
||||
sim_timer_update_internal();
|
||||
|
@ -91,9 +91,9 @@ sim_rptun_get_resource(struct rptun_dev_s *dev)
|
||||
|
||||
while (priv->shmem == NULL)
|
||||
{
|
||||
priv->shmem = sim_host_allocshmem(priv->shmemname,
|
||||
sizeof(*priv->shmem),
|
||||
priv->master);
|
||||
priv->shmem = host_allocshmem(priv->shmemname,
|
||||
sizeof(*priv->shmem),
|
||||
priv->master);
|
||||
usleep(1000);
|
||||
|
||||
/* Master isn't ready, sleep and try again */
|
||||
|
@ -69,7 +69,7 @@ static int sim_rtc_rdtime(struct rtc_lowerhalf_s *lower,
|
||||
uint64_t nsec;
|
||||
time_t sec;
|
||||
|
||||
nsec = sim_host_gettime(true);
|
||||
nsec = host_gettime(true);
|
||||
nsec += g_sim_delta;
|
||||
sec = nsec / NSEC_PER_SEC;
|
||||
nsec -= sec * NSEC_PER_SEC;
|
||||
@ -86,7 +86,7 @@ static int sim_rtc_settime(struct rtc_lowerhalf_s *lower,
|
||||
g_sim_delta = timegm((struct tm *)rtctime);
|
||||
g_sim_delta *= NSEC_PER_SEC;
|
||||
g_sim_delta += rtctime->tm_nsec;
|
||||
g_sim_delta -= sim_host_gettime(true);
|
||||
g_sim_delta -= host_gettime(true);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -214,14 +214,14 @@ int up_cpu_paused(int cpu)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_cpu_started
|
||||
* Name: host_cpu_started
|
||||
*
|
||||
* Description:
|
||||
* Notify the current cpu start successfully.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void sim_host_cpu_started(void)
|
||||
void host_cpu_started(void)
|
||||
{
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||
struct tcb_s *tcb = this_task();
|
||||
@ -273,7 +273,7 @@ int up_cpu_start(int cpu)
|
||||
sched_note_cpu_start(this_task(), cpu);
|
||||
#endif
|
||||
|
||||
return sim_host_cpu_start(cpu, tcb->stack_base_ptr, tcb->adj_stack_size);
|
||||
return host_cpu_start(cpu, tcb->stack_base_ptr, tcb->adj_stack_size);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -339,7 +339,7 @@ int up_cpu_pause(int cpu)
|
||||
|
||||
/* Generate IRQ for CPU(cpu) */
|
||||
|
||||
sim_host_send_ipi(cpu);
|
||||
host_send_ipi(cpu);
|
||||
|
||||
/* Wait for the other CPU to unlock g_cpu_paused meaning that
|
||||
* it is fully paused and ready for up_cpu_resume();
|
||||
|
@ -29,19 +29,19 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_allocheap
|
||||
* Name: host_allocheap
|
||||
*
|
||||
* Description:
|
||||
* Allocate executable memory for heap.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void *sim_host_allocheap(size_t sz)
|
||||
void *host_allocheap(size_t sz)
|
||||
{
|
||||
return _aligned_malloc(sz, 8);
|
||||
}
|
||||
|
||||
void *sim_host_allocshmem(const char *name, size_t size, int master)
|
||||
void *host_allocshmem(const char *name, size_t size, int master)
|
||||
{
|
||||
HANDLE handle;
|
||||
void *mem;
|
||||
@ -59,31 +59,31 @@ void *sim_host_allocshmem(const char *name, size_t size, int master)
|
||||
return mem;
|
||||
}
|
||||
|
||||
void sim_host_freeshmem(void *mem)
|
||||
void host_freeshmem(void *mem)
|
||||
{
|
||||
UnmapViewOfFile(mem);
|
||||
}
|
||||
|
||||
size_t sim_host_mallocsize(void *mem)
|
||||
size_t host_mallocsize(void *mem)
|
||||
{
|
||||
return _msize(mem);
|
||||
}
|
||||
|
||||
void *sim_host_memalign(size_t alignment, size_t size)
|
||||
void *host_memalign(size_t alignment, size_t size)
|
||||
{
|
||||
return _aligned_malloc(size, alignment);
|
||||
}
|
||||
|
||||
void sim_host_free(void *mem)
|
||||
void host_free(void *mem)
|
||||
{
|
||||
_aligned_free(mem);
|
||||
}
|
||||
|
||||
void *sim_host_realloc(void *oldmem, size_t size)
|
||||
void *host_realloc(void *oldmem, size_t size)
|
||||
{
|
||||
return _aligned_realloc(oldmem, size, 8);
|
||||
}
|
||||
|
||||
void sim_host_mallinfo(int *aordblks, int *uordblks)
|
||||
void host_mallinfo(int *aordblks, int *uordblks)
|
||||
{
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_abort
|
||||
* Name: host_abort
|
||||
*
|
||||
* Description:
|
||||
* Abort the simulation
|
||||
@ -38,12 +38,12 @@
|
||||
* status - Exit status to set
|
||||
****************************************************************************/
|
||||
|
||||
void sim_host_abort(int status)
|
||||
void host_abort(int status)
|
||||
{
|
||||
ExitProcess(status);
|
||||
}
|
||||
|
||||
int sim_host_backtrace(void** array, int size)
|
||||
int host_backtrace(void** array, int size)
|
||||
{
|
||||
return CaptureStackBackTrace(0, size, array, NULL);
|
||||
}
|
||||
|
@ -43,10 +43,10 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_gettime
|
||||
* Name: host_gettime
|
||||
****************************************************************************/
|
||||
|
||||
uint64_t sim_host_gettime(bool rtc)
|
||||
uint64_t host_gettime(bool rtc)
|
||||
{
|
||||
static LARGE_INTEGER start;
|
||||
LARGE_INTEGER counter;
|
||||
@ -75,10 +75,10 @@ uint64_t sim_host_gettime(bool rtc)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_sleep
|
||||
* Name: host_sleep
|
||||
****************************************************************************/
|
||||
|
||||
void sim_host_sleep(uint64_t nsec)
|
||||
void host_sleep(uint64_t nsec)
|
||||
{
|
||||
LARGE_INTEGER due;
|
||||
HANDLE timer;
|
||||
@ -99,22 +99,22 @@ void sim_host_sleep(uint64_t nsec)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_sleepuntil
|
||||
* Name: host_sleepuntil
|
||||
****************************************************************************/
|
||||
|
||||
void sim_host_sleepuntil(uint64_t nsec)
|
||||
void host_sleepuntil(uint64_t nsec)
|
||||
{
|
||||
uint64_t now;
|
||||
|
||||
now = sim_host_gettime(false);
|
||||
now = host_gettime(false);
|
||||
if (nsec > now)
|
||||
{
|
||||
sim_host_sleep(nsec - now);
|
||||
host_sleep(nsec - now);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_host_settimer
|
||||
* Name: host_settimer
|
||||
*
|
||||
* Description:
|
||||
* Set up a timer to send periodic signals.
|
||||
@ -127,7 +127,7 @@ void sim_host_sleepuntil(uint64_t nsec)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int sim_host_settimer(int *irq)
|
||||
int host_settimer(int *irq)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user