52 lines
1.7 KiB
C
52 lines
1.7 KiB
C
#pragma once
|
|
#ifndef LWIP_ARCH_SYS_ARCH_H
|
|
#define LWIP_ARCH_SYS_ARCH_H
|
|
|
|
#include <stdint.h>
|
|
#include <lwip/opt.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct sys_sem;
|
|
typedef struct sys_sem* sys_sem_t;
|
|
#define SYS_SEM_NULL NULL
|
|
#define sys_sem_valid(sem) ((sem) && (*(sem) != NULL))
|
|
#define sys_sem_valid_val(sem) ((sem) != NULL)
|
|
#define sys_sem_set_invalid(sem) do { if ((sem)) { *(sem) = NULL; } } while (0)
|
|
#define sys_sem_set_invalid_val(sem) do { (sem) = NULL; } while (0)
|
|
|
|
struct sys_mutex;
|
|
typedef struct sys_mutex* sys_mutex_t;
|
|
#define sys_mutex_valid(mutex) ((mutex) && (*(mutex) != NULL))
|
|
#define sys_mutex_valid_val(mutex) ((mutex) != NULL)
|
|
#define sys_mutex_set_invalid(mutex) do { if ((mutex)) { *(mutex) = NULL; } } while (0)
|
|
|
|
struct sys_mbox;
|
|
typedef struct sys_mbox* sys_mbox_t;
|
|
#define SYS_MBOX_NULL NULL
|
|
#define sys_mbox_valid(mbox) ((mbox) && (*(mbox) != NULL))
|
|
#define sys_mbox_valid_val(mbox) ((mbox) != NULL)
|
|
#define sys_mbox_set_invalid(mbox) do { if ((mbox)) { *(mbox) = NULL; } } while (0)
|
|
#define sys_mbox_set_invalid_val(mbox) do { (mbox) = NULL; } while (0)
|
|
|
|
/*
|
|
* lwIP only treats sys_thread_t as an opaque handle. Keep it pointer-sized.
|
|
*
|
|
* Do NOT make this a by-value incomplete struct. MSVC may compile callers
|
|
* that see only the incomplete type with a hidden struct-return parameter,
|
|
* which shifts sys_thread_new(name, thread, arg, ...) so the callee receives
|
|
* thread == name and arg == thread. The first tcpip_thread then jumps into
|
|
* the literal string "tcpip" as code.
|
|
*/
|
|
typedef void* sys_thread_t;
|
|
|
|
void LwipPortSetTimerQuery(uint64_t (*query_ticks_us)(void));
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* LWIP_ARCH_SYS_ARCH_H */
|