18#ifndef __WIN_GENERIC_H__
19#define __WIN_GENERIC_H__
25#undef __VSF_WIN_PUBLIC_CONST__
26#if defined(__VSF_ARCH_WIN_IMPLEMENT)
27# define __VSF_CLASS_IMPLEMENT__
28# define __VSF_WIN_PUBLIC_CONST__
30# define __VSF_WIN_PUBLIC_CONST__ const
41#ifndef __LITTLE_ENDIAN
42# define __LITTLE_ENDIAN 1
45# define __BIG_ENDIAN 0
48# define __BYTE_ORDER __LITTLE_ENDIAN
51#ifndef VSF_SYSTIMER_CFG_IMPL_MODE
52# define VSF_SYSTIMER_CFG_IMPL_MODE VSF_SYSTIMER_IMPL_REQUEST_RESPONSE
55#if defined(__CPU_X86__)
57# define VSF_ARCH_STACK_ALIGN_BIT 3
58#elif defined(__CPU_X64__)
60# define VSF_ARCH_STACK_ALIGN_BIT 4
64# define VSF_ARCH_SETJMP SetJumpUser
65# define VSF_ARCH_LONGJMP LongJumpUser
67#define VSF_ARCH_STACK_PAGE_SIZE 4096
68#define VSF_ARCH_STACK_GUARDIAN_SIZE 4096
69#ifndef VSF_ARCH_PROVIDE_HEAP
70# define VSF_ARCH_PROVIDE_HEAP ENABLED
72#define VSF_ARCH_PROVIDE_ARGU ENABLED
73#define VSF_ARCH_PROVIDE_EXE ENABLED
79#ifdef VSF_ARCH_LIMIT_NO_SET_STACK
80# define VSF_ARCH_PRI_NUM 1
81# define VSF_ARCH_SWI_NUM 0
85#ifndef VSF_ARCH_SWI_NUM
86# define VSF_ARCH_SWI_NUM 32
88#ifndef VSF_ARCH_PRI_NUM
89# define VSF_ARCH_PRI_NUM 64
93#define VSF_ARCH_SYSTIMER_FREQ (10 * 1000 * 1000)
105#ifndef VSF_ARCH_TRACE_FUNC
106# define VSF_ARCH_TRACE_FUNC(...) __vsf_arch_trace(0, __VA_ARGS__)
109#ifndef vsf_arch_trace
110# if VSF_ARCH_PRI_NUM == 1 && VSF_ARCH_SWI_NUM == 0
111# define vsf_arch_trace(__header, __color, ...)
113# define vsf_arch_trace(__header, __color, ...) \
115 vsf_arch_irq_thread_t *__irq_thread = \
116 __vsf_arch_get_cur_irq_thread(); \
117 __vsf_arch_trace_lock(); \
118 VSF_ARCH_TRACE_FUNC("%s[%s]: ", (__color), (__header)); \
119 if (__irq_thread != NULL) { \
120 VSF_ARCH_TRACE_FUNC("%s(%d) %lld ", \
121 __irq_thread->name, (int)__irq_thread->thread_id, \
122 __vsf_systimer_get()); \
125 VSF_ARCH_TRACE_FUNC(__VA_ARGS__); \
126 __vsf_arch_trace_unlock(); \
131#define __VSF_ARCH_PRI(__N, __UNUSED) \
132 VSF_ARCH_PRIO_##__N = (__N), \
133 vsf_arch_prio_##__N = (__N),
135#define vsf_arch_wakeup()
152#ifndef VSF_ARCH_SYSTIMER_TICK_T
153# define VSF_ARCH_SYSTIMER_TICK_T uint64_t
177#if VSF_ARCH_PRI_NUM == 1 && VSF_ARCH_SWI_NUM == 0
180# define VSF_ARCH_NO_DISABLE_INTERRUPT_BEFORE_SLEEP
185#if VSF_ARCH_PRI_NUM == 1 && VSF_ARCH_SWI_NUM == 0
216#undef __VSF_WIN_PUBLIC_CONST__
243#ifdef VSF_ARCH_LIMIT_NO_SET_STACK
252#ifndef VSF_ARCH_LIMIT_NO_SET_STACK
253static VSF_CAL_ALWAYS_INLINE
void vsf_arch_set_stack(
uintptr_t stack)
255#if defined(__CPU_X86__)
256 __asm__(
"movl %0, %%esp" : :
"r"(stack));
257#elif defined(__CPU_X64__)
258 __asm__(
"movq %0, %%rsp" : :
"r"(stack));
262static VSF_CAL_ALWAYS_INLINE
uintptr_t vsf_arch_get_stack(
void)
265#if defined(__CPU_X86__)
266 __asm__(
"movl %%esp, %0" :
"=r"(stack) :);
267#elif defined(__CPU_X64__)
268 __asm__(
"movq %%esp, %0" :
"=r"(stack) :);
vsf_err_t
Definition __type.h:42
Definition linux_generic.h:104
Definition linux_generic.h:122
vsf_arch_prio_t
Definition cortex_a_generic.h:88
uint64_t vsf_systimer_tick_t
Definition cortex_a_generic.h:73
vsf_err_t __vsf_arch_irq_restart(vsf_arch_irq_thread_t *irq_thread, vsf_arch_irq_request_t *request_pending)
Definition linux_generic.c:309
void __vsf_arch_irq_exit(vsf_arch_irq_thread_t *irq_thread)
Definition linux_generic.c:303
#define vsf_class(__name)
Definition ooc_class.h:48
uint32_t uintptr_t
Definition stdint.h:38
unsigned int uint_fast32_t
Definition stdint.h:27
Definition vsf_arch_without_thread_suspend_template.h:23
Definition vsf_list.h:888
uint32_t size
Definition vsf_memfs.h:50
uint8_t state
Definition vsf_msg_tree.h:247
#define VSF_MREPEAT(__COUNT, __MACRO, __PARAM)
Definition vsf_repeat_macro.h:51
@ VSF_ARCH_PRIO_INVALID
Definition win_generic.h:158
@ vsf_arch_prio_highest
Definition win_generic.h:161
@ vsf_arch_prio_invalid
Definition win_generic.h:159
char * VSF_WIN_LPSTR
Definition win_generic.h:144
#define __VSF_ARCH_PRI(__N, __UNUSED)
Definition win_generic.h:131
unsigned long * VSF_WIN_PULONG_PTR
Definition win_generic.h:148
unsigned char VSF_WIN_BYTE
Definition win_generic.h:143
unsigned long VSF_WIN_DWORD
Definition win_generic.h:141
void __vsf_arch_irq_set_background(vsf_arch_irq_thread_t *irq_thread)
Definition win_generic.c:724
VSF_WIN_ULONG_PTR * VSF_WIN_PDWORD_PTR
Definition win_generic.h:150
void __vsf_arch_irq_init(vsf_arch_irq_thread_t *irq_thread, char *name, vsf_arch_irq_entry_t entry, vsf_arch_prio_t priority)
Definition win_generic.c:691
void __vsf_arch_irq_request_fini(vsf_arch_irq_request_t *request)
Definition linux_generic.c:188
void * vsf_arch_alloc_exe(uint_fast32_t size)
Definition linux_generic.c:589
vsf_arch_irq_state_t
Definition win_generic.h:194
@ VSF_ARCH_IRQ_STATE_IDLE
Definition win_generic.h:195
@ VSF_ARCH_IRQ_STATE_BACKGROUND
Definition win_generic.h:198
@ VSF_ARCH_IRQ_STATE_FOREGROUND
Definition win_generic.h:197
@ VSF_ARCH_IRQ_STATE_ACTIVE
Definition win_generic.h:196
void __vsf_arch_irq_sleep(uint_fast32_t ms)
Definition linux_generic.c:321
VSF_ARCH_SYSTIMER_TICK_T vsf_systimer_tick_t
Definition win_generic.h:155
volatile bool vsf_gint_state_t
Definition win_generic.h:173
VSF_WIN_ULONG_PTR VSF_WIN_DWORD_PTR
Definition win_generic.h:150
void __vsf_arch_irq_end(vsf_arch_irq_thread_t *irq_thread, bool is_terminate)
Definition win_generic.c:669
void __vsf_arch_irq_fini(vsf_arch_irq_thread_t *irq_thread)
Definition win_generic.c:679
int __vsf_arch_trace(int level, const char *format,...)
Definition driver.c:97
void __vsf_arch_irq_request_pend(vsf_arch_irq_request_t *request)
Definition linux_generic.c:205
unsigned long VSF_WIN_ULONG_PTR
Definition win_generic.h:148
#define VSF_ARCH_SYSTIMER_TICK_T
Definition win_generic.h:153
void * VSF_WIN_HANDLE
Definition win_generic.h:140
int vsf_arch_argu(char ***argv)
Definition linux_generic.c:603
#define __VSF_WIN_PUBLIC_CONST__
Definition win_generic.h:30
void(* vsf_arch_irq_entry_t)(void *)
Definition win_generic.h:164
void __vsf_arch_irq_start(vsf_arch_irq_thread_t *irq_thread)
Definition win_generic.c:659
void vsf_arch_free_exe(void *ptr)
Definition linux_generic.c:594
void __vsf_arch_irq_request_send(vsf_arch_irq_request_t *request)
Definition linux_generic.c:228
void __vsf_arch_irq_request_init(vsf_arch_irq_request_t *request)
Definition linux_generic.c:167
unsigned int VSF_WIN_UINT
Definition win_generic.h:142
vsf_systimer_tick_t __vsf_systimer_get(void)
Definition win_generic.c:1067
vsf_arch_irq_thread_t * __vsf_arch_irq_get_cur(void)
Definition win_generic.c:719
#define VSF_ARCH_PRI_NUM
Definition win_generic.h:89